Address Resolution – Mapping IP Addresses to Link Layer Addresses

Address Resolution is used to map IP addresses to Link Layer addresses, which are used to build an Ethernet frame. This is similar to the mapping of domain names to IP addresses done by DNS, but takes place at a lower level of the network stack.

In IPv4, address resolution is done by the ARP protocol. In IPv6, this is done by the Address Resolution mechanism of the Neighbor Discovery protocol.

Assume alice-pc (one node in a subnet) wants to send a packet to bob-pc (another node in the same subnet), using IPv6. The following explanation assumes the Link Layer protocol is Ethernet (which uses MAC addresses). Other Link-Layer protocols work in a similar manner, but may use other Link Layer addresses.

IPv6 Address Resolution involves 5 steps:

Step 1 – Alice-pc checks her Neighbor Cache (similar to the ARP cache in IPv4), to see if there is an entry with bob-pc’s IPv6 address. If not, then she hasn’t communicated with bob-pc recently, so if there had been an entry there before, it has expired. If she finds an entry, she has recently communicated with bob-pc and cached his MAC address. In this case, alice-pc can skip directly to Step 5.

Step 2 – Alice-pc creates a new entry in her Neighbor Cache for bob-pc, with his IPv6 address (no MAC address yet), with status = INCOMPLETE. Alice-pc then sends a Neighbor Discovery message to bob-pc. The source address of this request is set to the source address from the packet she wants to send (which is one of her IPv6 addresses). The destination address of this request is the Solicited Node Multicast address derived from bob-pc’s IPv6 address. Alice-pc includes her own MAC address in a Source Link-Layer Address option, which insures that bob-pc will have her MAC address when he replies.

Step 3 – Bob-pc receives alice-pc’s Neighbor Solicitation message. For future reference, bob-pc creates (or updates) alice-pc’s entry in his own Neighbor Cache with the source IPv6 address from her request and the MAC address from the Source Link-Layer Address option from her request. He then replies with a Neighbor Advertisement message. The source address of this reply is one of his own link-local IPv6 address. The destination address is the source address from alice-pc’s request. He includes his own MAC address as a Source Link-Layer Address option.

Step 4 – Alice-pc receives bob-pc’s Neighbor Advertisement message, and adds his MAC address (from the Source Link-Layer Address option in his reply) to his incomplete entry in her Neighbor Cache.  Alice-pc then marks bob-pc’s entry in her Neighbor Cache as REACHABLE.

Step 5 – At this point, alice-pc has bob-pc’s MAC address (whether it was already in her Neighbor Cache, or had to be obtained from bob-pc). She can use it to create the Ethernet frame around the packet she wants to send, and then send it over Ethernet. Until bob-pc’s entry in her Neighbor Cache expires, alice-pc can send bob-pc additional packets without having to ask for his MAC address again (using his entry in her Neighbor Cache). Once that expires though, the next time alice-pc wants to send bob-pc a packet, she will have to do another Address Resolution.