Loading learning content...
At the absolute core of the Domain Name System lies a simple but profound capability: translating human-readable domain names into machine-routable IP addresses. This fundamental translation—the raison d'être of DNS—is accomplished through two critical resource record types: A records for IPv4 addresses and AAAA records for IPv6 addresses.
Every time you type a URL into a browser, every API call your application makes, every email your server attempts to deliver—all of these operations begin with an address record lookup. Without A and AAAA records, the elegant abstraction of domain names would collapse, forcing users to memorize 32-bit or 128-bit numerical addresses.
This page provides exhaustive coverage of these foundational record types, examining their internal structure, wire format, resolution behavior, caching semantics, and real-world deployment patterns. You will emerge with Principal Engineer-level understanding of how the Internet's address resolution backbone operates.
By the end of this page, you will understand: (1) The complete internal structure and wire format of A and AAAA records, (2) How resolvers process address queries through the DNS hierarchy, (3) TTL mechanics and caching implications, (4) Multi-address configurations for load balancing and failover, (5) IPv4/IPv6 dual-stack deployment strategies, and (6) Common misconfigurations and debugging techniques.
The A record (Address record) is the original and most fundamental DNS record type, defined in RFC 1035 as part of the initial DNS specification in 1987. Its purpose is singular and essential: map a domain name to an IPv4 address.
An A record establishes a binding between:
192.0.2.1)The abstract relationship can be expressed as:
<owner-name> IN A <ipv4-address>
For example:
www.example.com. IN A 93.184.216.34
This record declares: "When any resolver asks for the IPv4 address of www.example.com, respond with 93.184.216.34."
The designation "A" stands for Address. In the early DNS specification, the naming was intentionally terse—single letters for record types that would appear billions of times in zone files and DNS messages. The A record was type number 1, reflecting its primacy in the DNS type hierarchy.
Before DNS (pre-1983), hostname-to-address mappings were maintained in a single file called HOSTS.TXT, distributed to all internet hosts. By the early 1980s, this approach became unscalable—the file grew too large and changes propagated too slowly. The A record was designed as the authoritative replacement within the new distributed DNS architecture.
Understanding the wire format is essential for debugging packet captures and comprehending DNS at a systems level. In DNS messages, an A record appears in the answer section with the following structure:
| Field | Size | Description |
|---|---|---|
| NAME | Variable | Domain name (compressed or uncompressed) |
| TYPE | 2 bytes | Record type = 1 (A record) |
| CLASS | 2 bytes | Class = 1 (IN = Internet) |
| TTL | 4 bytes | Time-to-live in seconds |
| RDLENGTH | 2 bytes | Length of RDATA = 4 (bytes) |
| RDATA | 4 bytes | IPv4 address in network byte order |
The RDATA section for an A record is exactly 4 bytes, representing the 32-bit IPv4 address. For the address 93.184.216.34, the RDATA bytes would be:
0x5D 0xB8 0xD8 0x22 (93.184.216.34 in hex)
Each octet of the dotted-decimal address occupies one byte in network byte order (big-endian).
| Decimal Octet | Hexadecimal | Binary |
|---|---|---|
| 93 | 0x5D | 01011101 |
| 184 | 0xB8 | 10111000 |
| 216 | 0xD8 | 11011000 |
| 34 | 0x22 | 00100010 |
The AAAA record (pronounced "quad-A") extends address resolution to the IPv6 address family. Defined in RFC 3596 (2003), the AAAA record performs the same function as the A record but for 128-bit IPv6 addresses instead of 32-bit IPv4 addresses.
The name "AAAA" reflects the size relationship between IPv4 and IPv6 addresses:
This naming convention, while somewhat playful, created an instantly memorable designation that clearly signals the IPv6 context.
An AAAA record establishes a binding between:
The abstract relationship:
<owner-name> IN AAAA <ipv6-address>
For example:
www.example.com. IN AAAA 2606:2800:220:1:248:1893:25c8:1946
This record declares: "When any resolver asks for the IPv6 address of www.example.com, respond with 2606:2800:220:1:248:1893:25c8:1946."
The AAAA record follows the same general structure as the A record, with the critical difference being the RDATA length:
| Field | Size | Description |
|---|---|---|
| NAME | Variable | Domain name (compressed or uncompressed) |
| TYPE | 2 bytes | Record type = 28 (AAAA record) |
| CLASS | 2 bytes | Class = 1 (IN = Internet) |
| TTL | 4 bytes | Time-to-live in seconds |
| RDLENGTH | 2 bytes | Length of RDATA = 16 (bytes) |
| RDATA | 16 bytes | IPv6 address in network byte order |
The RDATA section contains exactly 16 bytes representing the 128-bit IPv6 address. For the address 2001:0db8:85a3:0000:0000:8a2e:0370:7334, the bytes are:
20 01 0D B8 85 A3 00 00 00 00 8A 2E 03 70 73 34
Each 16-bit group in the IPv6 address corresponds to 2 bytes in the RDATA.
While IPv6 addresses can use compression (replacing consecutive zero groups with ::) in zone files, the wire format always contains the full 16 bytes. When you see 2001:db8::1 in a zone file, it expands to 2001:0db8:0000:0000:0000:0000:0000:0001 on the wire. Zone file parsers handle this expansion automatically.
| Attribute | A Record | AAAA Record |
|---|---|---|
| RFC Specification | RFC 1035 (1987) | RFC 3596 (2003) |
| Type Number | 1 | 28 |
| Address Family | IPv4 | IPv6 |
| Address Size | 32 bits (4 bytes) | 128 bits (16 bytes) |
| Address Notation | Dotted-decimal | Colon-hexadecimal |
| Example Address | 192.0.2.1 | 2001:db8::1 |
| Theoretical Address Space | ~4.3 billion | ~340 undecillion |
| RDATA Length (RDLENGTH) | 4 | 16 |
Understanding how A/AAAA queries traverse the DNS hierarchy is essential for debugging resolution failures, optimizing performance, and designing resilient infrastructure.
When an application needs to resolve www.example.com to an IP address, the following sequence unfolds:
Step 1: Application Initiates Resolution
The application calls a resolver function (e.g., getaddrinfo() on POSIX systems, Dns.GetHostEntry() in .NET). This system call creates a resolution request.
Step 2: Stub Resolver Check
The operating system's stub resolver first checks:
/etc/hosts on Unix, C:\Windows\System32\drivers\etc\hosts on Windows)If found, resolution completes immediately without network traffic.
Step 3: Query to Recursive Resolver
If not cached locally, the stub resolver sends a query to its configured recursive resolver (typically provided by DHCP from the ISP, or explicitly configured like Google's 8.8.8.8 or Cloudflare's 1.1.1.1).
The DNS query message contains:
www.example.comStep 4: Recursive Resolver Processes Query
The recursive resolver checks its own cache. If a valid (non-expired) answer exists, it returns immediately. Otherwise, it begins iterative resolution through the DNS hierarchy.
When the recursive resolver must perform full resolution:
1. Root Server Query
The resolver queries a root server (e.g., a.root-servers.net) for www.example.com. The root server doesn't know the answer but returns a referral to the .com TLD servers, including their NS records and glue A/AAAA records.
2. TLD Server Query
The resolver follows the referral and queries a .com TLD server. This server returns another referral to example.com's authoritative nameservers.
3. Authoritative Server Query
Finally, the resolver queries example.com's authoritative nameserver, which returns the actual A record with the IP address.
4. Response Delivery
The recursive resolver caches the response (respecting TTL), then returns it to the stub resolver, which caches it locally and delivers it to the application.
| Flag | Meaning | A/AAAA Relevance |
|---|---|---|
| RD (Recursion Desired) | Client wants resolver to perform full resolution | Stub resolvers always set this |
| RA (Recursion Available) | Server can perform recursive queries | Recursive resolvers set this |
| AA (Authoritative Answer) | Response is from authoritative source | Confirms authenticity of A/AAAA data |
| TC (Truncated) | Response exceeded 512 bytes (UDP) | Rare for simple A/AAAA queries |
| AD (Authenticated Data) | DNSSEC validation succeeded | Critical for secure resolution |
The Time-To-Live (TTL) field in A and AAAA records is fundamental to DNS's distributed caching architecture. Proper TTL configuration directly impacts resolution latency, server load, failover speed, and propagation timing during infrastructure changes.
The TTL is a 32-bit unsigned integer representing the maximum number of seconds a record should be cached before re-querying the authoritative source. The value ranges from:
When a resolver caches an A/AAAA record:
Importantly, when a resolver returns a cached response to a client, it includes the remaining TTL, not the original TTL. This creates a cascading countdown across all caching layers.
| TTL Value | Use Case | Trade-offs |
|---|---|---|
| 60–300 seconds | Dynamic infrastructure, rapid failover needed | Higher authoritative server load, lower cache efficiency |
| 300–900 seconds | Standard websites, balanced approach | Reasonable failover time, moderate server load |
| 3600 seconds (1 hour) | Stable infrastructure, performance priority | Good cache efficiency, slower failover |
| 86400 seconds (24 hours) | Static sites, maximum cache efficiency | Very slow propagation, minimal server load |
| 0 seconds | Testing only, never cache | Maximum server load, instant propagation |
A common misconception is that DNS changes 'take 24-48 hours to propagate.' In reality, changes propagate immediately to resolvers that query fresh. The delay occurs because existing cached copies persist until their TTL expires. If you're planning infrastructure changes, lower your TTL well in advance (e.g., to 300 seconds), wait for the old TTL to expire, make changes, then restore normal TTL afterward.
A/AAAA records traverse multiple caching layers, each respecting TTL:
Layer 1: Browser Cache Modern browsers cache DNS responses internally for performance. Chrome, Firefox, and Safari each maintain their own resolver caches, typically respecting TTL but sometimes imposing minimum cache durations.
Layer 2: Operating System Cache The OS stub resolver maintains a system-wide DNS cache:
ipconfig /displaydns)mDNSResponder (sudo killall -HUP mDNSResponder to flush)Layer 3: Recursive Resolver Cache The configured DNS resolver (ISP's resolver, Google DNS, Cloudflare, etc.) maintains massive caches serving millions of users. A single cached A record can eliminate millions of authoritative queries.
Layer 4: Authoritative Server Cache Even authoritative servers may cache data from backend databases or upstream systems.
When a domain doesn't exist, the authoritative server returns an NXDOMAIN response. This negative result is also cached, with TTL taken from the SOA record's minimum TTL field. This prevents repeated queries for non-existent domains but can delay detection of newly created records.
A single domain name can have multiple A records (and multiple AAAA records), enabling primitive but effective load distribution and failover capabilities directly within DNS.
Zone file example with multiple addresses:
www.example.com. 300 IN A 93.184.216.34
www.example.com. 300 IN A 93.184.216.35
www.example.com. 300 IN A 93.184.216.36
www.example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
www.example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1947
When a resolver queries for www.example.com, the authoritative server returns all matching records in the answer section. The resolver (and ultimately the application) receives the complete set.
Traditionally, DNS servers rotate the order of multiple A/AAAA records in each response—a technique called round-robin DNS:
[A, B, C][B, C, A][C, A, B]Since applications typically use the first address returned, this creates naive load distribution across servers. However, this is not true load balancing:
How do clients choose among multiple addresses? The behavior varies:
RFC 6724: Default Address Selection for IPv6
This RFC defines a sophisticated algorithm for selecting among multiple addresses, considering:
Happy Eyeballs (RFC 8305)
Modern clients implement "Happy Eyeballs" for dual-stack environments:
This algorithm ensures users get the fastest connection while preferring IPv6 when both protocols work.
For production systems requiring true load balancing, organizations typically layer additional intelligence:
Major cloud providers (AWS Route 53, Google Cloud DNS, Cloudflare) offer these capabilities as managed services.
Deploying both A and AAAA records for the same domain—dual-stack DNS—is the recommended approach for modern Internet services. This enables seamless connectivity for both IPv4-only and IPv6-capable clients while supporting the gradual transition to IPv6.
IPv6 adoption continues growing:
Domains without AAAA records are inaccessible from IPv6-only networks. Conversely, domains without A records are inaccessible from IPv4-only networks (still common in corporate environments and legacy infrastructure).
A properly configured dual-stack zone includes both record types:
; Dual-stack configuration for www.example.com
www.example.com. 300 IN A 93.184.216.34
www.example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
; Multiple addresses for redundancy
www.example.com. 300 IN A 93.184.216.35
www.example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1947
When an application requests resolution in a dual-stack environment:
Maintain identical TTLs for A and AAAA records of the same name. Inconsistent TTLs can cause confusing behavior where one protocol's addresses are fresh while the other's are stale. This is especially problematic during infrastructure changes when you're rolling new IP addresses.
Unlike IPv4, where address scarcity drove complex allocation, IPv6 provides abundant addressing. Organizations typically receive a /48 or /32 allocation, offering trillions of addresses.
Best Practices for IPv6 Address Assignment:
2001:db8::1 is easier to remember than a random EUI-64 addressCommon dual-stack problems and their symptoms:
| Symptom | Possible Cause | Resolution |
|---|---|---|
| Connection timeouts on some networks | Broken IPv6 path | Verify IPv6 connectivity, check firewall rules |
| Slow initial connections | Happy Eyeballs delay with broken IPv6 | Fix IPv6 or remove AAAA records temporarily |
| Inconsistent behavior | Stale cache with old addresses | Wait for TTL expiration, flush caches |
| Works locally, fails remotely | Missing AAAA in public DNS | Verify both record types are published |
| IPv6 clients can't connect | IPv6 address unreachable | Check routing, firewalls, perform traceroute6 |
A and AAAA records, as the fundamental building blocks of name-to-address mapping, are prime targets for various attacks. Understanding these vulnerabilities is essential for defensive configuration.
Attack Vector: An attacker injects fraudulent A/AAAA records into resolver caches, causing victims to connect to attacker-controlled servers.
Mechanism:
Defense: DNSSEC (DNS Security Extensions) provides cryptographic authentication of DNS responses, preventing acceptance of forged records. DNSSEC-validating resolvers reject unsigned or improperly signed A/AAAA records for signed zones.
In 2008, Dan Kaminsky disclosed a devastating cache poisoning technique that exploited predictable UDP source ports and transaction IDs. Modern resolvers implement randomized ports and IDs, and many use DNS over TLS/HTTPS, but DNSSEC remains the definitive solution for A/AAAA record authenticity.
When DNSSEC is enabled for a zone, A and AAAA records are accompanied by RRSIG (Resource Record Signature) records:
www.example.com. 300 IN A 93.184.216.34
www.example.com. 300 IN RRSIG A 13 3 300 20240101000000 20231201000000 12345 example.com. ABC123...
The RRSIG contains:
Validating resolvers verify this signature against the zone's DNSKEY records, which are themselves authenticated via a chain of trust to the root zone.
1. Minimal Exposure
2. Monitoring
3. Access Control
4. Registry Lock
We've conducted a comprehensive deep-dive into A and AAAA records—the fundamental building blocks that enable the Internet's human-readable naming system. Let's consolidate the essential knowledge:
You now possess Principal Engineer-level understanding of A and AAAA records—from wire format to resolution mechanics, caching semantics to security considerations. In the next page, we'll explore MX records, which extend DNS's functionality to enable email routing across the Internet.