Sub topic 14
A short look at IPv6: SLAAC and DHCPv6
This chapter assumes you know the DHCPv4 exchange from the earlier chapters (Discover, Offer, Request, Acknowledge), what a lease is, and what a default gateway and DNS server do. It also assumes you know that an IPv6 address has a prefix and an interface ID.
IPv6 has no broadcast
IPv6 removes broadcast. Hosts use multicast instead, so DHCPv4's "shout to 255.255.255.255" does not carry over. IPv6 also gives a host a second way to configure itself, with no server that tracks leases.
Every IPv6 interface first builds a link-local address in fe80::/10. The host can use it on the local link right away, before any other configuration.
SLAAC: the router advertises the prefix
Stateless Address Autoconfiguration (SLAAC) works like this:
- The host sends a Router Solicitation (RS) to the all-routers multicast address
ff02::2. - A router answers with a Router Advertisement (RA). It also sends RAs periodically to
ff02::1(all nodes). - The RA carries the on-link prefix (normally a /64), the default gateway (the router's own address), and flags.
- The host appends an interface ID to the prefix. Modern systems use a random or stable-opaque ID. Older ones derived it from the MAC address (EUI-64).
- The host runs Duplicate Address Detection (DAD) with a Neighbor Solicitation for its new address. If nobody answers, it uses the address.
No server stores anything, so there is no lease table to manage. The RA can also carry DNS servers (the RDNSS option), so SLAAC alone can give a working configuration.
DHCPv6: when you need a server
DHCPv6 uses UDP port 546 on the client and 547 on the server or relay. The client sends to the multicast address ff02::1:2. The stateful exchange is Solicit, Advertise, Request, Reply. This is similar to DORA but has different names.
DHCPv6 does not hand out a default gateway. The gateway always comes from the RA. DHCPv6 also identifies clients by a DUID (DHCP Unique Identifier), not by MAC address, so reservations are written against the DUID.
Two flags in the RA tell the host which mode to use:
| Mode | M flag | O flag | Address from | Other settings (DNS) from |
|---|---|---|---|---|
| SLAAC only | 0 | 0 | Prefix in the RA | RA (RDNSS) or none |
| SLAAC + stateless DHCPv6 | 0 | 1 | Prefix in the RA | DHCPv6 Information-Request |
| Stateful DHCPv6 | 1 | any | DHCPv6 server (IA_NA) | DHCPv6 |
Prefix delegation (IA_PD) is a separate DHCPv6 feature. A home router uses it to request a whole prefix from its ISP and then divides that prefix among its LANs.
Inspecting IPv6 configuration
These commands capture the RA and DHCPv6 traffic and show the addresses on the interface:
# Router Solicitations (type 133) and Advertisements (type 134)
sudo tcpdump -n -i eth0 -vv 'icmp6 and (ip6[40] == 133 or ip6[40] == 134)'
# DHCPv6 traffic
sudo tcpdump -n -i eth0 -vv 'udp and (port 546 or port 547)'
# Addresses on the interface
ip -6 addr show eth0In the ip -6 addr output, look for scope link (the fe80:: address) and scope global (the SLAAC or DHCPv6 address).
Common errors
- A client has only an
fe80::address. No RA arrived, or the RA had the autonomous flag (A) cleared and no DHCPv6 server answered. - A client has an address but no DNS. The RA has no RDNSS option and the O flag is 0.
- No default gateway with DHCPv6 only. The router must still send RAs. DHCPv6 cannot supply a gateway.
Exercise
A network sets M=0 and O=1 in its Router Advertisements. Where does a client get its address, and where does it get its DNS server list?
Show answer
The client builds its address with SLAAC from the prefix in the RA. It gets DNS servers (and other settings) from a DHCPv6 server through an Information-Request. The default gateway still comes from the RA.