IPv6 Stateless Autoconfiguration
Automatic IPv6 address configuration without DHCP servers.
The "Plug-and-Play" Vision: A New Way to Join a Network
In the world of IPv4, connecting a device to a network typically requires a central coordinator. When you connect your laptop to a Wi-Fi network, it sends out a broadcast asking, "Is there a DHCP server here? I need an IP address." The then consults its list of available addresses, assigns one to your laptop, and keeps a record of this assignment. This is a stateful process because the server must maintain the "state" (a record) of every device it has configured.
The designers of IPv6 wanted to create a more streamlined, decentralized, and truly "plug-and-play" experience. They envisioned a world where a device could connect to a network and configure itself with a globally unique IP address without needing to ask a central server for permission or an assignment.
This vision is realized through . The term "stateless" is key: it means that the router providing network information does not need to keep track of which devices have assigned themselves which addresses. It simply provides the necessary ingredients, and each device bakes its own cake.
The Engine Room of SLAAC: The Neighbor Discovery Protocol
SLAAC is not a standalone protocol; it is a core function of the Neighbor Discovery Protocol (NDP). As we learned in the NDP lesson, devices on an IPv6 network use ICMPv6 messages to learn about their local environment. Two of these messages are the foundation of SLAAC:
- Router Solicitation (RS): A message sent by a host when it first joins a network, asking, "Are there any routers here that can give me network information?"
- Router Advertisement (RA): A message sent by a router (either periodically or in response to an RS) that contains vital network parameters. For SLAAC, the most important piece of information in an RA message is the network prefix.
The RA message is the "recipe" the router provides, and the network prefix is the main ingredient. The host then combines this ingredient with a unique ingredient of its own to create a full, usable IP address.
The Complete SLAAC Process: A Step-by-Step Guide
Let's walk through the entire journey a device takes from the moment it's plugged into an IPv6 network to having a fully functional global IP address.
- Step 1: Generate a Link-Local Address.
Before it can even think about talking to the world, a device needs a temporary, local address to communicate on its immediate physical network link. It creates this itself. It always starts with the prefix
fe80::/10, and the remaining 64 bits (the Interface ID) are typically generated from the device's unique hardware MAC address. - Step 2: Verify the Link-Local Address (DAD).
To ensure its newly created link-local address isn't already in use by another device (a very rare but possible scenario), the host performs Duplicate Address Detection (DAD). It sends a Neighbor Solicitation message asking, "Is anyone using this address?" If it receives no reply, it knows the address is unique and can be used.
- Step 3: Find a Router (Router Solicitation).
Now that it can communicate locally, the host needs information about the wider network. It sends a Router Solicitation (RS) message to the "all-routers" multicast address (
ff02::2). This is the device asking, "Can a router please tell me about this network?" - Step 4: Receive Network Information (Router Advertisement).
A router on the network sees the RS and responds with a Router Advertisement (RA) message. This RA contains a wealth of information, but for SLAAC, the most important is the Network Prefix (e.g.,
2001:db8:acad:1::/64) and its lifetime. - Step 5: Create the Global Unicast Address.
The host now has the two necessary ingredients:
- The 64-bit Network Prefix from the router (
2001:db8:acad:1). - Its own 64-bit Interface Identifier (which it likely already generated for its link-local address).
It simply combines them to create a full 128-bit Global Unicast Address (GUA).
- The 64-bit Network Prefix from the router (
- Step 6: Verify the Global Address (DAD).
Just to be safe, the host performs DAD again, this time for its new global address. It sends another Neighbor Solicitation to ensure the address is truly unique on the local link. If there's no response, the host officially assigns the address to its interface.
At this point, the device is fully configured with a globally routable IPv6 address and knows its default gateway (the address of the router that sent the RA), all without a DHCP server.
In-Depth: The EUI-64 Process
One of the primary methods for a host to generate its own 64-bit Interface Identifier is the Modified EUI-64 process. This algorithm takes the device's globally unique 48-bit MAC address and expands it into a 64-bit identifier. Let's break it down.
Example: Converting a MAC Address
Let's assume our device has the MAC address 00:1B:77:54:12:34.
- Step 1: Split the MAC Address in Half.
The 48-bit (6-byte) MAC address is split into two 24-bit (3-byte) halves.
00:1B:77 and 54:12:34
- Step 2: Insert the 'FFFE' Hextet.
The 16-bit value
FFFE(in hexadecimal) is inserted directly between the two halves. This expands the address to 64 bits.00:1B:77:FF:FE:54:12:34
- Step 3: Invert the 7th Bit.
This is the "Modified" part of EUI-64. The 7th bit of the very first byte is flipped. This bit is the . Flipping it from 0 to 1 signifies that the address has been locally modified to form an Interface ID.
- The first byte is
00in hex, which is00000010in binary. Let's fix this for00:00000000. - The bits are numbered 1 through 8. We need to flip the 7th bit.
00000000 - Flipping the 7th bit from 0 to 1 gives us:
00000010. - In hexadecimal,
00000010is02.
- The first byte is
- Step 4: The Final Interface ID.
We now have the final 64-bit Interface Identifier.
021B:77FF:FE54:1234
If our network prefix was
2001:db8:acad:1::/64, the full global address would be:2001:db8:acad:1:21b:77ff:fe54:1234
But What About DNS? The Role of DHCPv6
SLAAC is brilliant for assigning an IP address and default gateway. However, it doesn't provide all necessary configuration parameters. Most notably, a basic Router Advertisement does not contain the addresses of DNS servers. A device without a DNS server address cannot browse the web using domain names.
This is where DHCP for IPv6 (DHCPv6) comes back into the picture. The interaction between SLAAC and DHCPv6 is controlled by three flags in the Router Advertisement message sent by the router.
- A Flag (Autonomous Address-Configuration Flag): If set to 1, it tells the host it should use SLAAC to create its own address.
- M Flag (Managed Address Configuration Flag): If set to 1, it tells the host it must contact a DHCPv6 server for its IP address. This is called "stateful DHCPv6," and it works just like DHCP in IPv4.
- O Flag (Other Configuration Flag): If set to 1, it tells the host it should contact a DHCPv6 server for additional information, like DNS server addresses, after it has already configured its own IP using SLAAC. This is called "stateless DHCPv6."
| A Flag | M Flag | O Flag | Resulting Host Action |
|---|---|---|---|
| 1 | 0 | 0 | SLAAC only. The host gets its IP and gateway from the RA. It must find DNS servers via another method (e.g., manual configuration or another protocol). |
| 1 | 0 | 1 | SLAAC + Stateless DHCPv6. This is a very common configuration. The host uses SLAAC for its IP address, but also queries a DHCPv6 server just to get the DNS server addresses. |
| 0 | 1 | 1 | Stateful DHCPv6 only. The host ignores SLAAC and contacts a DHCPv6 server for its IP address, gateway, DNS, and all other parameters, just like in IPv4. |
A Note on Privacy: EUI-64 and Privacy Extensions
The EUI-64 method, while clever, has one significant drawback: because the Interface ID is based on the device's permanent, globally unique MAC address, it never changes. This means that as you move your laptop from network to network (e.g., from home, to a coffee shop, to an airport), your device can be tracked across the internet by its constant Interface ID.
To address this major privacy concern, IPv6 Privacy Extensions (RFC 4941) were developed. Modern operating systems (like Windows, macOS, Android, and iOS) use this feature by default.
Instead of using the static EUI-64 identifier, a device will generate a temporary, randomized 64-bit Interface Identifier for its global address. This address is used for all outgoing connections (like browsing the web). Crucially, this temporary address is changed periodically (e.g., every day). This makes it virtually impossible to track a specific user's device across different networks based on their IPv6 address, significantly enhancing user privacy. The device still maintains its stable, EUI-64-based address for receiving specific incoming connections if needed.