Managing IPv6 Router Advertisements with radvd on Linux

This article explains how the Linux operating system uses the Router Advertisement Daemon (radvd) to manage IPv6 address distribution and network parameters. You will learn the core mechanism behind the Neighbor Discovery Protocol (NDP), how radvd interacts with the Linux kernel to broadcast Router Advertisements (RAs), how to configure the daemon for Stateless Address Autoconfiguration (SLAAC), and how clients consume these broadcasts to configure their network interfaces automatically.

The Role of radvd and IPv6 Autoconfiguration

In IPv6 networks, devices do not rely on traditional DHCP in the same way IPv4 does. Instead, they commonly use Stateless Address Autoconfiguration (SLAAC), defined in RFC 4862. SLAAC allows a host to configure its own IPv6 address by combining a locally generated interface identifier (often derived from the MAC address or generated randomly) with a network prefix advertised by a local router.

Because the Linux kernel itself does not automatically generate and broadcast periodic unsolicited ICMPv6 Router Advertisement messages, user-space software is required when a Linux machine acts as an IPv6 router. The radvd daemon fills this role by listening for ICMPv6 Router Solicitations (RS) from clients and broadcasting periodic ICMPv6 Router Advertisements (RA) over designated local links.

Prerequisites: Linux Kernel Packet Forwarding

Before radvd can function, the Linux kernel must be configured to route IPv6 traffic. By default, Linux operates as an IPv6 host rather than a router. Enabling IPv6 forwarding changes this behavior and permits the transmission of routing advertisements.

To enable IPv6 forwarding globally, configure the kernel parameter via sysctl:

sysctl -w net.ipv6.conf.all.forwarding=1

To make this change permanent, add the following line to /etc/sysctl.conf or a dedicated file in /etc/sysctl.d/:

net.ipv6.conf.all.forwarding = 1

Configuring the radvd Daemon

The daemon reads its operational parameters from /etc/radvd.conf. This configuration file specifies which interfaces send advertisements, how often they are sent, the network prefixes available for autoconfiguration, and optional parameters like MTU and DNS settings.

A standard configuration file defines an interface block containing routing directives:

interface eth1 {
    AdvSendAdvert on;
    MinRtrAdvInterval 30;
    MaxRtrAdvInterval 100;
    AdvManagedFlag off;
    AdvOtherConfigFlag off;

    prefix 2001:db8:1::/64 {
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr on;
    };

    RDNSS 2001:db8:1::1 {
        AdvRDNSSLifetime 300;
    };
};

Key configuration directives include:

How radvd Interacts with the Network and Kernel

Once configured, the daemon operates through raw sockets using the ICMPv6 protocol (IPv6 Next Header 58):

  1. Multicast Listening: radvd joins the ff02::2 (all-routers) link-local multicast group. When a new device connects to the network, it typically transmits an ICMPv6 Type 133 (Router Solicitation) message to ff02::2 rather than waiting for a periodic announcement.
  2. Solicitation Response: Upon receiving a Router Solicitation, radvd immediately transmits an ICMPv6 Type 134 (Router Advertisement) back to the link-local scope.
  3. Periodic Broadcasts: Independent of solicitations, radvd continuously sends unsolicited RAs to the ff02::1 (all-nodes) multicast group at intervals bounded by MinRtrAdvInterval and MaxRtrAdvInterval.
  4. Client Processing: Receiving nodes extract the prefix, append their 64-bit interface identifier, verify uniqueness via Duplicate Address Detection (DAD), and configure the Linux machine's link-local address as their default IPv6 gateway.

Managing the Service

The daemon is controlled through standard systemd commands. Once the configuration file /etc/radvd.conf is validated, the service can be enabled and started:

systemctl enable radvd
systemctl start radvd

You can verify that the daemon is correctly broadcasting packets on the interface using tcpdump:

tcpdump -n -i eth1 icmp6 and 'ip6[40] == 134'

This command filters for ICMPv6 Type 134 packets, confirming that the Linux host is actively broadcasting Router Advertisements across the local segment.