SkillPilotAI

IPv6: SLAAC, NDP and dual stack

IPv6 hosts can configure themselves: SLAAC builds an address from the router's advertised /64, NDP replaces ARP for finding neighbours, and dual stack lets IPv4 and IPv6 run side by side. NAT64 bridges IPv6-only clients to IPv4-only servers.

13.1 Why is it used?

  • A laptop joins a new office network with no DHCP server and still needs a global address and a gateway.
  • SLAAC lets the host build its own address from the prefix the router announces; no server keeps state.
  • IPv4 ARP broadcasts to everyone; IPv6 NDP sends only to the target's multicast group, so other CPUs are not disturbed.
  • The internet is mixed: dual stack and NAT64 keep IPv4-only and IPv6-only systems reachable.

13.2 How SLAAC works

SLAAC: from link-local to a global address
  1. 1.Laptop creates its link-local fe80::21a:2bff:fe3c:4d5e

  2. 2.Sends Router Solicitation (RS) to ff02::2 (all routers)

  3. 3.Router replies with Router Advertisement (RA): prefix 2001:db8:33::/64 + autonomous flag

  4. 4.Laptop appends its 64-bit interface ID: 2001:db8:33:0:21a:2bff:fe3c:4d5e

  5. 5.DAD: Neighbor Solicitation 'whose address?'; no reply, so the address becomes active

  6. 6.Router's link-local address becomes the default gateway

SLAAC = Stateless Address Autoconfiguration

  • Stateless: no server records which device got which address; the router only announces the prefix.
  • M flag on in the RA: take the address from a DHCPv6 server (stateful).
  • O flag on: only other settings like DNS come from DHCPv6.
  • The RA can also carry the DNS server itself (RDNSS).

13.3 EUI-64: interface ID from the MAC

  • A MAC is 48 bits: split it into two halves and insert ff:fe in the middle to make 64 bits.
  • Flip the 7th bit of the first byte (universal/local bit): 00 becomes 02.
  • Both the link-local and the global address end with this ID; the lab gave exactly this value.
Output
MAC      00:1a:2b:3c:4d:5e1 split  00:1a:2b | 3c:4d:5e2 add    00:1a:2b:ff:fe:3c:4d:5e3 flip   00 = 0000 0000         02 = 0000 0010ID       021a:2bff:fe3c:4d5elink     fe80::21a:2bff:fe3c:4d5eglobal   2001:db8:33:0:21a:2bff:fe3c:4d5e

13.4 EUI-64 vs privacy address

PointEUI-64Privacy (temporary) address
Interface IDFrom the MACRandom
Changes?Never: same on every networkChanges after some time
PrivacyWebsites can track youMAC not exposed
Used byOld/classic defaultWindows, macOS, Android, iOS by default; Linux via a setting

13.5 NDP vs ARP

  • IPv4 ARP: request is a broadcast; the switch floods it and the phone and printer must process a frame not meant for them.
  • IPv6 NDP (Neighbor Discovery Protocol) runs on ICMPv6.
  • Neighbor Solicitation goes to the solicited-node multicast address built from the last 24 bits of the target (ff02::1:ff00:1 for ::1).
  • Only the target's NIC listens to that group; the router replies with its MAC in a Neighbor Advertisement.
  • The laptop stores it in the neighbor cache, the IPv6 version of the ARP table.
Finding the router's MAC with NDP
  1. 1.Laptop needs the MAC of 2001:db8:33::1

  2. 2.Sends NS to solicited-node multicast ff02::1:ff00:1

  3. 3.Phone and printer NICs ignore it (CPU not woken)

  4. 4.Router replies with NA: its MAC 00:1a:2b:00:00:01

  5. 5.Laptop saves it in the neighbor cache: REACHABLE

MessageICMPv6 typePurpose
Router Solicitation (RS)133Host: who is the router?
Router Advertisement (RA)134Router: prefix, gateway, flags
Neighbor Solicitation (NS)135Whose MAC? + DAD check
Neighbor Advertisement (NA)136This is my MAC
Redirect137Hint for a better gateway

13.6 Dual stack, NAT64 and 6to4

  • Dual stack: one interface holds both IPv4 and IPv6 addresses (e.g. 192.168.33.10 + 2001:db8:33::...).
  • The laptop asks DNS for A and AAAA; a dual-stack server is usually reached over IPv6, an IPv4-only server over IPv4.
  • Happy Eyeballs: fast fallback between IPv6 and IPv4 so the user never waits.
  • NAT64: an IPv6-only phone sends to the NAT64 gateway (64:ff9b::/96), which translates to IPv4 for the IPv4-only server.
  • DNS64 gives the phone a synthetic IPv6 address with the server's IPv4 embedded: 64:ff9b::203.0.113.10.
  • 6to4: old technique tunnelling IPv6 inside IPv4; deprecated now.

