IP Addresses & Routing

SLAAC and DHCPv6: How Devices Get IPv6 Addresses

Follow how IPv6 hosts configure themselves from router advertisements and DHCPv6, what the flags mean and how to troubleshoot failures.

Key takeaways

  • Router advertisements tell hosts which prefixes are on the link and which router to use.
  • With SLAAC a host creates its own address and checks for duplicates, with no server keeping records.
  • Flags in the advertisement tell hosts whether to use SLAAC, DHCPv6 or both.
  • DNS servers can arrive through router advertisements or DHCPv6, and not every platform supports every method.
  • Providers commonly use DHCPv6 prefix delegation to give your router a block to divide among its networks.

IPv6 devices usually get their addresses in one of two ways. With SLAAC (stateless address autoconfiguration), a router announces a prefix and each device builds its own address from it. With DHCPv6, a server hands out addresses or extra settings. Many networks use SLAAC alone, some combine the two, and in all cases the router's announcements are what tell devices where the default gateway is.

If you come from IPv4, that last point is the big change: DHCPv6 does not supply a gateway. This article walks through both methods and how they fit together.

When an interface comes up, it first creates a link-local address beginning fe80::. Before using it, the device performs duplicate address detection: it sends a message asking whether anyone already holds that address and waits briefly for an objection.

With that address in place, the device can talk to neighbors and routers. IPv6 address types explains why it stays alongside any others.

Router advertisements

Routers send router advertisements (RAs) periodically, and also when a new host asks with a router solicitation. Both are ICMPv6 messages defined as part of Neighbor Discovery.

An advertisement can carry:

  • one or more prefixes, each with lifetimes and flags,
  • a router lifetime, saying how long to use this router as a default gateway,
  • two configuration flags, called M and O,
  • the link's MTU,
  • a default hop limit, and
  • DNS server addresses and search domains, as options defined in RFC 8106.
A host configures itself with SLAAC
Host Router Other devices Duplicate check for my fe80 address 1 Router solicitation 2 Advertisement: prefix 2001:db8:1:20::/64 3 Includes router lifetime, flags and possibly DNS. Duplicate check for my new global address 4 Host Router Other devices Duplicate check for my fe80 address 1 Router solicitation 2 Advertisem ent: prefix 2001:db8:1: 20::/64 3 Includes router lifetime, flags and possibly DNS. Duplicate check for my new global address 4

How SLAAC builds an address

If a prefix is marked for autonomous configuration (the A flag) and is a /64, the host combines it with a 64-bit interface identifier:

Prefix from router:    2001:db8:1:20::/64
Interface identifier:  a3f1:9cc:4e7b:9d10
Resulting address:     2001:db8:1:20:a3f1:9cc:4e7b:9d10

The identifier can be random and stable per network (RFC 7217), derived from the hardware address on older systems, or temporary. Most current devices also create temporary addresses (RFC 8981) that rotate over time and are used for outgoing connections.

Then comes duplicate detection again. Collisions are extremely unlikely with random identifiers, but the check is cheap.

The router doesn't know or record which addresses were created. That is what "stateless" means: there is no lease table. If you need to know which device used an address, you have to collect it from neighbor tables or another source.

Lifetimes and renumbering

Each advertised prefix has two timers:

Timer While it runs After it expires
Preferred lifetime The address is used for new connections The address becomes deprecated
Valid lifetime The address works at all The address is removed

Fresh advertisements reset the timers. To move a network to a new prefix, a router can advertise the new one while setting the old one's preferred lifetime to zero, so existing connections finish and new ones switch over.

In real life, a provider may change your prefix abruptly, for example after your router reboots. If the router never withdraws the old prefix, devices may keep stale addresses and connections misbehave until the lifetimes run out. Reconnecting the device usually clears it.

DHCPv6: stateful and stateless

DHCPv6, specified in RFC 8415, uses UDP, with clients on port 546 and servers or relays on port 547. Clients send to the multicast address ff02::1:2.

Stateful DHCPv6 assigns addresses and tracks them. The usual exchange is Solicit, Advertise, Request, Reply.

Stateless DHCPv6 leaves addressing to SLAAC and only supplies other settings, such as DNS servers or time servers, through a shorter Information-request and Reply.

Clients are identified by a DUID (DHCP unique identifier) rather than simply by MAC address. That affects reservations: you register the DUID and an identifier for the interface, and reinstalling an operating system may generate a new one.

The flags that steer hosts

