How IPv6 devices find neighbours and routers without ARP and without broadcast: the five NDP messages, solicited-node multicast, duplicate address detection and SLAAC.
In IPv4, ARP answers the question “which MAC belongs to this IP?”, and a DHCP server hands out addresses. IPv6 solves both with Neighbor Discovery (NDP, RFC 4861): five ICMPv6 messages, all with hop limit 255. A receiver drops NDP packets with any other value; so nobody can inject them across a router (RFC 4861, Sections 6.1 and 7.1).
The five messages
Type
Message
From → to
Purpose
133
Router Solicitation (RS)
device → ff02::2 (all routers)
“Is there a router here?”
134
Router Advertisement (RA)
router → ff02::1 (all nodes)
prefix, gateway, flags M and O, hop limit, MTU
135
Neighbor Solicitation (NS)
device → solicited-node address
“Who has this address? Tell me your MAC.”
136
Neighbor Advertisement (NA)
neighbour → asker
“That's me, here is my MAC.”
137
Redirect
router → device
“There is a better neighbour for this destination.”
An NS does not go to everyone but to a solicited-node address: ff02::1:ff plus the last 24 bits of the address being looked for (RFC 4291, Section 2.7.1).
looked for: 2001:db8:acad:10::5a
last 24 bits: 00:005a
solicited-node: ff02::1:ff00:5a
Every device joins the groups of its own addresses. The network card filters out all other groups without disturbing the CPU. Only the device that matches (almost always exactly one) gets the question. That is the big advantage over ARP's broadcast.
Neighbor cache
The replies end up in the neighbor cache, the counterpart of the ARP cache. An entry has a state: INCOMPLETE (question running), REACHABLE (recently confirmed), STALE (old, checked with the next packet), DELAY and PROBE. This way a device also notices when a neighbour disappears (neighbor unreachability detection, RFC 4861, Section 7.3).
SLAAC: an address without a server
Stateless address autoconfiguration (RFC 4862) runs in five steps:
Form the link-local address: fe80::/64 plus its own interface ID.
DAD: check with an NS to its own address (sender ::) whether someone already has it (duplicate address detection, RFC 4862, Section 5.4). If no reply comes, the address is valid.
Send an RS to ff02::2, so as not to wait for the next periodic RA.
Receive the RA: prefix (e.g. 2001:db8:acad:10::/64) with flag A (autonomous) and the router's link-local address as gateway.
Form the global address (prefix plus interface ID), DAD again, done (RFC 4862, Section 5.5).
The flags in the RA control what comes next: M (managed) means “addresses via DHCPv6”, O (other) means “address via SLAAC, but DNS and more via DHCPv6”. See DHCPv6.
Where does the interface ID come from?
Method
How
Today
EUI-64
from the MAC: ff:fe in the middle, flip the 7th bit
no longer recommended (RFC 8064): reveals the hardware, device recognisable everywhere
changes regularly, for outgoing connections (RFC 8981)
in addition, protects privacy
leyoNET forms the interface ID like EUI-64 from the MAC, so that its origin can be traced.
Security
NDP trusts everyone in the LAN. An attacker can send false RAs and pretend to be a router. RA guard on the switch helps against this (RFC 6105): router advertisements only on ports towards the real router. That is the same principle as DHCP snooping for IPv4 (Switch security: port security and DHCP snooping). That is also why ICMPv6 must not be blocked across the board, otherwise IPv6 does not work at all (RFC 4443).
In leyoNET
Create a project in IPv6, give the router an address such as 2001:db8:acad:10::1/64, set the devices to “automatic”. Start the simulation and filter the packet list for icmpv6: DAD, RS, RA, then NS and NA with the first ping.
On the right, Neighbours (Neighbor Discovery) shows the neighbor cache, and each address shows its origin (link-local, SLAAC, DHCPv6, static).
Exercise “IPv6 BC 4: Neighbor Discovery and SLAAC” and the IPv6 basics course with video.
How to do it in leyoNET
The same text as in the app’s help (F1 key).
IPv6
IPv6 addresses are 128 bits long and written as eight blocks of four hex digits, e.g. 2001:db8:1::10/64. Leading zeros are dropped, one run of zero blocks becomes :: (RFC 5952). 2001:db8::/32 is reserved for examples, private networks use fd00::/8.
IP version of the project (at the top of the toolbar): IPv4 (as before), v4 + v6 (dual stack, both at once) or IPv6 (IPv4 switched off).
Link-local: every IPv6 interface automatically has an address fe80::… formed from the MAC (EUI-64). It is only valid on its own link.
Neighbor Discovery instead of ARP: to find the MAC for an address, a device sends a Neighbor Solicitation to a multicast group; the owner answers with a Neighbor Advertisement. Before using an address, every device checks that it is free (DAD). netsh interface ipv6 show neighbors lists the neighbours.
SLAAC: routers send router advertisements with their prefix (/64). End devices set to “IPv6 automatic” form their own address from it and take the router as default gateway.
DHCPv6: if “Hand out addresses by DHCPv6” is set on the router port, the router advertisement carries the M flag and end devices get their address by Solicit – Advertise – Request – Reply.
Layer 3 switch: every VLAN interface (SVI) gets an IPv6 address and announces its prefix in the VLAN (also over trunks). The switch routes between the VLANs; with “no ip routing” it does not.
Ping and tracert work with IPv6 addresses, ipconfig shows all addresses.
DNS over IPv6: a DNS server can be set on the router port. It is carried in the router advertisement (RDNSS option, RFC 8106) and in the DHCPv6 reply; end devices with a fixed address enter it themselves. AAAA records return IPv6 addresses.
Applications: ping, tracert, browser, e-mail and SSH work over IPv6, by address or by name. In dual stack, a device with a global IPv6 address uses the AAAA record first, otherwise the A record. In URLs an IPv6 address goes in square brackets: http://[2001:db8:1::80]/.
A pure IPv6 network: the PC gets its address and DNS server from the router (SLAAC and RDNSS), the school DNS has AAAA records, the web and mail server sits in the second network.
PC 1 resolves www.schule.example via AAAA, loads the page over TCP and IPv6 and sends a mail by SMTP. The filter “ipv6 and tcp” shows the application traffic.