DHCPv6 vs SLAAC: How IPv6 Addresses Are Assigned
An IPv6 host can obtain an address automatically in two ways: DHCPv6 and SLAAC. With SLAAC (stateless address autoconfiguration, RFC 4862), the host learns the link's prefix from the router advertisements (RAs) that routers send, creates its own interface ID and assembles the address. No server keeps track of which host uses which address, which is why it is called "stateless". With DHCPv6 (RFC 8415), as with DHCP for IPv4, a server chooses an address, leases it for a limited time and keeps a record of it. Either way, the default gateway is learned from RAs. There is also a combination called stateless DHCPv6, in which the address is formed by SLAAC and only other information, such as the DNS server address, comes from DHCPv6.
| Aspect | DHCPv6 | SLAAC |
|---|---|---|
| Who decides the address | The DHCPv6 server, which picks one from the range it manages and leases it for a limited time | The host itself, which combines the prefix learned from RAs with an interface ID it creates |
| State | Stateful: the server records which address it leased to which host | Stateless: no server records address assignments |
| What is required | A DHCPv6 server (and a relay agent if it is on another link), plus RAs telling hosts to use DHCPv6 | A router sending RAs that announce the prefix |
| Messages used | UDP (port 546 for clients, 547 for servers and relay agents); the basic exchange is Solicit, Advertise, Request and Reply | Router Solicitation (RS) and Router Advertisement (RA) from ICMPv6 Neighbor Discovery (NDP) |
| Default gateway | Not provided by DHCPv6; the link-local address of the router that sent the RA is used | The link-local address of the router that sent the RA is used |
| DNS server address | Provided in a DHCPv6 option | Provided in an RA option (RDNSS) or by stateless DHCPv6 |
| Interface ID (lower 64 bits) | Chosen by the server | EUI-64 format derived from the MAC address, or a value based on random numbers; for privacy, many operating systems use random-based values |
| Prefix length and delegation | Assigns addresses one at a time, so it also works with prefixes other than /64; it can also delegate whole prefixes to routers (DHCPv6-PD) | Generally assumes a /64 prefix; cannot delegate prefixes |
| How easy it is to track addresses | The server's records show which host uses which address; clients are identified by an identifier called a DUID | There are no server records, so finding a host's address means checking, for example, the router's neighbor cache |
Figures are typical orders of magnitude and vary by process generation and product.