DHCPv6: Stateful vs. Stateless Configuration in IPv6
Stateless DHCPv6 provides only extra information (like DNS) while clients use SLAAC for IP addressing. Stateful DHCPv6 operates like IPv4 DHCP, assigning IP addresses and tracking client leases.
The Role of DHCP in IPv6
While SLAAC is great for basic addressing, it cannot provide extra configuration like DNS server addresses or domain names. This is where **DHCPv6** comes in. In IPv6, the local router dictates how clients should get their addresses using flags within the Router Advertisement (RA) message.
Stateless DHCPv6
In **Stateless DHCPv6**, the client uses SLAAC to generate its own IPv6 address and default gateway. However, it contacts a DHCPv6 server to get *additional* information, such as DNS server IP addresses.
This is controlled by the **Other Configuration flag (O-flag)** in the RA. When O=1 and M=0, the router tells the client: "Create your own IP using my prefix, but ask the DHCPv6 server for other info."
Stateful DHCPv6
**Stateful DHCPv6** works very much like traditional DHCPv4. The client does not use SLAAC to generate its own IP. Instead, it contacts the DHCPv6 server to receive a globally unique IPv6 address, and the server maintains a "state" (a lease database) of all assigned addresses.
This is controlled by the **Managed Address Configuration flag (M-flag)** in the RA. When M=1, the router tells the client: "Get your entire IPv6 configuration, including your IP address, from the DHCPv6 server."
❓ Frequently Asked Questions
What does the O-flag do in an IPv6 Router Advertisement?
The O-flag (Other Configuration) tells the client to use Stateless DHCPv6 to obtain additional information like DNS server addresses.
How is Stateful DHCPv6 different from Stateless DHCPv6?
Stateful DHCPv6 hands out IP addresses and tracks leases. Stateless DHCPv6 only provides extra options (like DNS) while the client relies on SLAAC for its IP address.
Which flag triggers Stateful DHCPv6?
The M-flag (Managed Address Configuration) set to 1 in the RA triggers Stateful DHCPv6.