I've noticed that for certain IPv6 addresses, applying prefixes of different length yield the same IPv6 prefix.
How is this handled in the Neighbor Discovery Protocol?
Can't the address can technically be on two different subnets at the same time if the prefix is the same for different prefix lengths?
My assumption is that it simply uses the longest prefix length.
Example: The address 2002:1234:5678::100 with a prefix length of either 39 or 40 will yield the same prefix. Also, prefix lengths of 46, 47, and 48 yield the same prefix calculation.
What you describe holds true for IPv4, too. Subnetting works exactly the same way for IPv4 and IPv6.
2002:1234:5678::100/39
is the same address as 2002:1234:5678::100/40
, just as 10.0.0.13/15
is the same address as 10.0.0.13/16
.
If you mask your examples, you get prefixes of 2002:1234:5600::/39
and 2002:1234:5600::/40
. In my IPv4 example, you get prefixes of 10.0.0.0/15
and 10.0.0.0/16
. The latter is a subnet of the former. It's all simple binary.
Neighbor Discovery relies on IPv6 subnets all being /64
.