How Does DNS Caching Work with IPv6?

Introduction

DNS caching is a critical performance optimization mechanism that stores Domain Name System query results temporarily to reduce latency and network overhead. While the fundamental principles of DNS caching remain consistent between IPv4 and IPv6, the dual-protocol nature of modern networks introduces unique behaviors, challenges, and considerations that network administrators and developers must understand.

As organizations transition to IPv6, DNS caching takes on new complexity: resolvers must now cache both IPv4 A records and IPv6 AAAA records, browsers make dual-stack decisions based on cached results, and Time-to-Live (TTL) mismatches between record types can create subtle connectivity issues. Understanding how DNS caching operates in an IPv6 context is essential for troubleshooting connectivity problems, optimizing network performance, and ensuring security.

This comprehensive guide explores DNS caching behavior with IPv6, covering fundamental concepts, multi-layer cache architectures, TTL considerations, performance implications, security vulnerabilities, and practical troubleshooting strategies.

DNS Cache Fundamentals

What is DNS Caching?

DNS caching is the temporary storage of DNS query results at various points in the resolution chain. When a DNS resolver receives a query result, it stores that information for a specified duration (determined by the TTL value) to avoid repeated queries for the same hostname. This caching behavior applies to all DNS record types, including:

For IPv6 connectivity, AAAA records are the critical component. When a client queries a domain name, modern resolvers typically request both A and AAAA records—either simultaneously or with AAAA queries prioritized—to support dual-stack operation.

Why DNS Caching Matters

DNS caching provides three primary benefits:

Performance: Eliminates repeated network round-trips to authoritative nameservers, reducing connection establishment latency from hundreds of milliseconds to near-zero for cached entries.

Scalability: Dramatically reduces load on authoritative DNS servers and upstream recursive resolvers, enabling the DNS infrastructure to handle billions of queries efficiently.

Resilience: Cached results remain available even if authoritative nameservers become temporarily unreachable, providing continuity during network disruptions.

Without caching, every HTTP request, API call, and network connection would require fresh DNS resolution, creating massive overhead and making the internet infrastructure unsustainable at current scale.

Multi-Layer DNS Cache Architecture

DNS caching operates at multiple layers in the resolution chain, each with distinct characteristics and behaviors:

Layer 1: Browser DNS Cache

Modern web browsers maintain their own DNS cache independent of the operating system. Browsers cache DNS results to optimize page loading performance and reduce dependency on external resolvers.

Browser-specific behavior:

IPv6 considerations: Browsers with internal caches store A and AAAA records separately but typically query for both record types simultaneously. Chrome's resolver includes heuristics to detect IPv4-only networks by attempting UDP connections to Google Public DNS IPv6 addresses (2001:4860:4860::8888). If this probe fails, Chrome may suppress AAAA queries to improve performance on IPv4-only networks.

Typical cache duration: Browser caches often use shorter TTLs than authoritative records specify, typically capping entries at 60 seconds regardless of the authoritative TTL value.

Layer 2: Operating System DNS Cache

The operating system maintains a DNS cache for all applications, managed by the system's stub resolver or DNS client service.

Platform-specific implementation:

The OS cache handles all DNS queries from applications that don't implement their own resolution logic. When an application requests name resolution via system APIs (getaddrinfo() on Unix-like systems, GetAddrInfo() on Windows), the OS resolver checks its cache before forwarding queries to configured DNS servers.

IPv6 query behavior: Modern operating systems request AAAA records even when the device lacks a globally routable IPv6 address. Windows Vista and later prioritize AAAA lookups before A lookups when IPv6 is enabled. If the AAAA query returns NOERROR with an empty answer section (indicating no IPv6 address exists), the system proceeds with IPv4 resolution. This dual-query behavior means both record types may be cached independently.

Important note: Browser and OS caches are separate. Flushing the OS DNS cache does not affect browser-cached entries, requiring separate cache clearing procedures for complete DNS reset.

Layer 3: Recursive Resolver Cache

Recursive DNS resolvers (operated by ISPs, Google Public DNS, Cloudflare DNS, etc.) maintain extensive caches serving thousands or millions of clients. This shared caching layer provides the most significant performance and scalability benefits.

