Linux – Advertise a Subnet Route with Radvd

icmpv6ipv6linuxradvd

we have set up a small IPv6 Testing network. The setup looks like this:

    ::/0
+----------+
| Firewall | Router to the public net
+----------+
     |           2001:...::/106
     |       +----------+
     +-------|  SIT GW  | sit Tunnel gatway to the some test users
     |       +----------+
     |
+----------+
| Test Sys |  Testsystem
+----------+

The idea is to advertise the default route from the firewall and the route for the SIT subnets from the sit gateway. The configurations for radvd are:

# Firewall
interface eth0
{
   AdvSendAdvert on;
   route ::/0 
   {
   };
};


# SIT Gatway
interface eth0
{
   AdvSendAdvert on;
   route 2001:...::/106
   {
   };
};

We have captured the adv. packages with tcpdump and the packages looks good. We see a default route from the fw, and the subnet route from the SIT gatway.

But if we look on the testsystem there are two default routes over both gateways. There is no subnet route. The routing does not work of course. Here the routes we get:

2001:.....::/64 dev eth0  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
fe80::/64 dev eth0  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 4294967295
default via fe80::baac:6fff:fe8e:XXXX dev eth0  proto kernel  metric 1024  expires 0sec mtu 1500 advmss 1440 hoplimit 64
default via fe80::e415:aeff:fe12:XXXX dev eth0  proto kernel  metric 1024  expires 0sec mtu 1500 advmss 1440 hoplimit 64

Any Idea?

Best Answer

I have found the problem.

Per default, the Linux kernel does only accept default routes via the router advertisement options in icmpv6.

To fix this, the correct kernel parameter must be set:

net.ipv6.conf.all.accept_ra_rt_info_max_plen = 128

From kernel docs:

accept_ra_rt_info_max_plen - INTEGER Maximum prefix length of Route Information in RA.

    Route Information w/ prefix larger than or equal to this
    variable shall be ignored.

    Functional default: 0 if accept_ra_rtr_pref is enabled.
                        -1 if accept_ra_rtr_pref is disabled.