Address autoconfiguration: SLAAC and DHCPv6 basics
Walk through Stateless Address Autoconfiguration (SLAAC) from link-local address to global address, including Duplicate Address Detection. Explain how the Router Advertisement M, O and A flags select between SLAAC, stateless DHCPv6 and stateful DHCPv6. Build a modified EUI-64 interface identifier from a MAC address, and compare it with stable-privacy and temporary identifiers. Describe the DHCPv6 message exchange and what DHCPv6 does not provide.
Take the quiz · pass mark 70% · 9 questions
Explanation
Two ways to get an address, and why IPv6 has both
IPv4 hosts get addresses manually or from DHCP. IPv6 adds a third way that needs no server at all:
| Method | Who chooses the address | Server state | Defined in |
|---|---|---|---|
| SLAAC (stateless address autoconfiguration) | The host, from the prefix in the RA | None | RFC 4862 |
| Stateful DHCPv6 | A DHCPv6 server (leases, like DHCPv4) | Leases | RFC 9915 |
| Stateless DHCPv6 | The host, via SLAAC; DHCPv6 only supplies "other" settings such as DNS | None | RFC 9915 |
| Manual | The administrator | n/a | n/a |
Whatever the method, the default route always comes from Router Advertisements (RFC 4861). DHCPv6 has no "router" option.
SLAAC step by step
Drawing diagram…
- Link-local address. The host combines
fe80::/64with a 64-bit interface identifier (IID). - Duplicate Address Detection (DAD). While the address is tentative, the host sends a Neighbor Solicitation from the unspecified address
::to the address's solicited-node group, asking "is anyone using this?". If an NA comes back, the address is a duplicate and is not used. - Router Solicitation to
ff02::2. - Router Advertisement with one or more Prefix Information Options (PIO). Each PIO has:
- L (on-link) flag: addresses in this prefix are on this link.
- A (autonomous) flag: you may build an address from this prefix with SLAAC.
- Valid lifetime and preferred lifetime.
- For each PIO with A = 1 and a /64 prefix, the host forms prefix + IID and runs DAD again.
- The address becomes preferred. When the preferred lifetime runs out it becomes deprecated (kept for existing connections, not used for new ones). When the valid lifetime runs out it is removed.
SLAAC needs a /64 on Ethernet-like links, because the interface identifier is 64 bits (RFC 4291). If you advertise a /56 or a /72 with A = 1, hosts will not autoconfigure from it.
Interface identifiers: three generations
1. Modified EUI-64 (original, RFC 4291 Appendix A). Built from the 48-bit MAC address:
MAC 00:1a:2b:3c:4d:5e
split 00:1a:2b | 3c:4d:5e
insert ff:fe 00:1a:2b:ff:fe:3c:4d:5e
flip bit 7 02:1a:2b:ff:fe:3c:4d:5e (0x00 XOR 0x02, the universal/local bit)
IID 021a:2bff:fe3c:4d5e
This is simple, but the MAC address appears in every address the host uses, everywhere it goes. That lets anyone track a device across networks and reveals the hardware vendor.
2. Stable, semantically opaque IIDs (RFC 7217). The IID is a hash of the prefix, the interface, a secret key and a few other inputs. It is stable on a given network (good for servers, logs and ACLs), changes between networks (no tracking), and does not reveal the MAC. RFC 8064 recommends this method instead of EUI-64 for stable addresses.
3. Temporary addresses (RFC 8981). Random IIDs that are regenerated periodically and used for outgoing connections, so that a client is harder to correlate over time. A typical client has a stable address plus one or more temporary ones.
Most current operating systems use stable-privacy and/or temporary addresses by default for clients. You will see EUI-64 on older devices, some network equipment, and anywhere it is configured on purpose.
The RA flags that choose the method
| RA M flag | RA O flag | PIO A flag | Result |
|---|---|---|---|
| 0 | 0 | 1 | SLAAC only. DNS from the RA's RDNSS option (RFC 8106), if present |
| 0 | 1 | 1 | SLAAC + stateless DHCPv6 for DNS and other options |
| 1 | (any) | 0 | Stateful DHCPv6 addresses only |
| 1 | (any) | 1 | Both: SLAAC addresses and DHCPv6 addresses |
- M (Managed): "addresses are available from DHCPv6".
- O (Other configuration): "other information is available from DHCPv6".
- Not every client follows M: some devices (historically Android in particular) do not support stateful DHCPv6 address assignment. That is a common reason networks give SLAAC + RDNSS to clients.
DHCPv6 in brief
DHCPv6 (RFC 9915, the current DHCPv6 standard, published in 2026) uses UDP: clients on port 546 and servers and relays on 547. Clients send to the multicast group ff02::1:2 (all DHCP relay agents and servers) from their link-local address.
Drawing diagram…
Key differences from DHCPv4:
- Clients are identified by a DUID (DHCP Unique Identifier), not a MAC address. This catches people out when they try to make "MAC reservations".
- No default route is given (it comes from RAs), and no prefix length is given. Leased addresses are installed as /128s, and on-link prefixes come from the RA's PIO.
- Prefix delegation (IA_PD) lets a router request a whole prefix (such as a /56) for its LANs. This is how ISPs number home networks (L3.03, L7.01).
Worked examples
Example 1: Build a SLAAC EUI-64 address
Question: A host with MAC 00:1a:2b:3c:4d:5e uses EUI-64 and receives a PIO for 2001:db8:40:1::/64. What global address does it form, and what is its link-local address?
Working: IID = 021a:2bff:fe3c:4d5e (shown above). Global: 2001:db8:40:1:21a:2bff:fe3c:4d5e. Link-local: fe80::21a:2bff:fe3c:4d5e.
Example 2: A locally administered MAC
Question: A virtual machine has MAC 52:54:00:12:34:56. What is its EUI-64 IID?
Working: 52 = 0101 0010. Flipping bit 7 (the 0x02 bit) gives 0101 0000 = 50. Inserting ff:fe gives 50:54:00:ff:fe:12:34:56, so the IID is 5054:ff:fe12:3456. (00ff is written ff in canonical form.)
Example 3: Read the RA flags
Question: An RA has M = 0 and O = 1, a PIO with A = 1 for 2001:db8:40:1::/64, and no RDNSS option. Where does a client get its address and its DNS servers?
Working: The address comes from SLAAC, because A = 1 and M = 0. DNS comes from stateless DHCPv6 (O = 1, Information-request/Reply).
Example 4: Lifetimes
Question: A PIO has preferred lifetime 3,600 s and valid lifetime 7,200 s, and the router then stops advertising the prefix. What happens to an address built from it?
Working: For 3,600 s it is preferred (used for new connections). From 3,600 s to 7,200 s it is deprecated (existing connections continue; new ones use another address if one is available). After 7,200 s it is removed.
Lab
Goal: Bring a client up with SLAAC + RDNSS, then with stateful DHCPv6, and compare the results.
You need: Linux with iproute2, radvd, ISC Kea (kea-dhcp6-server), a DHCPv6 client (dhcpcd or dhclient), and tcpdump.
Step 1: Topology
sudo ip netns add r1; sudo ip netns add c1
sudo ip link add rv type veth peer name cv
sudo ip link set rv netns r1; sudo ip link set cv netns c1
sudo ip -n r1 link set rv up; sudo ip -n c1 link set cv up
sudo ip -n r1 link set lo up; sudo ip -n c1 link set lo up
sudo ip -n c1 link set cv address 00:1a:2b:3c:4d:5e
sudo ip -n r1 -6 addr add 2001:db8:40:1::1/64 dev rv
sudo ip netns exec r1 sysctl -qw net.ipv6.conf.all.forwarding=1
sudo ip netns exec c1 sysctl -qw net.ipv6.conf.cv.addr_gen_mode=0 # 0 = EUI-64 for this part of the lab
Step 2: SLAAC + RDNSS
cat <<'EOF2' | sudo tee /tmp/radvd-l106.conf
interface rv {
AdvSendAdvert on; MinRtrAdvInterval 5; MaxRtrAdvInterval 15;
AdvManagedFlag off; AdvOtherConfigFlag off;
prefix 2001:db8:40:1::/64 { AdvOnLink on; AdvAutonomous on; AdvPreferredLifetime 3600; AdvValidLifetime 7200; };
RDNSS 2001:db8:40:1::53 { };
};
EOF2
sudo ip netns exec c1 tcpdump -i cv -n -vv icmp6 -w /tmp/l106-slaac.pcap &
sudo ip netns exec r1 radvd -C /tmp/radvd-l106.conf -p /tmp/radvd-l106.pid &
sleep 20; sudo pkill tcpdump
sudo ip -n c1 -6 addr show dev cv
sudo ip -n c1 -6 route
Check that the global address matches your EUI-64 calculation for 00:1a:2b:3c:4d:5e. In the capture, find the DAD Neighbor Solicitations (source ::) and the RA's PIO and RDNSS option.
Now switch to stable-privacy addressing and compare:
sudo ip netns exec c1 sysctl -qw net.ipv6.conf.cv.stable_secret=$(python3 -c "import secrets,ipaddress;print(ipaddress.IPv6Address(secrets.token_bytes(16)))")
sudo ip netns exec c1 sysctl -qw net.ipv6.conf.cv.addr_gen_mode=2
sudo ip -n c1 link set cv down; sudo ip -n c1 link set cv up; sleep 10
sudo ip -n c1 -6 addr show dev cv
Step 3: Stateful DHCPv6
Change the RA to M = 1 and A = 0 (AdvManagedFlag on; and AdvAutonomous off;), restart radvd, and run Kea on r1:
{ "Dhcp6": {
"interfaces-config": { "interfaces": [ "rv" ] },
"lease-database": { "type": "memfile", "persist": false },
"subnet6": [ {
"id": 1, "subnet": "2001:db8:40:1::/64", "interface": "rv",
"pools": [ { "pool": "2001:db8:40:1::100 - 2001:db8:40:1::1ff" } ],
"option-data": [ { "name": "dns-servers", "data": "2001:db8:40:1::53" } ]
} ]
} }
sudo ip netns exec r1 kea-dhcp6 -c /tmp/kea-l106.json &
sudo ip netns exec c1 tcpdump -i cv -n -vv 'udp port 546 or udp port 547' &
sudo ip netns exec c1 dhcpcd -6 -B cv # or: dhclient -6 -v cv
Record the four DHCPv6 messages, the leased address and its prefix length, the client's DUID, and where the client's default route came from.
Clean up
sudo pkill radvd; sudo pkill kea-dhcp6; sudo pkill dhcpcd; sudo pkill dhclient; sudo pkill tcpdump
sudo ip netns del r1; sudo ip netns del c1
Summary
- SLAAC: form a link-local address, run DAD (NS from
::), solicit an RA, build an address from each /64 PIO with A = 1, run DAD again. Addresses move from tentative to preferred, deprecated and finally invalid. - Interface identifiers: modified EUI-64 (MAC-based, trackable), stable-privacy (RFC 7217, recommended by RFC 8064) and temporary (RFC 8981, random, for outgoing connections).
- RA flags: M means addresses via DHCPv6, O means other settings via DHCPv6, and A (per prefix) means SLAAC allowed. DNS can come from the RA's RDNSS option (RFC 8106).
- DHCPv6 (RFC 9915) uses UDP 546/547,
ff02::1:2and DUIDs: Solicit, Advertise, Request, Reply (or Information-request and Reply). It gives no default route and no prefix length. Those come from RAs. - Next lesson (L1.07): put it all together in your first dual-stack network.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.