Recursive resolver operation:

  1. Receives query from client
  2. Checks local cache for existing record
  3. If cached and TTL not expired, returns result immediately
  4. If not cached, performs iterative resolution from root servers down to authoritative nameserver
  5. Caches result according to TTL before returning to client

Cache sharing benefits: Recursive resolvers that serve large user populations achieve high cache hit rates because popular domains are frequently queried. This shared caching means the first user to query a domain performs full resolution, while subsequent users receive instant cached responses until TTL expiration.

IPv6-specific caching: Recursive resolvers cache A and AAAA records independently, each with their own TTL values. This separation can create scenarios where one record type expires while the other remains cached, potentially causing dual-stack connectivity issues.

Layer 4: CDN and Authoritative DNS Caching

Content Delivery Networks (CDNs) and authoritative nameservers implement geographic and network-aware DNS routing, often using extremely short TTLs to enable dynamic traffic steering.

EDNS0 Client Subnet (RFC 7871): Modern recursive resolvers include client network information in DNS queries using the EDNS0 Client Subnet extension. This allows authoritative nameservers to return geographically optimized IP addresses based on the client's location rather than the resolver's location.

IPv6 subnet aggregation: RFC 7871 recommends aggregating users by /24 for IPv4 and /56 for IPv6. This means CDN authoritative servers can make routing decisions based on the first 56 bits of the client's IPv6 address, balancing privacy with geographic optimization.

Separate cache entries: Recursive resolvers maintain separate cache entries for different client subnets, ensuring users in different geographic regions receive optimized responses even when querying the same domain.

Separate Caching for A vs AAAA Records

One of the most critical aspects of DNS caching in dual-stack environments is that A records (IPv4) and AAAA records (IPv6) are cached completely independently.

Independent Record Storage

When a resolver performs DNS resolution for a domain, it may receive:

Each record type is stored separately in the cache with its own TTL, metadata, and expiration timestamp. This independence is crucial for protocol flexibility but creates potential synchronization challenges.

TTL Mismatch Scenarios

Authoritative nameservers can (and often do) assign different TTL values to A and AAAA records for the same hostname. This creates scenarios where one record type expires before the other:

Scenario 1: AAAA record expires first

Scenario 2: A record expires first

Operational Impact

This TTL asynchrony has several practical implications:

Broken IPv6 detection: If a domain's AAAA record points to a non-functional IPv6 address, the broken configuration persists in caches for the full TTL duration. Meanwhile, if the A record has a shorter TTL and is updated to a working fallback server, IPv6-capable clients continue attempting the broken IPv6 connection while IPv4-only clients successfully use the updated IPv4 address.

Split-brain connectivity: During TTL skew windows, different clients may receive different combinations of A and AAAA records, creating inconsistent connectivity behavior across a network.

Cache timing attacks: Adversaries can potentially infer user behavior by observing which record types are cached and when they expire, though this represents a relatively minor privacy risk.

Best Practices for TTL Management

To minimize issues from separate A/AAAA caching:

Synchronize TTL values: Configure identical TTL values for A and AAAA records of the same hostname. This ensures both records expire simultaneously, preventing split-brain scenarios.

Validate before changing: Before modifying DNS records, reduce TTLs for both A and AAAA records to minimum values (60-300 seconds) for at least one full previous TTL period. This ensures all caches refresh before the change takes effect.

Monitor dual-stack functionality: Regularly test both IPv4 and IPv6 connectivity to detect misconfigurations. Tools like test-ipv6.run provide comprehensive dual-stack testing to verify both protocols function correctly.

Time-to-Live (TTL) Handling in IPv6

TTL Basics

The TTL field in DNS records specifies how many seconds a resolver should cache the record before re-querying the authoritative nameserver. TTL values are set by the authoritative DNS server and returned with each query response.

Common TTL values:

IPv6 TTL Patterns

Research into production DNS traffic reveals that AAAA records are slightly longer-lived than A records on average, though the distributions are remarkably similar. This likely reflects the perception that IPv6 infrastructure changes less frequently than IPv4 during dual-stack deployments.

However, best practices recommend configuring A and AAAA records with identical TTLs to avoid synchronization issues:

Recommendation for address records: Set TTL to 1800-3600 seconds (30-60 minutes) for most production services. This balances cache efficiency with reasonable propagation times for emergency updates.

Fast-changing infrastructure: Use 60-300 second TTLs for CDN endpoints, load-balanced services, or failover scenarios requiring rapid traffic redirection.

