IPv6 Address Assignment: SLAAC vs Stateful and Stateless DHCPv6 - 夜莺博客

IPv6 Address Assignment: SLAAC vs Stateful and Stateless DHCPv6

IPv6 hosts can get their addresses three ways: SLAAC (they build an address from a router-advertised prefix), stateful DHCPv6 (a server assigns and tracks each address) and stateless DHCP (SLAAC for the address, DHCPv6 only for extra options like DNS). Which one your network should run depends on whether you need central control and auditing — and the answer is decided by two flags in the router advertisement. This guide compares the three models and configures each on Cisco IOS-XE.

How Hosts Decide: The RA Flags

Routers send Router Advertisements (RAs) with two key flags in the prefix option:

  • A (autonomous) — hosts may self-configure an address via SLAAC using the advertised prefix.
  • M (managed-config) — hosts must use stateful DHCPv6 to obtain their address.
  • O (other-config) — hosts keep SLAAC addresses but fetch other parameters (DNS, domain) from DHCPv6.

SLAAC: Simple, Serverless, Stateless

The host combines the RA prefix with its interface identifier (EUI-64 or a randomized privacy address), runs duplicate address detection, and is done — no server, no state, excellent scalability. DNS servers ride in the RA itself via the RDNSS option. The trade-off: zero central control, which is why 802.1X is often layered on top for security.

IOS-XE side — enable IPv6, advertise the prefix and push DNS via RDNSS:

interface GigabitEthernet2
 ipv6 address 2001:db8:22::1/64
 ipv6 nd ra dns server 2001:4860:4860::8888 200
 ipv6 nd ra dns server 2001:4860:4860::8844 200
 ipv6 nd ra dns-search-list example.com

Stateful DHCPv6: Central Control

Stateful DHCPv6 behaves like IPv4 DHCP — the server assigns addresses from a prefix pool, tracks bindings, and can do reservations and auditing. The RA must clear the A flag (no autoconfig) and set the M flag:

ipv6 dhcp pool DHCPv6-Pool
 address prefix 2001:db8:22::/64
 dns-server 2001:4860:4860::8888
 domain-name example.com
!
interface GigabitEthernet2
 ipv6 address 2001:db8:22::1/64
 ipv6 nd prefix default no-autoconfig
 ipv6 nd managed-config-flag
 ipv6 dhcp server DHCPv6-Pool

Stateless DHCPv6: Best of Both

Hosts autoconfigure their address with SLAAC but pull DNS and search lists from DHCPv6 — the O flag tells them to ask:

ipv6 dhcp pool Stateless-Pool
 dns-server 2001:4860:4860::8888
 domain-name example.com
!
interface GigabitEthernet0/0
 ipv6 nd other-config-flag
 ipv6 dhcp server Stateless-Pool

Note that in all DHCPv6 models the default router is still learned from the RA — DHCPv6 never hands out the gateway, unlike IPv4 DHCP.

Verification

show ipv6 interface GigabitEthernet2
show ipv6 dhcp interface
show ipv6 routers

Confirm the flags (ND advertised flags: M,O), the pool state and the addresses hosts actually took. For most networks SLAAC is sufficient and maximally compatible; enterprises that need tracking, reservations or per-subnet DNS policy should run stateful or stateless DHCPv6 — and many run stateful DHCPv6 and SLAAC simultaneously for redundancy.

Related Reading

DHCPv6 servers deserve the same trust discipline as IPv4 DHCP — see Cisco DHCP snooping trusted and untrusted ports — and when IPv6 segments ride on VLANs, our Linux 802.1Q sub-interface guide shows how to address them.

原文链接:https://thisbridgeistheroot.com/blog/navigating-ipv6-address-configuration-slaac-stateful-dhcpv6-and-stateless-dhcp