When it comes to ULA, IPv6 gurus get nervous. Some hear NAT, and NAT is the most disgusting word in IPv6 vocabulary.

Well, ULA is not to be NAT-ed (look for Ivan’s ipSpace posts about ULA for more know-how), it can be used in a much smarter way – it can provide an internal connectivity in case when a site gets isolated from its basic networking services like DHCPv6, for example. Yes, these things can happen.

So, the idea is to use global addresses accompanied with ULA. IPv6 is designed to support the communication on ULA combined with unicast global addressing. As long as the packet stays within the scope zone which corresponds to its source and destination address, it can reach its destination. More, the source selection criteria in IPv6 complies well with the ULA/global coexistence.

ULA is an IPv6 unicast address based on a random prefix which starts with fc00::/7 as depicted below (L bit is 1 for locally assigned prefixes and set to 0 if the prefix is centrally assigned – see draft-hain-ipv6-ulac-02 for more detailed explanation):

ULA, being random, it is semi-globally unique. ULA is intended for local communications, usually within a site. In ULA 40 bits are being used for the Global ID which is to be pseudo-random and not assigned sequentially or with well-know numbers.

With 40 random bits ULA can provide up to 2^40 or approximately 1 mio x mio /48 prefixes (it comes handy to remember that 2^10 is 1000 approx. and 2^20 is close to one million). In this post I will focus on address collision probability when ULAs are being used.

ULAs are not expected to be routable on the global Internet but they can be routable within some smaller administrative domain. In theory, two or more organisations within that domain can choose the same prefix, but the probability for such event (if they use proper random the get their ULA) is negligible for a domain with, let say, less than 1000 organisations. Let us do some math to get this right.

Say, we have D = 2^40 possible prefixes and n organisations which randomly choose one prefix each. What is the probability that two or more choose the same prefix? Let us denote this probability with p(n,D). It might be easier for us to think of the opposite situation when all organisations choose different prefixes. Let us mark the probability for this situation with q(p,D). Obviously, the probability p(n,D) = 1 – q(n,D). To find q(n,D), we first go through each organisation and check for the probability that it will choose a different prefix than the previous ones. Starting with the first one, its probability to choose a unique prefix is 1, because it is the first one choosing and every possible prefixes are not in use. The second one has a chance

to choose a free prefix (one has been already taken). The third one

and the last (n’th) one:

Since all these events are independent of each other the probability of all of the events occurring is equal to a product of the probabilities of each one of them occurring. This will give us the probability for all prefixes being unique:

Let us take into account that the number of organisations (n) is much much smaller than the number of all possible unique prefixes (D), n << D. Keeping this in mind we can simplify

and rewrite our formula:

In our case, n is so small in comparison with D, which is giving us another opportunity for simplification:

…and finally:

This formula, which is accurate enough for n = 1,000 organisations (here, n^2 is much less than 2^40), will confirm that the probability for a ULA-site addressing conflict is negligible. Within 1,000 organisations this probability is 4.5 x 10^-7. We can conclude that it is very unlikely that (up to) 1,000 organisations in a common routing domain will experience an addressing conflict with ULA.

If you look into our simplified formula closely, you will notice that is says that the probability to avoid collision is the number of all possible pairs between n organisations divided by all possible prefixes. Does it sound logical?

References:

RFC 4193 – Unique Local IPv6 Unicast Addresses

Centrally Assigned IPv6 Unicast Unique Local Address Prefixes

IPv6 ULA Registration at SiXS

Ed Horley, IPv6 Unique Local Address or ULA – what are they and why you shouldn’t use them

Ed Horley, Follow up to my IPv6 and ULA post plus some thoughts on design and IPv6 behavior

Ivan Pepelnjak, I say ULA, you hear NAT

Ivan Pepelnjak, Source IPv6 selection saves the day

Ivan Pepelnjak, To ULA or not to ULA, that’s the question

Yar Tikhiy, IPv6 for IPv4 Experts