Emergency changes: When immediate DNS propagation is critical, temporarily reduce TTLs to 30-60 seconds for at least one full previous TTL period before making changes.

TTL Countdown in Caches

Cached records don't store a static timestamp—they implement a countdown mechanism:

  1. Resolver receives DNS response with TTL=3600
  2. Cache stores record with initial TTL=3600
  3. Each second, cache decrements TTL: 3599, 3598, 3597...
  4. When TTL reaches 0, cache marks record as expired
  5. Next query triggers cache purge and fresh resolution

Important: When a recursive resolver returns a cached record to a client, it includes the remaining TTL value, not the original authoritative TTL. If a record was cached 500 seconds ago with TTL=3600, the resolver returns TTL=3100 to the client.

Negative Caching (NXDOMAIN and NOERROR)

DNS caches also store negative responses indicating a record does not exist:

NXDOMAIN: Domain name doesn't exist at all (neither A nor AAAA records) NOERROR with empty answer: Domain exists but the specific record type doesn't (e.g., AAAA query for IPv4-only host)

For IPv6, the NOERROR response is critical. When a resolver queries a domain for an AAAA record and receives NOERROR with no answer section, it caches this negative result. The TTL for negative caching is typically derived from the SOA record's minimum TTL field or specified by the authoritative server.

Operational impact: If a domain initially lacks IPv6 support, negative AAAA responses are cached. Even if the operator subsequently adds AAAA records, clients continue receiving negative cached responses until the negative TTL expires. This can delay IPv6 deployment by hours if SOA minimum TTLs are set too high.

IPv6-Specific DNS Caching Behaviors

Happy Eyeballs and Cache Interaction

RFC 8305 (Happy Eyeballs v2) defines how clients should handle dual-stack connections when both A and AAAA records exist. The algorithm attempts IPv6 connections first but quickly falls back to IPv4 if IPv6 fails or experiences excessive latency.

Caching implications:

DNS Query Ordering

Modern operating systems prioritize AAAA queries when IPv6 is enabled, even when no global IPv6 address is configured. This behavior follows RFC 6724 (Default Address Selection for IPv6).

Query patterns:

  1. Client sends AAAA query to resolver
  2. If AAAA record exists, cache it and proceed with IPv6 connection attempt
  3. If NOERROR (no AAAA), cache negative result
  4. Client sends A query to resolver
  5. Cache A record and proceed with IPv4 connection

Both responses are cached independently, so subsequent queries receive instant cached responses without additional network queries.

Scenario: Problematic Router DNS Servers

Some poorly implemented DNS servers, particularly in consumer routers, crash or return malformed responses when receiving AAAA queries. This occurs when router firmware predates widespread IPv6 adoption and wasn't designed to handle AAAA record types.

Symptoms:

Browser workarounds: Chrome implements heuristic detection for IPv4-only networks by probing connectivity to 2001:4860:4860::8888 (Google Public DNS). If this probe fails, Chrome suppresses AAAA queries to avoid delays from broken routers.

Resolution: Replace outdated router firmware or configure devices to use public DNS resolvers (Google Public DNS, Cloudflare DNS, Quad9) that properly support AAAA queries.

Troubleshooting DNS Cache Issues with IPv6

Symptom: Website loads in one browser but fails in another Likely cause: Browser cache inconsistency; one browser has stale/incorrect cached record

Symptom: IPv6 connection works initially but fails after some time Likely cause: AAAA record updated with new address, but old address still cached

Symptom: IPv4 works but IPv6 consistently fails for specific domain Likely cause: Broken IPv6 configuration with AAAA record pointing to unreachable address

Symptom: DNS resolution extremely slow for all queries Likely cause: Upstream resolver timing out on AAAA queries due to broken IPv6 path

Cache Clearing Procedures

Clear browser DNS cache:

Clear OS DNS cache:

Force fresh resolution: Use command-line tools that bypass caches:

Testing IPv6 Connectivity

The most comprehensive way to verify IPv6 DNS and connectivity is through systematic testing. Visit test-ipv6.run to perform real-time tests including:

These tests run directly in your browser using your current DNS configuration, providing accurate real-world results for troubleshooting cache and connectivity issues.

