DHCPv6 vs SLAAC: Key Technical Differences and When to Use Each in IPv6 Networking


2 views

While SLAAC (Stateless Address Autoconfiguration) provides elegant automatic configuration through router advertisements, DHCPv6 offers centralized management crucial for enterprise environments. Consider this basic SLAAC example where devices self-configure:

// Typical SLAAC process in C (conceptual)
#include 

void handle_router_advertisement(struct nd_router_advert *ra) {
    if (ra->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED) {
        // Triggers DHCPv6 when M flag set
        initiate_dhcpv6_client(); 
    } else {
        // Standard SLAAC behavior
        generate_eui64_address();
    }
}

Three critical scenarios demand DHCPv6:

# Python DHCPv6 client example (using scapy)
from scapy.layers.dhcp6 import *

def request_dhcpv6_options():
    conf.checkIPaddr = False
    dhcp_solicit = DHCP6_Solicit()
    dhcp_advertise = sr1(dhcp_solicit)
    
    if DHCP6_IA_NA in dhcp_advertise:
        print(f"Received IA_NA: {dhcp_advertise[DHCP6_IA_NA].iaid}")

SLAAC alone cannot provide:

  • DNS server addresses (requires RDNSS extension)
  • NTP server configuration
  • Custom domain search lists

Here's how DHCPv6 handles DNS assignment:

// DHCPv6 option structure for DNS (RFC 3646)
struct dhcpv6_dns_option {
    uint16_t option_code = 23; // DNS_SERVERS
    uint16_t option_len;
    struct in6_addr dns_servers[];
};

DHCPv6 enables:

# ISC DHCPv6 server configuration snippet
subnet6 2001:db8:cafe::/64 {
    range6 2001:db8:cafe::1000 2001:db8:cafe::2000;
    option dhcp6.name-servers 2001:db8::53;
    allow unknown-clients;
}

Hybrid deployments using SLAAC for addressing plus DHCPv6 for options (stateless DHCPv6):

// Router Advertisement configuration
interface GigabitEthernet0/0
 ipv6 nd other-config-flag
 ipv6 nd prefix 2001:db8:1::/64

Key commands for troubleshooting:

# Linux DHCPv6 client debugging
dhclient -6 -d -v eth0

# Windows SLAAC verification
netsh interface ipv6 show addresses

While both Stateless Address Autoconfiguration (SLAAC) and DHCPv6 provide IPv6 address assignment, their operational paradigms differ significantly. SLAAC (RFC 4862) enables hosts to self-configure addresses using router advertisements, whereas DHCPv6 (RFC 3315) offers centralized address management with additional configuration options.

# Example SLAAC address generation (Linux)
$ ip -6 addr show eth0
3: eth0:  mtu 1500 
   inet6 2001:db8::a00:27ff:fe14:1098/64 scope global dynamic 
      valid_lft 2592000sec preferred_lft 604800sec
   inet6 fe80::a00:27ff:fe14:1098/64 scope link 

Large networks often require features that SLAAC cannot provide:

  • Centralized IP address management and tracking
  • DNS server assignment (RFC 3646)
  • Custom domain name assignment
  • NTP server configuration
  • Precise lease time control
# Sample DHCPv6 server configuration (ISC DHCP)
subnet6 2001:db8:0:1::/64 {
    range6 2001:db8:0:1::100 2001:db8:0:1::200;
    option dhcp6.name-servers 2001:db8::53;
    option dhcp6.domain-search "example.com";
}

Case 1: A university campus with 50,000 devices uses DHCPv6 for:

  • Device identification in security logs
  • Consistent DNS resolution
  • Network policy enforcement

Case 2: An IoT manufacturer uses SLAAC for:

  • Simplified device deployment
  • No server infrastructure requirement
  • Reduced configuration complexity

Many networks implement both mechanisms using flags in Router Advertisements:

# Router Advertisement flags (RFC 4861)
M flag (Managed): 1 = Use DHCPv6 for addresses
O flag (Other): 1 = Use DHCPv6 for other config

# Common combinations:
# M=0, O=0: SLAAC only
# M=0, O=1: SLAAC + DHCPv6 for options
# M=1, O=1: DHCPv6 for everything

For network administrators:

# Check RA messages
$ rdisc6 eth0

# Test DHCPv6 operation
$ dhcpcd -6 -n eth0

# View DHCPv6 leases (Linux)
$ cat /var/lib/dhcp/dhclient6.leases