13.7 Practical: SLAAC built the address

  • Docker LAN: a router container runs radvd; nobody set an IPv6 address on the laptop by hand.
  • Three addresses: fe80 link-local, EUI-64 global from MAC 00:1a:2b:3c:4d:5e, and a temporary (privacy) address with a random ID.
Terminal
ip link show eth0ip -6 addr show eth0ip -6 routerdisc6 eth0ip -6 neigh flush dev eth0ping -c 1 2001:db8:33::1ip -6 neighip -4 addr show eth0ping -4 -c 2 192.168.33.2ping -6 -c 2 2001:db8:33::1
Output
$ ip link show eth02: eth0@if335: <BROADCAST,MULTICAST,UP,LOWER_UP>    link/ether 00:1a:2b:3c:4d:5e$ ip -6 addr show eth0inet6 2001:db8:33:0:ef6c:627:f6f9:75e0/64    scope global temporary dynamicinet6 2001:db8:33:0:21a:2bff:fe3c:4d5e/64    scope global dynamic mngtmpaddrinet6 fe80::21a:2bff:fe3c:4d5e/64    scope link proto kernel_ll

13.8 Practical: reading the RA with rdisc6

  • Default route points to the router's link-local address; proto ra = learned from a Router Advertisement.
  • rdisc6 sends its own RS and decodes the RA: prefix /64, Autonomous = Yes (SLAAC on), Stateful = No (no DHCPv6).
  • Even the DNS server (2001:4860:4860::8888) arrived inside the RA.
Output
$ ip -6 route2001:db8:33::/64 dev eth0 proto kernelfe80::/64 dev eth0 proto kerneldefault via fe80::21a:2bff:fe00:1 dev eth0    proto ra metric 1024 expires 166sec$ rdisc6 eth0Soliciting ff02::2 (ff02::2) on eth0...Stateful address conf.    :           NoRouter lifetime           :          180 Prefix                   : 2001:db8:33::/64  Autonomous address conf.:          Yes Recursive DNS server     : 2001:4860:4860::8888 from fe80::21a:2bff:fe00:1

13.9 Practical: NS, NA and the neighbor cache

  • Neighbor cache flushed, then the router pinged while tcpdump ran.
  • Capture: NS to ff02::1:ff00:1, then the router's NA; ip -6 neigh now shows the router MAC as REACHABLE.
Output
$ ping -c 1 2001:db8:33::164 bytes from 2001:db8:33::1: icmp_seq=1--- tcpdump:IP6 2001:db8:33:0:ef6c:627:f6f9:75e0 >  ff02::1:ff00:1: ICMP6, neighbor solicitation,  who has 2001:db8:33::1IP6 2001:db8:33::1 >  2001:db8:33:0:ef6c:627:f6f9:75e0: ICMP6,  neighbor advertisement, tgt is 2001:db8:33::1$ ip -6 neigh2001:db8:33::1 dev eth0  lladdr 00:1a:2b:00:00:01 router REACHABLE

13.10 Practical: dual stack

  • The same eth0 also holds 192.168.33.10/24; the router answers over IPv4 (-4) and over IPv6 (-6) on the same wire.
Output
$ ip -4 addr show eth0    inet 192.168.33.10/24 brd 192.168.33.255$ ping -4 -c 2 192.168.33.264 bytes from 192.168.33.2: time=0.384 ms64 bytes from 192.168.33.2: time=0.203 ms2 packets transmitted, 2 received, 0% loss$ ping -6 -c 2 2001:db8:33::164 bytes from 2001:db8:33::1: time=0.093 ms64 bytes from 2001:db8:33::1: time=0.114 ms2 packets transmitted, 2 received, 0% loss

13.11 Common mistakes

  • Blocking all ICMPv6 on a firewall: no RS/RA means no SLAAC and no NS/NA means no neighbour MACs, so IPv6 almost completely breaks.
  • Believing an IPv6 address always reveals your MAC: only the old EUI-64 does; modern systems use random stable IDs + temporary addresses.
  • Expecting SLAAC on a prefix that is not /64.
  • Confusing the flags: M = address from DHCPv6, O = only other info (DNS).

13.12 Interview tips

  • SLAAC: router announces the prefix in the RA, host builds its own address, no server record.
  • DHCPv6: server assigns the address and keeps a lease; RA M/O flags decide which method is used.
  • NDP replaces ARP using ICMPv6 types 133-137 and solicited-node multicast instead of broadcast.
  • EUI-64 = MAC split + ff:fe + flip the 7th bit; privacy addresses are random and rotate.
  • Dual stack + Happy Eyeballs today; NAT64/DNS64 for IPv6-only networks; 6to4 is deprecated.