Configuring IPv6 Router Advertisement with radvd on Linux: A Practical Guide to SLAAC Provisioning

Network tutorial - IT technology blog
Network tutorial - IT technology blog

At 2:00 AM, the PagerDuty alarm went off relentlessly. Around 40 worker nodes newly scaled out across an internal VLAN simultaneously lost outbound connectivity. A quick check showed IPv4 traffic was completely normal. However, all dual-stack services prioritizing IPv6 were timing out while resolving domains. Logging into the Ubuntu gateway revealed the culprit: the Router Advertisement daemon had crashed unexpectedly, causing client machines to lose both their default routes and IPv6 prefixes.

Three Ways to Assign IPv6 in an Internal LAN

When deploying IPv6 across an office network or server cluster, you typically consider three approaches:

  • Static IP Assignment: Configured manually or provisioned via cloud-init for each host. This works fine for a handful of fixed nodes. Once infrastructure scales to 50–100 machines, manual tracking easily leads to IP conflicts and high operational overhead.
  • Stateful DHCPv6: Uses a centralized server (such as Kea DHCP or ISC-DHCP) to lease addresses and track lease tables by DUID. Major drawback: Android does not natively support Stateful DHCPv6 at the OS kernel level, which can easily break mixed-device environments.
  • SLAAC (Stateless Address Autoconfiguration) via Router Advertisement (RA): The router periodically broadcasts ICMPv6 Type 134 packets. Client devices receive the network prefix (typically a /64) and autonomously generate their own Interface ID using EUI-64 or RFC 7217 (Stable Privacy) without requiring a stateful lease server.

Practical Comparison of IPv6 Solutions

Here is a quick summary to help you choose the best fit for your infrastructure:

Criteria Static IP Stateful DHCPv6 SLAAC (radvd)
Scalability Low; heavy operational overhead when scaling. Moderate; constrained by the DHCP server database. Very high; clients autonomously compute IPs in a distributed manner.
OS Compatibility Full. Inconsistent (Android does not support Stateful DHCPv6). 100% supported across Linux, Windows, macOS, iOS, and Android.
System Overhead Negligible. Requires resources to maintain and synchronize lease tables. Extremely lightweight; gateway only broadcasts tiny packets (a few KB) periodically.
Default Route Provisioning Must be configured manually. Not supported (DHCPv6 does not provide a default route!). Acquired automatically via the router’s Link-Local address (fe80::).

A crucial detail that network administrators often overlook: the DHCPv6 protocol specification does not support a default gateway option. No matter how advanced your Kea or ISC-DHCP setup is, you still need Router Advertisements to push the Link-Local default gateway to clients. Consequently, SLAAC remains the essential foundation of any IPv6 deployment.

Why Choose radvd on a Linux Gateway?

For Linux servers running KVM, Proxmox, or DIY routers, radvd (Router Advertisement Daemon) is the most stable and lightweight solution available (typically consuming under 15MB RAM). The daemon listens for Router Solicitation requests (ICMPv6 Type 133) from clients and broadcasts RA announcements (ICMPv6 Type 134) across your internal interfaces.

For SLAAC to operate properly, your LAN subnet must strictly adhere to a /64 prefix length under RFC 4291. You cannot carve out smaller subnets such as /80 or /112, as autoconfiguration will fail immediately. If you need to calculate subnets quickly from an ISP-assigned /48 or /56 block, check out toolcraft.app/en/tools/developer/ip-subnet-calculator to verify address ranges before applying your configuration.

Step-by-Step radvd Deployment on an Ubuntu/Debian Gateway

Lab architecture:

  • Gateway OS: Ubuntu 22.04 / 24.04 LTS.
  • WAN uplink interface: eth0.
  • Internal LAN interface: eth1 (configured with static IP: 2001:db8:1000:1::1/64).
  • Allocated client subnet: 2001:db8:1000:1::/64.

Step 1: Enable IPv6 Forwarding in the Linux Kernel

If packet forwarding is disabled, radvd will log an error and exit immediately upon startup. Create a sysctl configuration file:

sudo nano /etc/sysctl.d/99-ipv6-forwarding.conf

Add the following directives:

