Configuring RA on routers or RADVD with Linux

Ok, so in an ideal world, you have 2 allocations: 1 allocation for your server/router’s uplink, and 1 allocation that is a statically routed subnet (either a /64 or /48) to your side of that uplink allocation. For example:

2001:DB8:0:1::/64 = uplink allocation
2001:DB8:0:1::1 = upstream router IP (gateway)
2001:DB8:0:1::2 = customer configured IP (your WAN uplink interface to provider)
2001:DB8:2::/48 = statically routed subnet pointing at 2001:DB8:0:1::2

If you are using a hardware router like a Cisco or a Brocade and you want a LAN segment to have the hosts auto-configure IPv6 addresses, then you simply add the following to that LAN facing interface:

ipv6 enable
ipv6 address 2001:DB8:2::1/64

If hosts on that LAN segment have auto-configuration enabled, then they will do just that: auto-configure IPs on their LAN interfaces using EUI-64/SLAAC.

To use a Linux machine to act as your IPv6 gateway, you’ll need a little help from the RADVD package. First and foremost, you will need IPv6 packet forwarding enabled on the Linux machine that will act as your IPv6 router. Edit /etc/sysctl.conf and add the following line:

net.ipv6.conf.all.forwarding = 1

Then run: sysctl -p to apply changes made to the config file.

Next you will need an IP out of one of the /64s, from your statically routed /48, that you want to use for auto-configuration configured on your LAN facing interface. Let us assume that eth0 is your WAN interface and eth1 is your LAN interface. IP configurations for those interfaces should look like:

eth0 = 2001:DB8:0:1::2/64
eth1 = 2001:DB8:2::1/64

You’ll need to install RADVD either from source or your preferred Linux distro repository of packages. Then edit the radvd.conf file for your prefix and any options you want to enable. What follows is my generic sample configuration. This hasn’t failed to work for me yet:

interface eth1
{
     AdvSendAdvert on;
     AdvHomeAgentFlag off;
     MinRtrAdvInterval 30;
     MaxRtrAdvInterval 100;
     prefix 2001:DB8:2::/64
     {
          AdvOnLink on;
          AdvAutonomous on;
          AdvRouterAddr on;
     };
};

Now you should be able to fire up the RADVD daemon, and hosts on the LAN set to auto-configure should begin to do so. You will find that on the LAN host, their default route and gateway point to the Link-Local address of eth1 on the Linux machine acting as the IPv6 gateway/router. This is entirely normal and expected.

Congrats! Now you should have proper IPv6 access from behind either a hardware router or a Linux machine acting as the gateway/router.