Wiki DE Start in the browser

Wiki › Protocols

Neighbor Discovery (NDP) and SLAAC

How IPv6 devices find neighbours and routers without ARP and without broadcast: the five NDP messages, solicited-node multicast, duplicate address detection and SLAAC.

Layer
3 (Vermittlung)
Standard
RFC 4861, RFC 4862, RFC 4291 …
See an example
2 demos

What for

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

TypeMessageFrom → toPurpose
133Router Solicitation (RS)device → ff02::2 (all routers)“Is there a router here?”
134Router Advertisement (RA)router → ff02::1 (all nodes)prefix, gateway, flags M and O, hop limit, MTU
135Neighbor Solicitation (NS)device → solicited-node address“Who has this address? Tell me your MAC.”
136Neighbor Advertisement (NA)neighbour → asker“That's me, here is my MAC.”
137Redirectrouter → device“There is a better neighbour for this destination.”

The formats are in RFC 4861, Section 4.

Solicited-node multicast instead of broadcast

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:

  1. Form the link-local address: fe80::/64 plus its own interface ID.
  2. 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.
  3. Send an RS to ff02::2, so as not to wait for the next periodic RA.
  4. Receive the RA: prefix (e.g. 2001:db8:acad:10::/64) with flag A (autonomous) and the router's link-local address as gateway.
  5. 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?

MethodHowToday
EUI-64from the MAC: ff:fe in the middle, flip the 7th bitno longer recommended (RFC 8064): reveals the hardware, device recognisable everywhere
stable, randoma fixed, non-derivable ID per network (RFC 7217)standard for the fixed address
temporarychanges 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.
  • Routing: connected prefixes, static routes (Routing tab → IPv6 routes) or Automatic routing.
  • 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]/.

Dynamic routing for IPv6: OSPFv3 (IPv6) and RIPng (IPv6).

Simplified: no MLD, no extension headers, no privacy addresses, no NAT for IPv6.

See an example

  • Demo “IPv6: SLAAC, DHCPv6 and Neighbor Discovery” in leyoNETDemo “IPv6: SLAAC, DHCPv6 and Neighbor Discovery” in leyoNET
    IPv6: SLAAC, DHCPv6 and Neighbor Discovery

    A router with two IPv6 networks. On the left the PCs form their own address (SLAAC), on the right the notebook gets one by DHCPv6.

    Router advertisements, duplicate address detection, then a ping with neighbour solicitation instead of ARP. Filter «ndp» shows Neighbor Discovery.

    Watch live Project file

  • Demo “Web, mail and SSH over IPv6” in leyoNETDemo “Web, mail and SSH over IPv6” in leyoNET
    Web, mail and SSH over IPv6

    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.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.

Practise

  • ★★★☆☆ IPv6 BC 4: Neighbor Discovery and SLAAC · 8 goals · Worksheet (German)
  • ★★★☆☆ Set up IPv6 · 2 goals · Worksheet (German)
  • ★★★★☆ IPv6 BC 6: Lab «My first IPv6 network» · 6 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

Standards

  • RFC 4861 – Neighbor Discovery for IP version 6 (IPv6)
  • RFC 4862 – IPv6 Stateless Address Autoconfiguration
  • RFC 4291 – IP Version 6 Addressing Architecture
  • RFC 4443 – Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification
  • RFC 8064 – Recommendation on Stable IPv6 Interface Identifiers
  • RFC 7217 – A Method for Generating Semantically Opaque Interface Identifiers with IPv6 Stateless Address Autoconfiguration (SLAAC)
  • RFC 8981 – Temporary Address Extensions for Stateless Address Autoconfiguration in IPv6
  • RFC 6105 – IPv6 Router Advertisement Guard

Read on

Found a mistake or have an idea? Source of this page on GitHub.