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=1To 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:
AdvSendAdvert on: Instructsradvdto broadcast periodic advertisements and respond to solicitations on this specific interface.MinRtrAdvIntervalandMaxRtrAdvInterval: Define the minimum and maximum delays (in seconds) between unsolicited multicast advertisements.AdvManagedFlag(M flag): When set tooff, clients use SLAAC. If set toon, hosts query a stateful DHCPv6 server for addresses.AdvOtherConfigFlag(O flag): When set toon, hosts use SLAAC for address configuration but query DHCPv6 for other settings, such as domain search lists.prefixblock: Declares the IPv6 subnet to advertise.AdvOnLink on: Tells clients that the prefix is assigned directly to the local link layer.AdvAutonomous on(A flag): Tells clients they can use this prefix for SLAAC address generation.RDNSSblock: Distributes Recursive DNS Server addresses directly via Router Advertisements (RFC 8106), eliminating the need for DHCPv6 for basic DNS resolution.
How radvd Interacts with the Network and Kernel
Once configured, the daemon operates through raw sockets using the ICMPv6 protocol (IPv6 Next Header 58):
- Multicast Listening:
radvdjoins theff02::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 toff02::2rather than waiting for a periodic announcement. - Solicitation Response: Upon receiving a Router
Solicitation,
radvdimmediately transmits an ICMPv6 Type 134 (Router Advertisement) back to the link-local scope. - Periodic Broadcasts: Independent of solicitations,
radvdcontinuously sends unsolicited RAs to theff02::1(all-nodes) multicast group at intervals bounded byMinRtrAdvIntervalandMaxRtrAdvInterval. - 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 radvdYou 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.