IPv6 Addresses
Default Address Selection

With several different addresses assigned to one interface, there is a problem what address does a host use for communication? For this purpose, the algorithm for selection of addresses was defined. RFC 3484 describes this algorithm.

Candidate Addresses

The candidate addresses are the fundamental block of Address Selection algorithm. The list of candidate addresses for destination addresses is usually obtained through a DNS query (translation of the domain name to IPv6 address). The list is sorted from the most suitable to the least suitable address from which the most suitable address is selected. In the case that the application has a destination IPv6 address, there is no choice of destination address.

It is necessary to select the most suitable source address to candidate destination address. The list of candidate source addresses contains all global unicast addresses that are assigned to interface through which data will be sent to a target node. It means that each destination address may have different lists of candidate source addresses. In the case of routers, the list of candidate source addresses may contain global unicast addresses of other interfaces on which data is forwarded.

The most suitable source/destination address is selected from the list of candidate source/destination addresses based on rules that are mentioned in the subsection Source Address Selection.

In the case that the communication fails, the address selection can be repeated.

Policy Table

The policy table is used to determine local precedence of address. Individual entries contain Prefix, Precedence and Label, where Precedence is used for sorting destination addresses and Label determines whether the selected pair of addresses fits together. In the case of identical labels both addresses, the pair of addresses is preferred. Precedence and Label are determined by the longest matching prefix.

If the administrator does not configure the policy table, the default policy table is used.

Default Policy Table

Prefix

Precedence

Label

::1/128

50

0

::/0

40

1

2002::/16

30

2

::/96

20

3

::FFFF:0:0/96

10

4

Source Address Selection

The Address Selection algorithm has two sets of rules. The first set describes source address selection. The Source Address Selection algorithm produces as output a single source address for use with a given destination address. The algorithm is demonstrated through an example, when there are two source addresses SA and SB for target node. The rules are applied gradually and when the decision is done, the others are ignored. If the decision is not done, implementations should provide a source address selection. The order of rules is:

  1. Prefer same address.
  2. Prefer appropriate scope – if Scope(SA) < Scope(SB): If Scope(SA) < Scope(destination address), then prefer SB and otherwise prefer SA.
  3. Avoid deprecated addresses.
  4. Prefer home addresses.
  5. Prefer outgoing interface – if SA is assigned to the interface that will be used to send to destination address and SB is assigned to a different interface, then prefer SA.
  6. Prefer matching label – if Label(SA) = Label(destination address) and Label(SB) ≠ Label(destination address), then prefer SA.
  7. Prefer public addresses.
  8. Use longest matching prefix.

The algorithm is a symmetric, so each rule is performed once more with swapped roles of source addresses. The most suitable source address for target node is determined by applying the rules.

Destination Address Selection

The suitability of source and destination addresses, among other things, is considered when the destination address selection is done. Therefore, the most suitable source address is determined for each destination address. Then there is the arrangement of destination addresses in the candidate list according to the following rules:

  1. Avoid unusable destinations – if destination address DB is known to be unreachable or if Source(DB) is undefined, then prefer destination address DA.
  2. Prefer matching scope – if Scope(DA) = Scope(Source(DA)) and Scope(DB) ≠ Scope(Source(DB)), then prefer DA.
  3. Avoid deprecated addresses.
  4. Prefer home addresses.
  5. Prefer matching label – if Label(Source(DA)) = Label(DA) and Label(Source(DB)) ≠ Label(DB), then prefer DA.
  6. Prefer higher precedence.
  7. Prefer native transport – if DA is reached via an encapsulating transition mechanism (e.g., IPv6 in IPv4) and DB is not, then prefer DB.
  8. Prefer smaller scope – if Scope(DA) < Scope(DB), then prefer DA.
  9. Use longest matching prefix.
  10. Otherwise, leave the order unchanged – if DA preceded DB in the original list, prefer DA. Otherwise prefer DB.

The computer has one network interface to which the following addresses were assigned:

  1. FE80::02B5:32FF:FE01:1984 (Link-Local address)
  2. 2001:718:10:1:02B5:32FF:FE01:1984 (Global Unicast address)
  3. 2001:: 02B5:32FF:FE01:1984 (Global Unicast address)

The computer has to send data to the address 2001:718:20:56:E859:A1FF:FE82:AA01 and needs to select the most suitable source address. The default policy table is used during the address selection. The precedence value of 40 and label value of 1 are assigned to all addresses.

Link-Local address is not selected because of rule 2. Its scope is smaller than the global scope of the target node. The most suitable source address is selected using rule 8. The second address is selected as source address because it has the same longest matching prefix 2001:718::/32 as the target node.

Destination address selection is based on the candidate list which the DNS server sent in response to a request for translating a domain name. Candidate list contains the following addresses:

  1. 2001:DB8:A29C:5::02 (source address 2001:: 02B5:32FF:FE01:1984)
  2. 2001:718::B5:18FF:FE09:1 (source address 2001:718:10:1:02B5:32FF:FE01:1984)

The list also contains a suitable source addresses that are selected based on the source address selection algorithm. The precedence value of 40 and label value of 1 are assigned to both addresses. The algorithm decides on the basis of rule 8 when the second address has the same longest matching prefix 2001:718::/32 as the target node. The candidate list for the destination address is sorted as follows:

  1. 2001:718::B5:18FF:FE09:1
  2. 2001:DB8:A29C:5::02

Then address 2001:718:10:1:02B5:32FF:FE01:1984 is selected as the source address and address 2001:718::B5:18FF:FE09:1 is selected as the destination address for the connection.