IPv6 ULAs have a global scope, so when it comes to a default address selection in IPv6, longest prefix match criteria is used to chose a proper source IPv6 address to speak with the remote site within the same (global) scope.

I’ve discussed scopes and zones in one of my recent posts. I’ve mentioned IPv6 ULA in that context which was somehow misleading and well spotted in a comment by Roger Wilco, saying “Strictly speaking, ULA have global scope, and so the scope and zone math shouldn’t be required to be able to explain why an IPv6 host can want to speak with a remote globally routed address from a local ULA.” Absolutely true!

Yes, ULA is global. Here is how it looks like on a Fedora Linux box (here, ULA is not properly chosen with a random Global ID. Please, consider it just as an example.) :

[janez@localhost ~]$ ifconfig p3p1
p3p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet xxx.y.241.132  netmask 255.255.255.128  broadcast xxx.y.241.255
        inet6 2001:yyyy:e811:b00::da:4b50  prefixlen 128  scopeid 0x0<global>
        inet6 fe80::20c:29ff:fe55:96d  prefixlen 64  scopeid 0x20<link>
        inet6 fd00:e811:b00:0:20c:29ff:fe55:96d  prefixlen 64  scopeid 0x0<global>
        ether 00:0c:29:55:09:6d  txqueuelen 1000  (Ethernet)
        RX packets 33106  bytes 34209727 (32.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5786  bytes 796305 (777.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[janez@localhost ~]$ ip -6 addr show dev p3p1
2: p3p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 fd00:e811:b00:0:20c:29ff:fe55:96d/64 scope global dynamic
       valid_lft 293sec preferred_lft 113sec
    inet6 2001:yyyy:e811:b00::da:4b50/128 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe55:96d/64 scope link
       valid_lft forever preferred_lft forever

All the fdxx addresses have global scope from the host perspective which brings us to an interesting question –

Which (global) address will be used as a source in communication with some external IPv6 destination?

RFC 6724 has an answer to that.

Let us first check what happens on our test host when pinging:

  • 2600::
  • some local ULA, say fd00:e813::1

By the way, the first one is a really cute IPv6 address of http://www.sprint.net. With a little help of tcpdump we can confirm that a global source 2001:yyyy:e811:b00::da:4b50 is used to reach 2600::, and fd00:e811:b00:0:20c:29ff:fe55:96d is chosen for internal communication with fd00:e813::1. This is an expected behaviour according to the RFC 6724 Rule 8: Use longest matching prefix.
In our case we have the following number of most significant bits that match:

source         destination   bits match
2001:...       2600:...      5
fd00:e811:...  2600:...      0
2001:...       fd00:e813::1  0
fd00:e811:...  fd00:e813::1  30

QED.

Advertisements