IPv6 Neighbor Discovery
ICMPv6-based protocol replacing ARP for address resolution in IPv6 networks.
From Local Shout to Targeted Question: The Evolution Beyond ARP
In the IPv4 world, the Address Resolution Protocol (ARP) was the local detective. Its job was to solve the critical "two-address problem": translating a known IP address to an unknown MAC address on the local network. It did this by broadcasting a loud "shout" to every device on the network segment: "WHO HAS this IP address?" While effective, this broadcast approach was inefficient, created unnecessary network noise, and was notoriously insecure.
When designing IPv6, engineers had a golden opportunity to rethink local network operations from the ground up. Instead of just porting ARP to the new protocol, they created a far more sophisticated, efficient, and versatile replacement.
This new system is the . NDP isn't just "ARP for IPv6"; it's a comprehensive suite of tools that also absorbs the functions of other IPv4 protocols like ICMP Router Discovery and DHCP for certain tasks, making local network communication in IPv6 much more integrated and intelligent. NDP is built entirely upon a set of specific ICMPv6 messages.
A Fundamental Shift: From Broadcast to Multicast
The single most important improvement of NDP over ARP is its move away from inefficient broadcasts.
- The Problem with ARP's Broadcasts: An ARP Request is a Layer 2 broadcast. This means the message is sent to the special MAC address
FF:FF:FF:FF:FF:FF, forcing the network interface card (NIC) of every single device on the local network segment to stop what it's doing, receive the frame, and pass it up to the CPU for processing, even if the request is irrelevant to it. This creates unnecessary processing overhead and network chatter. - NDP's Solution - Solicited-Node Multicast: NDP uses a clever addressing trick. For every unicast IPv6 address a device has, it also automatically joins a special . This is called the solicited-node multicast address. This address is algorithmically generated by taking the last 24 bits of the device's IPv6 address and appending them to the prefix
FF02::1:FF00:0/104.
The result is that when Host A wants to find the MAC address for Host B, it doesn't shout to everyone. Instead, it sends its query (a Neighbor Solicitation message) to the targeted solicited-node multicast address of Host B. Modern network switches are smart enough to forward multicast frames only to the ports of devices that have registered interest in that multicast group.
Analogy: ARP is like making an announcement over the entire office building's PA system just to find one person. NDP is like knowing that person is in the accounting department and only making the announcement on the accounting floor's intercom. It's far less disruptive for everyone else.
The Five Core Message Types of NDP
The Neighbor Discovery Protocol operates using five distinct types of ICMPv6 messages. Understanding these messages is key to understanding how IPv6 works at the local level.
1. Router Solicitation (RS) - ICMPv6 Type 133
Purpose: Sent by a host to ask routers on the link to identify themselves immediately.
Analogy: A new employee walks into an open-plan office and asks, "Hi everyone, can a manager please let me know who you are and what the network rules are here?"
When a device first connects to a network, it doesn't want to wait for the next periodic router advertisement. It sends an RS message to the "all routers" multicast group to prompt an immediate response, allowing for quick network configuration.
2. Router Advertisement (RA) - ICMPv6 Type 134
Purpose: Sent periodically by routers (or in response to an RS) to announce their presence and provide essential network configuration parameters.
Analogy: The office manager periodically makes an announcement: "Just a reminder, I'm the manager for this floor. The company network name is CorpNet, and our public-facing telephone prefix is 555-..."
RA messages are the backbone of IPv6 autoconfiguration. They contain crucial information, such as the network prefix hosts should use to configure their own addresses (SLAAC), the address of the router (default gateway), and flags indicating whether hosts should also use DHCPv6 for more configuration options.
3. Neighbor Solicitation (NS) - ICMPv6 Type 135
Purpose: This is the workhorse of NDP, serving multiple functions. Its primary role is address resolution, the function performed by an ARP Request in IPv4.
Analogy: This is the targeted question: "I need to talk to the person with the name 'Jane Doe', can you please tell me your desk number?"
An NS message is sent by a node to a solicited-node multicast address to determine the MAC address of a specific neighbor. It's also used to verify that a neighbor is still reachable (Neighbor Unreachability Detection) and to check if an IP address is already in use before claiming it (Duplicate Address Detection).
4. Neighbor Advertisement (NA) - ICMPv6 Type 136
Purpose: The response to a Neighbor Solicitation message. It's the equivalent of an ARP Reply.
Analogy: Jane Doe responds directly to the person who asked: "I'm Jane Doe, and my desk number is B-42."
An NA message is sent to provide the requested MAC address. It is also used to announce a change of link-layer address; for example, if a device gets a new network card, it can send out an unsolicited NA message to update the caches of its neighbors.
5. Redirect - ICMPv6 Type 137
Purpose: Sent by a router to inform a host of a better first-hop router for a specific destination.
Analogy: You ask the floor manager for directions to another department. The manager says, "You could go through me, but it's much faster if you talk directly to that other manager over there for that specific request."
This message is used to optimize the local routing path. If a host sends a packet to its default router, but the router knows that another router on the same link is a better path to the destination, it will forward the packet correctly and also send an ICMPv6 Redirect message to the host, telling it to send future packets for that destination directly to the other router.
NDP in Practice: Key Functions
These five message types work together to perform several critical functions on a local IPv6 network.
- Address Resolution (NS & NA): This is the direct replacement for ARP. A host sends a Neighbor Solicitation (NS) to the solicited-node multicast address of the target. The target responds with a unicast Neighbor Advertisement (NA) containing its MAC address. The asking host then populates its Neighbor Cache (the IPv6 equivalent of the ARP cache).
- Router and Prefix Discovery (RS & RA): This process allows a host to automatically configure itself on a network without needing a DHCP server. The host sends a Router Solicitation (RS), and a router responds with a Router Advertisement (RA). This RA message contains the network prefix, the router's address (which becomes the host's default gateway), and other network parameters.
- Duplicate Address Detection - DAD (NS & NA): Before a host starts using an IPv6 address it has just configured (e.g., via SLAAC), it performs DAD to ensure no other device is already using that address. It sends a Neighbor Solicitation (NS) message to the solicited-node multicast address corresponding to the address it wants to use. The source address of this NS packet is the unspecified address (
::). If any other device on the link is already using that address, it will respond with a Neighbor Advertisement (NA). If the host receives this NA, it knows there is an IP conflict and will not use the address. If it receives no reply, the address is unique and safe to use. This is a vast improvement over IPv4's less reliable gratuitous ARP. - Neighbor Unreachability Detection - NUD (NS & NA): NDP includes a robust mechanism for tracking whether a neighbor is still reachable. A device in the "REACHABLE" state will eventually transition to "STALE" in the neighbor cache. Before sending data to a stale entry, the device sends a unicast Neighbor Solicitation to confirm the neighbor is still alive. If it gets a Neighbor Advertisement back, the neighbor is reachable again. If not, the device may try a few more times before marking the neighbor as "UNREACHABLE". This helps to quickly detect and recover from failures of neighboring devices.
ARP vs. NDP: A Summary of Improvements
| Feature | ARP (in IPv4) | Neighbor Discovery (NDP) (in IPv6) |
|---|---|---|
| Underlying Protocol | Its own, distinct protocol. | Built upon ICMPv6. |
| Addressing Method | Layer 2 Broadcasts. | Layer 3 Multicast (Solicited-Node). |
| Core Functions | Address Resolution only. | Address Resolution, Router Discovery, Prefix Discovery, Redirect, Reachability Tracking. |
| Conflict Detection | Relies on optional Gratuitous ARP, can be unreliable. | Built-in, robust Duplicate Address Detection (DAD) process. |
| Security | Highly vulnerable to ARP spoofing by default. | Can be secured with IPsec; some built-in defenses like DAD. |