Common combinations of router advertisement settings
SLAAC only A set, M and O clear. Address from prefix, DNS from the advertisement. SLAAC plus options A and O set. Own address, extra settings from DHCPv6. Managed addresses M set, A clear. Addresses come from DHCPv6. Both at once A and M set. Hosts may hold SLAAC and DHCPv6 addresses. SLAAC only A set, M and O clear. Address from prefix, DNS from the advertisement. SLAAC plus options A and O set. Own address, extra settings from DHCPv6. Managed addresses M set, A clear. Addresses come from DHCPv6. Both at once A and M set. Hosts may hold SLAAC and DHCPv6 addresses.
  • A (per prefix): you may form your own address from this prefix.
  • M (managed): addresses are available through DHCPv6.
  • O (other): other configuration is available through DHCPv6.

These are signals, and operating systems differ in how strictly they follow them. Notably, some platforms, Android among them, have not supported getting addresses through stateful DHCPv6. If your network has varied devices, a design that works with SLAAC is the safer choice. Support for DNS options in advertisements has also varied on older systems, so some administrators send DNS both ways.

Which should you use?

Need Reasonable choice
Home or small office SLAAC with DNS in the advertisement
Mixed devices needing extra options SLAAC plus stateless DHCPv6
Central record of assigned addresses Stateful DHCPv6, after checking client support
Fixed server addresses Manual configuration, or a DHCPv6 reservation

Even with DHCPv6, router advertisements remain necessary for the default route.

Prefix delegation: how your router gets a block

Between your router and your provider, DHCPv6 often does a different job. With prefix delegation, your router requests a prefix, and the provider replies with something like a /56 or /60. Your router then advertises a separate /64 on each of its internal networks.

If your provider delegates only a /64, you can serve one network properly. A guest network or second router may then get no global IPv6. Check your router's status page to see what size you received; providers differ and some let the router request a larger one. See IPv6 subnetting.

Checking what your device received

Linux:

ip -6 addr
ip -6 route

A default route learned from advertisements typically shows proto ra. DNS settings depend on the resolver software; resolvectl status works on systems using systemd-resolved.

Windows:

ipconfig /all
netsh interface ipv6 show addresses
netsh interface ipv6 show route

macOS:

ifconfig en0
netstat -rn -f inet6
scutil --dns

Troubleshooting

Only a link-local address. No advertisement arrived, or no prefix allowed SLAAC. Check that the router has IPv6 enabled and, upstream, that it received a prefix.

Global address but nothing loads. Look for a default route and test an external address with ping. If small pings work but pages stall, suspect packet size problems and filtered ICMPv6, covered in MTU and fragmentation.

A strange prefix appears. Another device may be sending advertisements: a second router plugged in the wrong way, a virtual machine or a computer sharing its connection. Hosts accept advertisements readily, so this can divert traffic. Managed switches and access points can block advertisements from ports where no router belongs, a feature commonly called RA Guard (RFC 6105).

DNS fails but pings work. The device got an address but no usable resolver. Check which method your router uses to hand out DNS.

DHCPv6 gets no reply. Confirm that the server is on the same link or that a relay forwards requests, and that firewalls allow UDP ports 546 and 547.

Tracking who has which address

IPv4 administrators often rely on the DHCP lease table to answer "which device was this?" With SLAAC there is no such table, and temporary addresses change regularly. If you need that history on a network you manage, the usual options are:

  • collecting the router's neighbor table at intervals and storing it with timestamps,
  • using switch or wireless controller features that record address bindings,
  • requiring network authentication, so that sessions are tied to accounts, or
  • using stateful DHCPv6 where every client supports it.

Each involves personal information, so keep it only as long as you need it, restrict who can read it and follow the rules that apply to your organization. Don't switch off temporary addresses on people's devices just to make logging easier without weighing the privacy cost.

A design example

Say you run a network with staff laptops, phones of many kinds and a few servers. A practical design advertises a /64 on the client network with the A flag set, includes DNS servers in the advertisement, and also offers stateless DHCPv6 for clients that expect it, with the O flag set. Every device gets an address and a resolver, whatever it supports.

The servers sit on their own /64 and have hand-assigned addresses ending in short values, with their names published as AAAA records. Switch ports facing users reject router advertisements. Before turning it on, the administrator writes firewall rules for IPv6 that match the intent of the IPv4 ones, then tests from each type of device.

Change one thing at a time. Hosts remember advertised prefixes until their lifetimes run out, so a mistaken advertisement can linger after you fix the router. Short lifetimes during testing make mistakes expire sooner; restore normal values once the design works.

Common questions

Can I turn off SLAAC and control everything with DHCPv6?

You can clear the A flag and set M, but devices without DHCPv6 address support will get no global address. Test your device mix first.

Is the IPv4 DHCP server involved at all?

No. DHCP for IPv4 and DHCPv6 are separate protocols with separate settings. A dual-stack network runs both independently; the IPv4 exchange has its own article.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in IP Addresses & Routing →

Latest news on this topic