net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
# Prevent the LAN interface from accepting external RAs to avoid unintended gateway changes
net.ipv6.conf.eth1.accept_ra = 0

Apply the settings immediately without rebooting:

sudo sysctl --system

Confirm that the forwarding flag returns 1:

cat /proc/sys/net/ipv6/conf/all/forwarding

Step 2: Install radvd

On Debian or Ubuntu:

sudo apt update && sudo apt install -y radvd

On Rocky Linux, AlmaLinux, or RHEL 9:

sudo dnf install -y epel-release
sudo dnf install -y radvd

Step 3: Create the /etc/radvd.conf Configuration File

By default, this file does not exist. Create a new one:

sudo nano /etc/radvd.conf

Production-ready template:

interface eth1
{
    AdvSendAdvert on;
    MinRtrAdvInterval 200;
    MaxRtrAdvInterval 600;
    AdvManagedFlag off;
    AdvOtherConfigFlag off;
    AdvLinkMTU 1500;

    prefix 2001:db8:1000:1::/64
    {
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr on;
        AdvValidLifetime 86400;      # 24 hours
        AdvPreferredLifetime 14400;  # 4 hours
    };

    # Advertise DNS directly via RFC 8106 (RDNSS)
    RDNSS 2001:4860:4860::8888 2001:4860:4860::8844
    {
        AdvRDNSSLifetime 1800;       # Must be >= 3 * MaxRtrAdvInterval (3 * 600s)
    };
};

Explanation of key technical parameters:

  • MinRtrAdvInterval / MaxRtrAdvInterval (200s – 600s): The interval between unsolicited periodic RA broadcasts. During initial testing or debugging, you can lower this to 3s – 10s. For production, keep it between 200s – 600s to avoid flooding the segment with unnecessary broadcast traffic.
  • AdvAutonomous on: Permits clients to autonomously generate their own host address.
  • AdvManagedFlag off & AdvOtherConfigFlag off: Signals clients to use pure SLAAC without issuing DHCPv6 requests for addresses or DNS.
  • AdvRDNSSLifetime (1800s): Compliant with RFC 8106, this value must be at least 3 * MaxRtrAdvInterval. Setting it too short (under 600s) causes client DNS caches to expire prematurely between RA broadcasts.

Step 4: Allow ICMPv6 Traffic Through the Gateway Firewall

This is where 90% of engineers encounter issues: iptables or ufw dropping ICMPv6 neighbor discovery packets. Ensure your gateway accepts Type 133 solicitations and emits Type 134 announcements:

# Allow router solicitation & advertisement
sudo ip6tables -A INPUT -i eth1 -p icmpv6 --icmpv6-type router-solicitation -j ACCEPT
sudo ip6tables -A OUTPUT -o eth1 -p icmpv6 --icmpv6-type router-advertisement -j ACCEPT

Step 5: Verify Syntax and Start the Service

Before launching systemctl, always validate your configuration syntax using the -c flag:

sudo radvd -c

If the command executes silently with no output, the configuration is valid. Now start and enable the daemon:

sudo systemctl restart radvd
sudo systemctl enable radvd
sudo systemctl status radvd

Step 6: Verify Connectivity on the Client

Log in to a client VM attached to the LAN interface eth1. Use the rdisc6 utility to actively query for routers without waiting on the broadcast timer:

sudo apt install -y ndisc6
sudo rdisc6 eth0

The output will display the advertised prefix 2001:db8:1000:1::/64 alongside the gateway’s Link-Local fe80::... address. Next, inspect the network configuration on the client:

ip -6 addr show dev eth0
ip -6 route show

You should see a newly generated Global Unicast address marked with scope global dynamic mngtmpaddr, along with a default route pointing directly to the router’s Link-Local IP. Test external connectivity:

ping -6 -c 4 2001:4860:4860::8888

If the client still lacks an address, return to the gateway and inspect traffic with tcpdump to isolate the problem:

sudo tcpdump -ni eth1 -vv 'icmp6 and (ip6[40] == 133 or ip6[40] == 134)'

If you observe the client sending Type 133 packets and the gateway immediately responding with Type 134 within milliseconds, your SLAAC IPv6 auto-provisioning is working as intended.

Share: