Neighbor Solicitation (NS) and Neighbor Advertisement (NA) are key messages in the IPv6 Neighbor Discovery Protocol (NDP), playing critical roles in IPv6 communication. These messages handle tasks like address resolution (replacing ARP) to determine link-layer addresses from IPv6 addresses, checking for duplicate addresses (Duplicate Address Detection), and performing neighbor unreachability detection. In this section, we will demonstrate how these functions work in practice.
IPv6 NS and NA Messages
We have already demonstrated the application of SLAAC and DHCP for dynamic IPv6 addressing, as well as gateway redundancy using Router Solicitation (RS) and Router Advertisement (RA). In this section, we will focus on two additional NDP messages: Neighbor Solicitation (NS) and Neighbor Advertisement (NA).
To start better discuss and demonstrate neightbor solicitation and neighbor advertisment, I have created a topology with just two clients in the same subnet with IPv6 addresses 2001:AA:BB:CC::1/64 and 2001:AA:BB:CC::2/64 connected in the same switch.
Neighbor Solicitation Message
When a client wants to communicate with a destination within the same subnet, it needs the Layer 2 address of that destination. If the client wants to communicate with a node outside the subnet, it needs the Layer 2 address of the gateway, which must be resolved from the Layer 3 (IPv6) address. In IPv4, this process is handled by sending an ARP request. In IPv6, however, ARP is replaced by the Neighbor Solicitation message as part of the Neighbor Discovery Protocol (NDP).
To illustrate the format of a Neighbor Solicitation message, I have already captured a neighbor solicitation message example from the topology, which is shown below.
The source IPv6 address in the Neighbor Solicitation message is of the same type as the destination address being resolved, which could be link-local, unique local, or globally unique.
The destination IPv6 and MAC address in the Neighbor Solicitation message are the solicited-node multicast addresses of the destination, as we discussed earlier in Lesson 8 titled “IPv6 Solicited-Node Multicast Address“.
Within the Neighbor Solicitation message, there is a target address field, which specifies the IPv6 address that we want to resolve.
Neighbor Solicitation is used not only for address resolution but also for Duplicate Address Detection (DAD) and the Neighbor Unreachability Detection (NUD) process.
When an IPv6 address is obtained dynamically, before it can be used, the system must ensure that the address is not already in use. This is achieved through Duplicate Address Detection: the client sends a Neighbor Solicitation message for that IPv6 address. If no Neighbor Advertisement message is received in response (which would indicate the address is already assigned), the address is considered unique and is assigned to the system.
Concept | Description |
---|---|
Address Resolution in IPv6 | Uses Neighbor Solicitation (NS) to obtain the Layer 2 address (MAC address) of a destination device based on its Layer 3 (IPv6) address. |
Source IPv6 Address of Neighbor Solicitation Message | The source IPv6 address in the NS message is of the same type as the destination address being resolved (link-local, unique local, or globally unique). |
Destination IPv6 and MAC Address of Neighbor Solicitation Message | The destination address is the solicited-node multicast address corresponding to the target address being resolved, allowing for efficient communication with the neighbor. |
Other Applications of Neighbor Solicitation Message | Besides address resolution, NS messages are also used in Duplicate Address Detection (DAD) and Neighbor Unreachability Detection (NUD) processes. |
Neighbor Advertisement Message
Neighbor Advertisement (NA) messages are sent in response to Neighbor Solicitation (NS) messages. To illustrate the properties of a Neighbor Advertisement message, I have captured a sample of this packet.
The Neighbor Advertisement (NA) is transmitted using unicast addresses at both Layer 2 and Layer 3, similar to an ARP reply in IPv4. This message contains the target Layer 3 IPv6 address and the corresponding target Layer 2 address, serving as the response to the Neighbor Solicitation (NS) message.
IPv6 Neighbor Cache
The result of Neighbor Solicitation (NS) and Neighbor Advertisement (NA) messages is the creation of a Neighbor Cache on each node, which is equivalent to the ARP cache in IPv4. This table stores information about neighbors on the same link, including their IPv6 addresses and corresponding link-layer (MAC) addresses. The cache ensures efficient packet delivery by avoiding repeated address resolution processes.
On Cisco IOS routers, we can check the Neighbor Cache using the command „show ipv6
neighbors“
.
Below is the Neighbor Cache output from client1, showing two entries for the globally unique and link-local addresses of client2. The neighbor statuses are listed as “STALE.” When I ping client2, the status changes to “REACH,” indicating that the neighbor is reachable.
Client1#show ipv6 neighbors IPv6 Address Age Link-layer Addr State Interface 2001:AA:BB:CC::2 7 aabb.cc00.0300 STALE Et0/0 FE80::A8BB:CCFF:FE00:300 7 aabb.cc00.0300 STALE Et0/0 ! Client1#ping 2001:AA:BB:CC::2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2001:AA:BB:CC::2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/5 ms ! Client1#show ipv6 neighbors IPv6 Address Age Link-layer Addr State Interface 2001:AA:BB:CC::2 0 aabb.cc00.0300 REACH Et0/0 FE80::A8BB:CCFF:FE00:300 7 aabb.cc00.0300 STALE Et0/0
IPv6 Neighbor Cache states represent the status of neighbors in the Neighbor Cache, which is used for tracking reachability. The key states are:
State | Description |
---|---|
INCOMPLETE | Waiting for a response to a Neighbor Solicitation (NS) message; address resolution is in progress. |
REACH | Neighbor is reachable; recent communication has confirmed its reachability. |
STALE | Information is valid but has not been used recently; requires further communication to verify. |
DELAY | Neighbor hasn't been heard from recently; waiting to send a probe after a short delay. |
PROBE | Actively probing the neighbor with NS messages to confirm reachability. |