Scenario: Stale AAAA record causes connection failures

  1. Domain operator updates AAAA record with new IPv6 address
  2. Client's DNS cache still contains old AAAA record (TTL not expired)
  3. Client attempts connection to old IPv6 address, which fails
  4. Workaround: Clear DNS cache or wait for TTL expiration

Scenario: Negative cache prevents IPv6 adoption

  1. Domain initially IPv4-only; clients cache NOERROR for AAAA queries
  2. Operator adds AAAA record to enable IPv6
  3. Clients continue using cached negative AAAA response
  4. IPv6 adoption delayed until negative cache TTL expires
  5. Prevention: Set reasonable SOA minimum TTL (300-3600 seconds)

Scenario: TTL skew creates split-brain connectivity

  1. Domain has A record TTL=300, AAAA record TTL=100
  2. After 100 seconds, AAAA expires; A record remains cached for 200 more seconds
  3. IPv6-capable clients must re-query AAAA (causing latency)
  4. IPv4-only clients use cached A record (fast resolution)
  5. Prevention: Synchronize A and AAAA TTL values

Security Considerations

DNS Cache Poisoning with IPv6

DNS cache poisoning attacks inject forged DNS responses into resolver caches, redirecting traffic to attacker-controlled servers. While cache poisoning fundamentals remain unchanged between IPv4 and IPv6, the dual-protocol nature introduces additional attack surface.

Traditional cache poisoning:

  1. Attacker sends DNS query for target domain to victim resolver
  2. Attacker floods resolver with forged responses containing malicious IP addresses
  3. If forged response arrives before legitimate response, resolver caches malicious record
  4. All clients using that resolver receive poisoned address until TTL expires

Protection mechanisms:

IPv6-Specific Attack Vectors

IPv6 DNS poisoning via mitm6: mitm6 is a penetration testing tool exploiting Windows' default IPv6 behavior. Windows automatically enables IPv6 and accepts Router Advertisements and DHCPv6 messages. mitm6 impersonates a router, causing victim Windows machines to:

  1. Configure attacker's machine as DNS server via DHCPv6
  2. Send all DNS queries to attacker
  3. Receive poisoned DNS responses pointing to attacker-controlled IPv6 addresses
  4. Leak credentials via NTLM authentication to attacker's servers

Mitigation:

AAAA record injection: Attackers with ability to inject DNS responses can add malicious AAAA records to dual-stack domains. Since IPv6 is often less monitored than IPv4 in security infrastructure, attackers may redirect IPv6 traffic to malicious servers while IPv4 traffic remains legitimate.

Mitigation:

DNSSEC and IPv6

DNSSEC (DNS Security Extensions) provides cryptographic validation of DNS responses, preventing cache poisoning by ensuring responses originate from authoritative nameservers and haven't been tampered with.

DNSSEC operation:

  1. Authoritative nameserver signs DNS records with private key
  2. Public key (DNSKEY record) published in DNS
  3. Resolver retrieves record and signature (RRSIG record)
  4. Resolver validates signature using DNSKEY
  5. If validation succeeds, record is cached; if validation fails, query fails

IPv6 considerations: DNSSEC operates identically for A and AAAA records. Both record types receive cryptographic signatures and are validated independently. However, DNSSEC deployment remains limited (approximately 30% of domains as of 2025), meaning many IPv6 deployments lack signature validation.

Recommendation: Enable DNSSEC validation on recursive resolvers (most public DNS providers support it by default) and sign domains with DNSSEC when serving critical services.

Conclusion

DNS caching is fundamental to internet performance and scalability, but the transition to IPv6 introduces new complexity through independent A and AAAA record management, TTL synchronization challenges, and dual-stack decision-making. Understanding how DNS caches operate across browser, OS, recursive resolver, and authoritative server layers is essential for troubleshooting connectivity issues and optimizing network performance.

Key takeaways:

For network operators deploying IPv6, synchronizing A and AAAA record TTLs, setting reasonable expiration times (1800-3600 seconds for stable services), and thoroughly testing dual-stack behavior are critical best practices. For end users experiencing connectivity issues, systematic cache clearing at browser, OS, and potentially resolver levels often resolves mysterious failures.

Test your own IPv6 DNS and connectivity at test-ipv6.run to verify your network handles both protocols correctly, identify broken IPv6 configurations, and ensure optimal performance for modern dual-stack applications.


Further Reading