Default Address Selection for IPv6
A version of this page is also available for
4/8/2010
In dual stack systems, such as Windows CE .NET 4.1 and later, the DNS name resolution may yield both IPv4 and IPv6 addresses. Algorithms are used to determine source and destination addresses of appropriate scope and configuration status, thus determining which stack (IPv4 or IPv6) to use. IPv6 addresses are created in conformance to the Internet Draft named "Default Address Selection for IPv6" (draftietf-ipngwg-default-addr-select-07.txt).
The following list shows the algorithms that describe the behavior for all IPv6 implementations:
- Source address selection algorithm
- Destination address selection algorithm
You should use this default address selection policy during normal IPv6 operation. By using these algorithms, you can predict the behavior of your system. They do not override a legal destination or source address made by applications, by upper layer protocols, or by more advanced mechanisms.
For example, using getaddrinfo may result in a list that has IPv4 and IPv6 addresses to your application. If no source address was specified by the application or by the upper layer protocol, getaddrinfo uses the destination address selection algorithm that considers both IPv4 and IPv6 addresses. The type of address that is chosen depends on the available source addresses. An application should iterate through the list of addresses returned from getaddrinfo until it finds a working address.
IPv6 interfaces can have multiple unicast addresses that have different reachability scopes. For example, a node may have a link-local address, and a tunneling address. The configuration status of each address can be preferred or deprecated. The algorithms use several criteria in determining their outcomes, and prefer destination/source address pairs.
An administrator can configure a policy that can override the default behavior of the algorithms. The policy override is a configurable table, named the policy table, that specifies precedence values and preferred source prefixes for destination prefixes.
The algorithms and prefix table are described in the following subsections.
Source Address Selection Algorithm
The following list shows the algorithm preferences when determining a source address:
- Prefer the same address type
- Prefer the same address scope
- Prefer nondeprecated addresses
- Prefer home addresses over care-of addresses
- Prefer outgoing interfaces
- Prefer matching label
- Prefer public addresses over temporary addresses
- Use longest matching prefix
Destination Address Selection Algorithm
The destination address selection algorithm operates on both IPv6 and IPv4 addresses. The following list shows the algorithm preferences when determining a destination address:
- Prefer matching scope
- Prefer nondeprecated addresses
- Prefer home addresses over care-of addresses
- Prefer matching label
- Prefer higher precedence
- Prefer native transport
- Prefer smaller scope
- Use longest matching prefix
- Otherwise, leave order unchanged
- Avoid unusable destinations
Policy Table
The default policy table is used when an implementation has not been configured. The following list shows the policy table preferences:
- Prefer using IPv6 addresses when available.
- Prefer source and destination addresses that have the same scope (link-local or global).
- Prefer source and destination addresses that are the same address types. For example, native and 6to4.
The policy table matches prefixes, listing the longest match, similar to a routing table. The following table shows the 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 |
The precedence value is used to sort destination address. If Precedence (A) is greater than Precedence (B), then the algorithm prefers destination address A over address B.
A label value allows policies that prefer a particular source address prefix for use with a destination address prefix. For example, if Label (S) = Label (D), the algorithm prefers source address S and destination address D.
You can override the default policy table by using IPv6.exe. For more information, see Internet Protocol Version 6.
For more information about the address selection algorithms and the prefix table, see Internet Draft named "Default Address Selection for IPv6" (draftietf-ipngwg-default-addr-select-07.txt).
See Also
Concepts
Assigning an IPv6 Address to a Device
IPv6 Addressing
Methods for Configuring IPv6 Addresses