In this lesson, you will learn how to configure a Linux server to act as an IPv6 gateway by managing Router Advertisements (RAs) to dictate how clients on your network obtain their addresses.
The Role of Router Advertisements
In IPv6, the Neighbor Discovery Protocol (NDP) replaces the legacy DHCP-based discovery of the IPv4 era. By sending Router Advertisements, your Linux gateway announces its presence and informs local hosts whether they should perform Stateless Address Autoconfiguration (SLAAC) or request a stateful assignment from a DHCPv6 server.
Configuring radvd
While the kernel handles the forwarding of packets, you typically use radvd (Router Advertisement Daemon) to manage the advertising process. To act as a gateway, you must ensure net.ipv6.conf.all.forwarding is set to 1. Once enabled, you configure /etc/radvd.conf to define the behavior:
interface eth0 {
AdvSendAdvert on;
# Enable SLAAC (Stateless)
prefix 2001:db8:1::/64 {
AdvOnLink on;
AdvAutonomous on;
};
# Set Managed flag for Stateful DHCPv6
AdvManagedFlag on;
};
Stateful vs. Stateless Configuration
- Stateless (SLAAC): By setting
AdvAutonomous on, your Linux gateway tells clients to generate their own IP addresses using the network prefix provided in the RA combined with their hardware MAC address or a random identifier. This requires no central state tracking. - Stateful (DHCPv6): By setting
AdvManagedFlag on, the gateway instructs clients to ignore SLAAC and reach out to a stateful DHCPv6 server to receive a managed IP address. This gives you granular control over exactly which address is assigned to which device, similar to traditional IPv4 DHCP.
By toggling these flags, your Linux gateway orchestrates the entire address assignment policy for the subnet. This is the foundation of network-wide IPv6 management, ensuring that every host knows both its network path and its method for joining the broader topology.
Key Takeaway: Router Advertisements allow your Linux gateway to command clients to either self-configure via SLAAC or request addresses from a stateful DHCPv6 server.