ipv6 source address selection

Sander Steffann sander at steffann.nl
Sun Oct 20 13:07:12 CEST 2013


Hi Mikael,

> I don't understand why the host would choose source address in 2001:db8:1:1000:/64 when pinging 2001:db8:1:1001:1/128 because of this, but use 2001:db8:1:8000::/64 when pinging the rest of the Internet

Still Longest prefix matching :-)  Don't think of prefixes as prefixes-in-your-routing-table but longest-matching-string-of-bits-from-the-beginning-the-addresses.

When pinging 2001:db8:1:1001::1/128 then:
- A source in 2001:db8:1:1000::/64 will have 63 bits the same as the destination
- A source in 2001:db8:1:8000::/64 will have 48 bits the same as the destination

So the address in 2001:db8:1:1000::/64 will have the longest matching prefix and will be used.

When pinging 2001:4860:4860::8888/128 then:
- A source in 2001:db8:1:1000::/64 will have 17 bits the same as the destination
- A source in 2001:db8:1:8000::/64 will have 17 bits the same as the destination

So for longest prefix matching they are equal. As this is the last source address selection rule in the RFC the OS will just decide which address to use, which commonly is the most recently configured address.

Cheers,
Sander




More information about the ipv6-ops mailing list