🔄 IPv6 Transition
9 分钟阅读
SLAAC vs DHCPv6: IPv6 Address Assignment
Compare the two methods of IPv6 address assignment — stateless autoconfiguration (SLAAC) and DHCPv6 — and learn when to use each.
Two Approaches to IPv6 Addressing
IPv6 offers two fundamentally different methods for assigning addresses to devices:
| Feature | SLAAC | DHCPv6 |
|---|---|---|
| Full name | Stateless Address Autoconfiguration | Dynamic Host Configuration Protocol v6 |
| RFC | RFC 4862 | RFC 8415 |
| Server needed? | No (router only) | Yes (DHCPv6 server) |
| Address assignment | Device generates its own | Server assigns address |
| DNS server info | Via RDNSS option (RFC 8106) | Via DHCPv6 options |
| Tracking/auditing | Difficult | Easy (server has lease log) |
How SLAAC Works
- Device sends a Router Solicitation (RS) to the all-routers multicast address.
- Router responds with a Router Advertisement (RA) containing the network prefix (e.g.,
2001:db8:1::/64). - Device generates its own interface ID (64 bits) and combines it with the prefix.
- Device performs Duplicate Address Detection (DAD) to ensure uniqueness.
Prefix from RA: 2001:0db8:0001:0000:
Interface ID: aaaa:bbbb:cccc:dddd (from MAC or random)
Full address: 2001:0db8:0001:0000:aaaa:bbbb:cccc:dddd/64
Privacy Extensions (RFC 8981)
By default, SLAAC generates the interface ID from the device's MAC address, making it trackable across networks. Privacy extensions generate random, temporary interface IDs that rotate periodically.
# Check if privacy extensions are enabled (Linux)
sysctl net.ipv6.conf.all.use_tempaddr
# 0 = disabled, 2 = enabled (prefer temporary addresses)
# Enable privacy extensions
sudo sysctl -w net.ipv6.conf.all.use_tempaddr=2
How DHCPv6 Works
DHCPv6 uses a client-server model similar to DHCPv4:
- Client sends Solicit to DHCPv6 multicast.
- Server responds with Advertise.
- Client sends Request for a specific address.
- Server sends Reply with the assigned address and options.
DHCPv6 can also operate in stateless mode — providing only DNS and other options while SLAAC handles addressing.
When to Use Each
| Scenario | Recommended |
|---|---|
| Home network | SLAAC (simplest, no server needed) |
| Small office | SLAAC + stateless DHCPv6 (for DNS) |
| Enterprise | DHCPv6 stateful (address tracking, compliance) |
| IoT devices | SLAAC (devices may not support DHCPv6) |
| Data center | DHCPv6 or static (predictable addressing) |
Key Differences from IPv4
- IPv6 devices typically have multiple addresses — a link-local, one or more global, and possibly temporary.
- There is no ARP in IPv6 — Neighbor Discovery Protocol (NDP) replaces it.
- Routers never assign addresses in IPv6 — they only advertise prefixes (SLAAC) or direct devices to a DHCPv6 server.