Address selection, privacy and stable addresses
Apply the RFC 6724 source and destination address selection rules, including the policy table. Explain temporary addresses (RFC 8981) and calculate their lifetimes and regeneration timing. Compare EUI-64, stable opaque (RFC 7217) and temporary interface identifiers against the threats in RFC 7721. Inspect and change address generation and selection on Linux and Windows.
Take the quiz · pass mark 70% · 10 questions
Explanation
An IPv6 host normally has several addresses on one interface: a link-local address, one or more stable global addresses, temporary addresses, maybe a ULA. Every time an application opens a connection, the operating system must choose a destination (when DNS returns several) and a source. This lesson explains how those choices are made, and how the interface identifiers themselves are generated.
Interface identifier methods
| Method | How the IID is formed | Stable? | Main privacy problem |
|---|---|---|---|
| Modified EUI-64 (L1.06) | From the MAC address | Same on every network | Tracks the device everywhere; reveals the vendor |
| Stable opaque (RFC 7217) | Hash of prefix, interface, optional network ID, DAD counter and a secret key | Stable on one network, different on each prefix | None for tracking across networks |
| Temporary (RFC 8981) | Random, regenerated regularly | Changes about daily | None, but makes logging harder |
| Manual / static | Chosen by the administrator | Yes | Easy to guess (::1, ::25) |
RFC 7721 lists the threats an IID can enable: correlation of activities over time, location tracking across networks, address scanning (guessing addresses in a /64), and device-specific exploitation (an EUI-64 IID reveals the vendor). RFC 8064 therefore recommends that nodes not use EUI-64 for stable addresses by default, and use RFC 7217 instead.
The RFC 7217 identifier is:
RID = F(Prefix, Net_Iface, Network_ID, DAD_Counter, secret_key)
F is a pseudorandom function such as SHA-256, and the IID is taken from its output. The address stays the same when the host returns to the same network (good for logs and firewall rules), but differs per prefix, so it cannot be followed between networks. If DAD fails, DAD_Counter is increased and a new IID is generated.
Temporary addresses (RFC 8981)
RFC 8981 replaces the original privacy extensions specification. A host forms a temporary address for each prefix with A=1, in addition to its stable address, and uses it for outgoing connections:
- TEMP_VALID_LIFETIME: 2 days by default.
- TEMP_PREFERRED_LIFETIME: 1 day by default.
- Each temporary address's preferred lifetime is shortened by a random DESYNC_FACTOR (0 to MAX_DESYNC_FACTOR = 0.4 × TEMP_PREFERRED_LIFETIME), so hosts do not all change at the same moment.
- A new temporary address is generated REGEN_ADVANCE seconds before the current one is deprecated: REGEN_ADVANCE = 2 + (TEMP_IDGEN_RETRIES × DupAddrDetectTransmits × RetransTimer / 1000) = 5 s with defaults.
- Temporary lifetimes never exceed the prefix's own lifetimes from the RA.
- With defaults, at most about three temporary addresses exist per prefix at once: one preferred and up to two deprecated ones that still carry old connections.
Platform defaults differ and are version-dependent:
- Linux kernel:
use_tempaddris 0 (off) by default. 1 creates temporary addresses but prefers public ones, 2 creates and prefers them.temp_prefered_lftis 86,400 andtemp_valid_lft172,800, butmax_desync_factordefaults to 600 s, much less than RFC 8981's 0.4 × 1 day. NetworkManager (ipv6.ip6-privacy) and systemd-networkd (IPv6PrivacyExtensions=) can override the kernel setting, and distributions ship different defaults. - Windows enables temporary addresses by default (
Get-NetIPv6ProtocolshowsUseTemporaryAddresses) and uses randomised rather than EUI-64 IIDs for its stable addresses (RandomizeIdentifiers). - macOS and iOS use temporary addresses by default, and recent releases do not use EUI-64 for global addresses. Check
ifconfigoutput on your version.
On Linux, ip -6 addr marks temporary addresses temporary and the stable address that spawns them mngtmpaddr. For RFC 7217 addresses, set addr_gen_mode to 2 (with stable_secret) or 3 (random secret), or use NetworkManager's ipv6.addr-gen-mode stable-privacy (its default) or systemd-networkd's IPv6LinkLocalAddressGenerationMode=stable-privacy and Token=prefixstable.
Source address selection (RFC 6724)
For a destination D, the host compares candidate source addresses pairwise with these rules, in order, stopping at the first rule that decides:
- Rule 1: Prefer the same address (if D is one of the host's addresses).
- Rule 2: Prefer appropriate scope: a source with the same or larger scope than D. A link-local source is never used for a global destination.
- Rule 3: Avoid deprecated addresses.
- Rule 4: Prefer home addresses (Mobile IPv6).
- Rule 5: Prefer the outgoing interface.
- Rule 5.5: Prefer addresses in a prefix advertised by the chosen next hop (RFC 8028): with two routers advertising two prefixes, use the source that matches the router you send through, so upstream source filters (BCP 38) do not drop the packet.
- Rule 6: Prefer matching label (from the policy table below).
- Rule 7: Prefer temporary addresses. Implementations must let applications reverse this, and may reverse the default.
- Rule 8: Use the longest matching prefix. CommonPrefixLen(S, D) is the number of leading bits S and D share, up to S's prefix length (normally 64).
Destination address selection
When DNS returns several addresses, the host sorts them (rules in RFC 6724 section 6). The important ones are: avoid unusable destinations (no route or no source), prefer matching scope, avoid deprecated sources, prefer matching label, prefer higher precedence, prefer native transport, prefer smaller scope, and use the longest matching prefix. Happy Eyeballs (L1.08) then races connections in roughly that order.
The policy table
| Prefix | Precedence | Label |
|---|---|---|
::1/128 | 50 | 0 |
::/0 | 40 | 1 |
::ffff:0:0/96 (IPv4) | 35 | 4 |
2002::/16 (6to4) | 30 | 2 |
2001::/32 (Teredo) | 5 | 5 |
fc00::/7 (ULA) | 3 | 13 |
::/96 | 1 | 3 |
fec0::/10 | 1 | 11 |
3ffe::/16 | 1 | 12 |
Two consequences:
- Global IPv6 beats IPv4 (precedence 40 against 35), which is why dual-stack hosts try IPv6 first.
- IPv4 beats ULA (35 against 3). If a name has a ULA AAAA record and an A record, hosts prefer IPv4. RFC 6724 suggests implementations may add a higher-precedence row for the host's own ULA /48, but many do not, so test it. Label matching also means a ULA source is not chosen for a global destination.
You can view and change the table: ip addrlabel on Linux (labels only; glibc reads precedence from /etc/gai.conf), and Get-NetPrefixPolicy or netsh interface ipv6 show prefixpolicies on Windows.
Drawing diagram…
Worked examples
Example 1: CommonPrefixLen
Source 2001:db8:3000:10::25, destination 2001:db8:3800::1. The first two groups match (32 bits). In the third group, 3000 is 0011 0000 ... and 3800 is 0011 1000 ..., so 4 more bits match. CommonPrefixLen = 36. For destination 2001:db8:3000:10::80, the whole /64 matches and the count stops at the source's prefix length: 64.
Example 2: Temporary address lifetimes
A Linux host uses defaults (temp_prefered_lft 86,400, temp_valid_lft 172,800) and draws DESYNC_FACTOR = 600 s. The RA advertises the default 30-day valid and 7-day preferred lifetimes. The temporary address gets a preferred lifetime of 86,400 − 600 = 85,800 s and a valid lifetime of 172,800 s. A new one is created REGEN_ADVANCE (5 s) before 85,800 s.
If the RA instead advertises a preferred lifetime of 14,400 s (as in the L3.02 radvd example), the temporary preferred lifetime is capped at 14,400 s.
Example 3: RFC 8981 maximum desync
With TEMP_PREFERRED_LIFETIME = 1 day = 86,400 s, MAX_DESYNC_FACTOR = 0.4 × 86,400 = 34,560 s (9.6 hours).
Example 4: ULA versus IPv4
A host has fdf1:a861:26b6:10::25 and 192.0.2.25, and no global IPv6. ns.lab.example has AAAA fdf1:a861:26b6:f00::53 and A 192.0.2.53. With the default policy table the host prefers IPv4 (precedence 35 against 3).
Example 5: Rule 5.5 in a multihomed LAN
A small office has two upstreams. Router A advertises 2001:db8:3000:10::/64 from the first provider, router B advertises 2001:db8:1100:1201::/64 from a second provider's delegation, and both are default routers. When the host sends through B, Rule 5.5 (RFC 8028) makes it choose its 2001:db8:1100:1201:: source. A host without RFC 8028 may send 2001:db8:3000:10:: sources through B, and the second provider's ingress filters (BCP 38) drop them.
Lab
Goal: Observe address generation and source selection, then change them.
You need: The L3.02 namespace LAN with radvd, curl, tcpdump. Optional: a Windows VM on the same LAN and a web server on the simulated Internet (2001:db8:f000::80).
Step 1: Address generation
In h1, set addr_gen_mode to 0, bring the interface down and up, and record the addresses. Repeat with addr_gen_mode=3. Change the advertised prefix in radvd to 2001:db8:3000:11::/64 and show that the RFC 7217 IID differs between prefixes, while EUI-64 does not.
Step 2: Temporary addresses
Set use_tempaddr=2, set temp_prefered_lft=120 and temp_valid_lft=300 to speed things up, and watch ip -6 addr for 10 minutes. Record how many temporary addresses exist at once and when new ones appear.
Step 3: Source selection
ip -n h1 -6 route get 2001:db8:f000::80
ip -n h1 -6 route get 2001:db8:3000:10::80
Record the chosen src in each case, with use_tempaddr=1 and =2, and explain which rule decided. Confirm with a capture while running curl -6.
Step 4: Policy table
Add fdf1:a861:26b6:10::/64 from a second router and create a name with both a ULA AAAA and an A record (in /etc/hosts for the test). Show which address getent ahosts lists first. Then edit /etc/gai.conf: uncomment the default precedence lines (any precedence line replaces glibc's whole built-in table, so copy all of them), add precedence fdf1:a861:26b6::/48 45, and repeat.
Step 5: Windows (optional)
Record Get-NetIPv6Protocol, Get-NetIPAddress -AddressFamily IPv6 (look at SuffixOrigin: Link for a SLAAC-derived identifier, Random for randomised and temporary ones) and Get-NetPrefixPolicy.
What to submit
Outputs for each step with the rule or setting that explains them, and the OS versions used.
Summary
- RFC 7721 threats: correlation, location tracking, address scanning, device-specific exploitation. RFC 8064 recommends RFC 7217 stable opaque IIDs instead of EUI-64.
- RFC 8981 temporary addresses: 1 day preferred, 2 days valid, DESYNC_FACTOR up to 0.4 × preferred, regenerated REGEN_ADVANCE (5 s) early. Linux leaves them off by default; Windows and macOS enable them.
- RFC 6724 source rules: same address, scope, not deprecated, outgoing interface, next hop's prefix (5.5), label, temporary, longest match (up to 64 bits).
- Policy table precedence: IPv6 global 40, IPv4 35, ULA 3, so IPv4 beats ULA by default.
- Next lesson (L3.05): multicast on the LAN and MLD.
Quiz imported · 10 questions · pass mark 70%. Lab questions are not auto-marked.