The Neighbor Discovery Protocol is the name of a series of processes used by IPv6 for the purposes of Neighbor Discovery (a bit of recursive naming there, sorry!), Router Discovery and Neighbor Unreachability Detection (NUD). The actual act of Neighbor Discovery is how IPv6 nodes determine the L2 address (e.g. - MAC) for a known L3 address (e.g. - IPv6); very analogous to the function performed by ARP in IPv4.
The goal of Neighbor Discovery is to allow nodes on-link with each other to communicate. In order to accomplish this on most media types, the source needs to "discovery" the L2 (e.g. - MAC) address of the destination.
IPv6 uses multicast-based Neighbor Discovery to accomplish this goal, without interrupting every other node on that link. Ideally, only the correct destination node receives the frame/packet.
This is accomplished in several steps:
- Let's assume a destination address of 2001:db8:1:1::1.
This is mapped into the "Solicited Node Multicast Address" (SNMA) format of ff02::1:ffXX:XXXX. The XX:XXXX represent the last 24 bits of the SNMA, and are derived directly from the last 24 bits of the destination address. Resulting in a SNMA ff02::1:ff00:0001, or ff02::1:ff00:1. This, being a multicast address, can be mapped to a multicast MAC address, using the format 33-33-XX-XX-XX-XX Resulting in 33-33-ff-00-00-01 This is a MAC address that is only being listened for by nodes sharing the same last 24 bits.
In other words, while there is a chance for a "address collision", it is a vast improvement over ARP's guaranteed "collision".
With the above process in mind, now we can get into how we use them ... There are two new ICMPv6 messages for this portion of Neighbor Discovery, the Neighbor Advertisement and the Neighbor Solicitation. (In IPv4 we would call these ARP-Request and ARP-Reply.)
When used as described above, Neighbor Solicitation (NS) messages are multicast to the SNMA of the destination using ICMPv6 messaging (type 135); specifying the 128bit "Target Address" and using the "Source Link Layer Address Option" (SLLAO) so that the destination will not need to do similar to find the source's MAC address.
Again, following the above situation, the response to a NS would be a Neighbor Advertisement (NA). Again, suing ICMPv6 messaging (type 136, this time) and using the "Target Link Layer Address Option" (TLLAO).
After the NS-NA exchange the hosts can now communicate as they know each others' L2 addresses.