IPv6 NDP Explained: Neighbor Solicitation and Neighbor Advertisement
Address resolution is crucial for mapping IPv6 addresses to their corresponding link-layer (MAC) addresses. NDP performs address resolution using Neighbor Solicitation (NS) and Neighbor Advertisement (NA) messages.
Why is it needed?
- Hosts need to know the MAC address of a destination to successfully deliver packets on the local link.
- By resolving the MAC address, hosts can establish direct communication with neighboring nodes.
I- Neighbor Solicitation
Neighbor solicitations are used by nodes to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable via a cached link-layer address.
- Host A wants to resolve the MAC address of Host B. It constructs a Neighbor Solicitation (NS) message containing the IPv6 address of Host B.
– Host A encapsulates the NS message within an IPv6 packet and sets the destination address to the IPv6 multicast address associated with Host B’s IPv6 address. The source address is typically the IPv6 address of Host A.
– Host-A will send an NS message to the solicited-node multicast address of the target (MBP) that has the lower 24 bits from the IPv6 unicast address (
ff02::1:FF11:6770). Every layer 3 multicast address is mapped to a layer 2 multicast MAC address (
33:33:xx:xx:xx:xx) where xx:xx:xx:xx are the last 32 bits of the solicited-node multicast address.
– Host A also includes its own link-layer (MAC) address within the NS message.
- The NS message is then transmitted over the link.
Let’s test it in lab and perform a Wireshark packet capture:
We can see what explained before in the Wireshark capture:
ICMPv6 Neighbor Solicitation Header:
In the IMCPv6 NS ‘Neighbor Solicitation’ header, the Target Address is the link-local address of Host-B (FE80::260:3EFF:FE11:6770) and the ICMPv6 Option “Source Link-Layer address” contain the MAC of the sender Host-A “MAC-A”.
ICMPv6 Neighbor Solicitation Header Diagram:
II- Neighbor Advertisement
Neighbor advertisements are used by nodes to respond to a Neighbor Solicitation message, or unsolicited to provide new information quickly.
- Upon receiving the NS message, Host B processes it and constructs a Neighbor Advertisement (NA) message in response.
– Host B sets the source address of the NA message to its own IPv6 address and the destination address to the unicast IPv6 address of Host A.
– Host B includes its MAC address within the NA message.
- The NA message is transmitted back to Host A.
- Host A receives the NA message, extracts the MAC address of Host B, and updates its neighbor cache accordingly.
ICMPv6 Neighbor Advertisement Header:
In the ICMPv6 Neighbor Advertisement Header, Host-B will include its own IPv6 link-local address in the Target Address, and ICMPv6 Option “Target Link-layer address” value is MAC of Host-B “MAC-B” which is the purpose of the NA from Host-A persepctive.
ICMPv6 Neighbor Advertisement Header Diagram: