Why do you need IPv6 Neighbor Solicitation to get the MAC address?

Solution 1:

Every node automatically generates a link-local address, but:

  • That address might not be generated with the EUI-64 format specified in RFC 2464. IPv6 addresses may also be cryptographically generated addresses (RFC 3972), temporary privacy addresses (RFC 4941), or in modern operating systems, stable privacy addresses (RFC 7217).

  • An address that looks like it has an EUI-64 interface ID might not actually correspond to the indicated MAC address due to explicit configuration by an administrator.

Because you can't just "convert the address back" to a MAC address, you must send a Neighbor Solicitation to determine the MAC address.

There are other reasons why Neighbor Solicitations are necessary, as well. Some of these are:

  • Duplicate address detection (RFC 4862). It's possible that some other host may have (rightly or wrongly) claimed an address that a host wants to use.
  • Neighbor unreachability detection. A lack of response to a Neighbor Solicitation is one indicator that the neighbor is unreachable.

Books are all well and good, but very out of date books may not be so useful. Even IPv6 has had significant revisions in the last ten years. The best source of truth is the relevant RFCs, both the original ones and any that are marked as having updated or obsoleted them. RFCs are specified in sufficient detail to allow conforming implementations to be written. You can learn all the details of neighbor discovery by reading RFC 4861.

Solution 2:

So, you either misunderstand or were misinformed on a few things.

Using SLAAC a host can construct its own IPv6 addressing using its MAC address, but many people thought that this was dangerous, giving away too much information, and allowing a particular host to be tracked. Based on that, privacy extensions and random addressing were developed, and they are used by OSes to provide privacy/security. That means a host can create its own addressing, not based on its MAC address.

When a host needs to discover the MAC address of a neighbor in IPv4, it uses ARP. ARP broadcasts a request, but IPv6 doesn't have broadcast. Instead, every host must join a Solicited Node multicast group. This group is based on the last 24 bits of its IPv6 address. Since IPv6 interfaces can have any number of IPv6 addresses, a host may join multiple Solicited Node multicast groups. An IPv6 host looking for the MAC address of another host will send a multicast request to the Solicited Node multicast group of the target IPv6 address.

This provides an advantage over IPv4 ARP. Since ARP uses a broadcast for requests, it interrupts every host on the layer-2 broadcast domain. Because the Solicited Node multicast group uses the last 24 bits of the target IPv6 address, the ND multicast request will probably only interrupt the target host, or possibly one or two other hosts on the layer-2 broadcast domain.