ICMPv6 and Neighbor Discovery basics
Classify ICMPv6 messages as error or informational by type number, and name the common types. Derive the solicited-node multicast address and Ethernet multicast MAC address for any IPv6 address. Explain how Neighbor Solicitation and Neighbor Advertisement replace ARP. Describe the Router Solicitation and Router Advertisement exchange and the Hop Limit 255 check.
Take the quiz · pass mark 70% · 9 questions
Explanation
ICMPv6: more than ping
In IPv4, ICMP was mostly about errors and ping, and many networks blocked it. ICMPv6 (RFC 4443) is a core part of IPv6. It carries:
- Error messages such as Destination Unreachable and Packet Too Big
- Informational messages such as Echo (ping)
- Neighbor Discovery (RFC 4861): address resolution, router discovery and duplicate address detection
- Multicast Listener Discovery (MLD): telling routers and switches which multicast groups a host wants
ICMPv6 is IPv6 Next Header 58. The type number tells you the class: 0–127 are errors and 128–255 are informational.
| Type | Message | Class |
|---|---|---|
| 1 | Destination Unreachable | Error |
| 2 | Packet Too Big | Error |
| 3 | Time Exceeded | Error |
| 4 | Parameter Problem | Error |
| 128 | Echo Request | Informational |
| 129 | Echo Reply | Informational |
| 133 | Router Solicitation (RS) | Informational (ND) |
| 134 | Router Advertisement (RA) | Informational (ND) |
| 135 | Neighbor Solicitation (NS) | Informational (ND) |
| 136 | Neighbor Advertisement (NA) | Informational (ND) |
| 137 | Redirect | Informational (ND) |
If you block ICMPv6 wholesale, address resolution, autoconfiguration and Path MTU Discovery all break. RFC 4890 gives filtering recommendations. You will use them in Level 5.
Solicited-node multicast: how IPv6 avoids broadcast
ARP in IPv4 broadcasts "who has 192.0.2.10?" to every host on the link. IPv6 instead sends the question to a multicast group that, in practice, only the target joins.
Every unicast or anycast address has a solicited-node multicast address (RFC 4291): the prefix ff02::1:ff00:0/104 plus the last 24 bits of the unicast address.
unicast: 2001:db8:10:1:: 2b: 3c4d
(last 24 bits = 2b3c4d)
solicited-node: ff02::1:ff2b:3c4d
A host joins the solicited-node group for each of its addresses. Because addresses with the same last 24 bits share a group, the link-local fe80::…:2b:3c4d and a global address with the same IID use the same group.
On Ethernet, an IPv6 multicast address is sent to the MAC address 33:33 followed by the last 32 bits of the IPv6 address (RFC 2464). The NIC can filter in hardware, so other hosts' CPUs never see the packet.
ff02::1:ff2b:3c4d → 33:33:ff:2b:3c:4d
ff02::1 → 33:33:00:00:00:01
Address resolution: NS and NA
Drawing diagram…
- Host A sends a Neighbor Solicitation (type 135) to the target's solicited-node address. It includes its own link-layer address (Source Link-Layer Address option) so B can reply without asking back.
- Host B replies with a Neighbor Advertisement (type 136), unicast, with the Solicited flag set and its link-layer address in the Target Link-Layer Address option.
- Both hosts cache the mapping in their neighbour cache (
ip -6 neigh). L3.01 covers the cache states (INCOMPLETE, REACHABLE, STALE, DELAY, PROBE).
Hosts also send NS messages to check that a neighbour is still reachable (Neighbor Unreachability Detection) and to make sure nobody else already uses an address (Duplicate Address Detection, which you will meet in L1.06).
Router discovery: RS and RA
- Routers send Router Advertisements (type 134) periodically to all nodes,
ff02::1, and in response to solicitations. - A host that has just come up does not wait. It sends a Router Solicitation (type 133) to all routers,
ff02::2. - The RA tells hosts: "I can be your default router (Router Lifetime), here are the on-link prefixes (Prefix Information options), here is the link MTU, and whether to use DHCPv6 (M and O flags)". The RA's source is the router's link-local address, which becomes the host's default gateway.
Drawing diagram…
Redirect (type 137) lets a router tell a host "for that destination, use this better first hop on the same link".
The Hop Limit 255 check
All ND messages are sent with Hop Limit 255, and receivers must discard ND messages that arrive with any other value (RFC 4861). A router would have decremented the Hop Limit, so a packet with 255 must have come from the same link. This stops off-link attackers from injecting fake RAs or NAs. It does nothing against an attacker on the link, which is why Level 5 covers RA-Guard and related defences.
ND compared with ARP
| IPv4 ARP | IPv6 ND | |
|---|---|---|
| Layer | Its own EtherType (0x0806) | ICMPv6 inside IPv6 |
| Request sent to | Broadcast | Solicited-node multicast |
| Router discovery | Not included (DHCP or manual) | RS/RA built in |
| Duplicate detection | Gratuitous ARP (optional) | DAD (built in) |
| Reachability tracking | Basic | NUD state machine |
Worked examples
Example 1: Solicited-node address
Question: What is the solicited-node multicast address for 2001:db8:4a00:10:21a:2bff:fe3c:4d5e?
Working: The last 24 bits are 3c:4d5e, from groups fe3c and 4d5e. Take the last 2 hex digits of fe3c (3c) and all of 4d5e. Append them to ff02::1:ff: ff02::1:ff3c:4d5e.
Example 2: Multicast MAC address
Question: Which Ethernet destination MAC carries a packet to ff02::1:ff3c:4d5e?
Working: 33:33 plus the last 32 bits (ff3c:4d5e) gives 33:33:ff:3c:4d:5e.
Example 3: Same group for two addresses
Question: A host has fe80::21a:2bff:fe3c:4d5e and 2001:db8:4a00:10:21a:2bff:fe3c:4d5e. How many solicited-node groups does it join for these two addresses?
Working: Both end in 3c:4d5e, so one group: ff02::1:ff3c:4d5e.
Example 4: Classify a message
Question: A capture shows ICMPv6 type 3, code 0. What is it, and is it an error?
Working: Type 3 is Time Exceeded (code 0: hop limit exceeded in transit). Types below 128 are errors. This is what traceroute -6 relies on.
Lab
Goal: Watch address resolution and router discovery on the wire, and confirm the solicited-node and multicast-MAC calculations.
You need: Linux with iproute2, tcpdump (or Wireshark), and radvd (apt install radvd). Everything runs in namespaces.
Step 1: Topology
sudo ip netns add r1; sudo ip netns add h1; sudo ip netns add h2
sudo ip link add br0 type bridge && sudo ip link set br0 up
for n in r1 h1 h2; do
sudo ip link add v-$n type veth peer name e0 netns $n
sudo ip link set v-$n master br0 up
sudo ip -n $n link set e0 up; sudo ip -n $n link set lo up
done
sudo ip -n r1 -6 addr add 2001:db8:30:1::1/64 dev e0
sudo ip -n h1 -6 addr add 2001:db8:30:1::a/64 dev e0
sudo ip -n h2 -6 addr add 2001:db8:30:1::b/64 dev e0
Step 2: Capture an address resolution
sudo ip netns exec h2 tcpdump -i e0 -e -n -vv icmp6 &
sudo ip netns exec h1 ping -c 1 2001:db8:30:1::b
sudo pkill tcpdump
From the capture, record the NS destination IPv6 address and destination MAC, the NA destination, the Solicited flag, and the Hop Limit of both messages. Compare them with your own calculation of the solicited-node address and multicast MAC for 2001:db8:30:1::b. Then show the result with sudo ip -n h1 -6 neigh.
Step 3: Router discovery with radvd
cat <<'EOF2' | sudo tee /tmp/radvd-l105.conf
interface e0 {
AdvSendAdvert on;
MinRtrAdvInterval 10;
MaxRtrAdvInterval 30;
prefix 2001:db8:30:1::/64 { AdvOnLink on; AdvAutonomous on; };
};
EOF2
sudo ip netns exec r1 sysctl -w net.ipv6.conf.all.forwarding=1
sudo ip netns exec h1 tcpdump -i e0 -n -vv 'icmp6 and (ip6[40] == 133 or ip6[40] == 134)' &
sudo ip netns exec r1 radvd -C /tmp/radvd-l105.conf -p /tmp/radvd-l105.pid -n &
sleep 3
sudo ip netns exec h1 rdisc6 e0 2>/dev/null || echo "rdisc6 not installed (apt install ndisc6); wait for a periodic RA instead"
sleep 30; sudo pkill tcpdump; sudo pkill radvd
sudo ip -n h1 -6 route show default
Record the RS destination, the RA destination and source, the Router Lifetime and the Prefix Information. Confirm that h1's default route points to r1's link-local address.
Step 4: Clean up
for n in r1 h1 h2; do sudo ip netns del $n; done; sudo ip link del br0
Summary
- ICMPv6 (Next Header 58) carries errors (types 0–127), informational messages (128–255), Neighbor Discovery and MLD. Never block it wholesale.
- The solicited-node multicast address is
ff02::1:ffplus the last 24 bits of the unicast address. Ethernet carries IPv6 multicast to33:33plus the last 32 bits. - NS (135) goes to the target's solicited-node group, and NA (136) comes back unicast with the Solicited flag. Together they replace ARP.
- RS (133) goes to
ff02::2, and RA (134) goes toff02::1or unicast, giving the default router (by link-local address), prefixes, MTU and flags. Redirect is type 137. - ND messages use Hop Limit 255, so off-link forgeries are discarded. On-link attackers need other defences (Level 5).
- Next lesson (L1.06): how hosts build addresses with SLAAC and DHCPv6.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.