DNS Architecture and Operations
Overview
Section titled “Overview”DNS infrastructure is the backbone of Internet naming. Beyond the recursive resolution process Covered in the DNS fundamentals document, this deep dive covers the operational side: how zones are Managed, how delegation works, how DNSSEC provides authenticity, how anycast enables global scale, And how enterprise DNS is designed for reliability and security.
Understanding DNS architecture is critical for systems engineers because virtually every service Depends on DNS. When DNS fails, everything fails — websites, APIs, email, authentication, service Discovery, container orchestration.
DNS Infrastructure Components
Section titled “DNS Infrastructure Components”Registrars
Section titled “Registrars”Registrars are accredited businesses that sell domain names to registrants (organizations, Individuals). Examples: GoDaddy, Namecheap, Cloudflare Registrar, AWS Route 53. The registrar Interface is where you:
- Register a domain name
- Set name server records (delegation)
- Manage WHOIS contact information
- Configure DNSSEC signing (DS records at the parent)
Registries
Section titled “Registries”Registries operate the TLD (Top-Level Domain) zone. They maintain the authoritative name servers for The TLD and accept registrations from registrars. Examples:
- Verisign operates
.comand.net - PIR operates
.org - Google Registry operates
.dev``.app``.page - Nominet operates
.uk
The registry does not interact with end users. The registrar communicates with the registry on Behalf of the registrant.
TLD Operators
Section titled “TLD Operators”TLD operators run the authoritative name servers for a TLD. For .comVerisign runs 13 logical Name server clusters (a through m.gtld-servers.net) deployed as anycast instances worldwide. These Servers respond to queries asking “where is the authoritative name server for example.com?”
Root Servers
Section titled “Root Servers”The root zone (.) is the apex of the DNS hierarchy. ICANN coordinates the root zone, which is Served by 13 logical root server networks (A through M) operated by different organizations:
| Label | Operator | Anycast instances |
|---|---|---|
| A | Verisign | 100+ |
| B | USC ISI | 6 |
| C | Cogent Communications | 10+ |
| D | University of Maryland | 10+ |
| E | NASA Ames Research Center | 10+ |
| F | Internet Systems Consortium (ISC) | 60+ |
| G | US Department of Defense | 10+ |
| H | US Army Research Lab | 6 |
| I | Netnod | 50+ |
| J | Verisign | 100+ |
| K | RIPE NCC | 30+ |
| L | ICANN | 20+ |
| M | WIDE Project | 10+ |
The “13” is a historical limit from the original DNS specification (UDP packet size constraints). Today, each logical root server is deployed as an anycast cluster with dozens to hundreds of Physical instances.
Zone Management
Section titled “Zone Management”SOA Record
Section titled “SOA Record”Every DNS zone has exactly one SOA (Start of Authority) record. It defines the zone”s primary name Server, the responsible person’s email, and timing parameters for zone transfers and negative Caching.
example.com. 3600 IN SOA ns1.example.com. hostmaster.example.com. ( 2024011501 ; Serial (YYYYMMDDNN format) 3600 ; Refresh (slave checks master every 1 hour) 900 ; Retry (on failure, retry every 15 minutes) 604800 ; Expire (after 1 week without refresh, zone is stale) 86400 ; Minimum TTL (negative cache TTL for NXDOMAIN) )Serial Numbers
Section titled “Serial Numbers”The serial number is how slaves determine whether the zone has changed. When the slave’s serial Matches the master’s, no transfer is needed. When the master’s serial is higher, the slave requests A transfer.
Serial number formats:
- YYYYMMDDNN: Recommended.
2024011501= January 15, 2024, revision 01. Easy to read, prevents rollover confusion. - Incremental: Simple counter (1, 2, 3…). Easy to forget to increment.
- UNIX timestamp: Seconds since epoch. Precise but hard to read.
NSEC3 zone enumeration resistance is not absolute. An attacker with sufficient resources can Brute-force the hashes for common names. NSEC3 with opt-out (unsigned delegations are not covered) Provides weaker security but better performance for large zones.
Anycast DNS
Section titled “Anycast DNS”How Anycast Works
Section titled “How Anycast Works”Anycast assigns the same IP address to multiple servers in different locations. BGP routes traffic To the nearest (topologically closest) server. For DNS, this means queries are answered by the Closest name server instance.
Client in Tokyo Client in London | | |--> 198.51.100.1 -------->|--> 198.51.100.1 ---------| | (anycast) | (anycast) v v[Tokyo DNS instance] [London DNS instance]198.51.100.1 198.51.100.1Root Server Anycast
Section titled “Root Server Anycast”All 13 root server operators use anycast. The a-root (198.41.0.4) has over 100 instances worldwide. This provides:
- Latency reduction: Queries are answered by the closest instance ( under 50ms)
- Availability: If one instance fails, BGP withdraws the route and traffic goes to the next closest
- DDoS resilience: Attack traffic is distributed across all instances
CDN DNS
Section titled “CDN DNS”CDNs like Cloudflare, Akamai, and Fastly use anycast for their authoritative DNS. When a client Queries www.example.com and the CDN’s DNS returns an IP address, the client is directed to the Nearest CDN edge server.
# Test which root server instance you hitdig @198.41.0.4 . NS +short# Compare with another locationdig @198.41.0.4 . NS +short +timeout=2
# Measure latency to different DNS serversdig @8.8.8.8 example.com +stats | grep "Query time"dig @1.1.1.1 example.com +stats | grep "Query time"Split-Horizon DNS
Section titled “Split-Horizon DNS”Overview
Section titled “Overview”Split-horizon DNS (also called split-view DNS or split-brain DNS) provides different DNS responses Depending on the source of the query. Internal clients get internal IP addresses; external clients Get external IP addresses.
Internal query for db.example.com: Response: 10.0.0.50 (private database server)
External query for db.example.com: Response: REFUSED or different public IPBIND Configuration Example
Section titled “BIND Configuration Example”// Internal view (for 10.0.0.0/8 clients)view "internal" { match-clients { 10.0.0.0/8; }; zone "example.com" { type master; file "/etc/bind/db.example.com.internal"; };};
// External view (for everyone else)view "external" { match-clients { any; }; zone "example.com" { type master; file "/etc/bind/db.example.com.external"; };};Use Cases
Section titled “Use Cases”- Internal services: Database servers, management interfaces, internal APIs should not be resolvable from the Internet
- Development vs production: Developers resolve
api.example.comto a staging server; production users resolve to the production server - GeoDNS: Different responses based on geography (but anycast is better for this)
DNS Load Balancing
Section titled “DNS Load Balancing”Round-Robin DNS
Section titled “Round-Robin DNS”The simplest form of DNS load balancing. Multiple A records for the same name, with the resolver Cycling through them.
example.com. 300 IN A 93.184.216.1example.com. 300 IN A 93.184.216.2example.com. 300 IN A 93.184.216.3Limitations:
- No health checking. If one server goes down, DNS still returns its IP. Clients get connection refused.
- Caching. Resolvers cache the full RRset and distribute it independently of the authoritative server’s order.
- Uneven distribution. Clients that share a recursive resolver all get the same answer.
Weight-Based DNS
Section titled “Weight-Based DNS”Some DNS providers (AWS Route 53, Cloudflare) support weight-based routing:
example.com. 300 IN A 93.184.216.1 ; weight 3 (75% of traffic)example.com. 300 IN A 93.184.216.2 ; weight 1 (25% of traffic)GeoDNS
Section titled “GeoDNS”Return different IP addresses based on the query source’s geographic location:
; European clientsexample.com. 300 IN A 93.184.216.1 ; geo: EU
; US clientsexample.com. 300 IN A 93.184.216.2 ; geo: US
; Asian clientsexample.com. 300 IN A 93.184.216.3 ; geo: APACThis is how CDNs direct users to the nearest edge server.
Enterprise DNS Design
Section titled “Enterprise DNS Design”Internal/External Split
Section titled “Internal/External Split”| Aspect | Internal DNS | External DNS |
|---|---|---|
| Purpose | Corporate infrastructure resolution | Public-facing services |
| Servers | AD Domain Controllers, dedicated DNS | Cloud provider or third-party |
| Zones | corp.example.com, ad.example.com | example.com |
| Records | Private IPs, SRV for internal services | Public IPs, MX, TXT for security |
| Forwarding | Internal recursive resolvers | ISP or public resolvers |
| Security | Protected by firewall, no public access | Public, DDoS protected |
| DNSSEC | Optional (internal trust) | Recommended |
Active Directory Integration
Section titled “Active Directory Integration”Active Directory is completely dependent on DNS. AD domain controllers register SRV records that Clients use to locate domain services:
_ldap._tcp.dc._msdcs.corp.example.com. IN SRV 0 100 389 dc1.corp.example.com._kerberos._tcp.dc._msdcs.corp.example.com. IN SRV 0 100 88 dc1.corp.example.com.If DNS for AD is misconfigured, authentication, group policy, and all AD-dependent services fail.
Forwarding vs Recursion
Section titled “Forwarding vs Recursion”Forwarding: The DNS server forwards queries it cannot answer to an upstream resolver (e.g., 8.8.8.8 or the ISP’s resolver). Simple to configure but adds latency and a dependency.
Recursion: The DNS server performs the full resolution itself (querying root, TLD, authoritative Servers). More control, can be faster with caching, but more complex to configure and secure.
Best practice for enterprise: use dedicated recursive resolvers (Unbound, BIND) that perform Recursion, not forwarding. This gives you control over caching behavior, logging, and security Policies.
# Unbound configuration for recursive resolutionserver: interface: 0.0.0.0@53 access-control: 10.0.0.0/8 allow do-not-query-localhost: no hide-identity: yes hide-version: yes prefetch: yes prefetch-key: yes
forward-zone: name: "." forward-addr: 8.8.8.8 forward-addr: 1.1.1.1DNS Troubleshooting Tools
Section titled “DNS Troubleshooting Tools”dig +trace
Section titled “dig +trace”The most important DNS troubleshooting command. It traces the full resolution path from the root Down to the authoritative server.
# Full resolution tracedig +trace example.com
# Trace with DNSSEC validationdig +trace +dnssec example.com
# Trace specific record typedig +trace example.com MX
# Trace from a specific recursive resolverdig @8.8.8.8 +trace example.comAdvanced dig Usage
Section titled “Advanced dig Usage”# Query a specific authoritative serverdig @ns1.example.com example.com A
# Show the full DNSSEC chaindig example.com DNSKEY +dnssec +multilinedig example.com DS +dnssec +multiline
# Check delegationdig example.com NS @a.gtld-servers.net
# Test DNSSEC validationdig example.com A +dnssec +cd # disable checking (cd = checking disabled)dig example.com A +dnssec # enable checking
# Measure query timedig example.com +stats
# Query over TCP (when UDP is blocked or truncated)dig +tcp example.com
# Query with EDNS0dig +edns=0 example.com
# Show all record types for a namedig example.com ANY +noall +answerdnstop
Section titled “dnstop”Real-time DNS traffic monitoring:
# Monitor DNS traffic on eth0dnstop eth0
# Filter by sourcednstop -l 10.0.0.0/8 eth0tcpdump for DNS
Section titled “tcpdump for DNS”# Capture DNS queries and responsestcpdump -i eth0 -n port 53
# Capture only queries (no responses)tcpdump -i eth0 -n 'port 53 and udp[10:2] & 0x8000 = 0'
# Capture only responsestcpdump -i eth0 -n 'port 53 and udp[10:2] & 0x8000 != 0'
# Capture DNS over TCPtcpdump -i eth0 -n 'tcp port 53'
# Save to pcap for analysistcpdump -i eth0 -n -w /tmp/dns-capture.pcap port 53Common DNS Problems
Section titled “Common DNS Problems”NXDOMAIN
Section titled “NXDOMAIN”The queried name does not exist in the zone. Causes:
- Typo in the domain name
- Record not yet created (propagation delay)
- Record deleted
- Wildcard not configured (if expected)
# Check if the name existsdig example.com A @ns1.example.com
# Check for typosdig exmple.com A # oopsSERVFAIL
Section titled “SERVFAIL”The authoritative server encountered an error. Causes:
- DNSSEC validation failure (broken chain of trust)
- Server misconfiguration
- Server overloaded or unreachable
- Broken zone file syntax
# Check DNSSEC chaindig example.com DNSKEY +dnssec @ns1.example.comdig example.com RRSIG A +dnssec @ns1.example.com
# Check server healthdig example.com A @ns1.example.com +timeout=5dig example.com SOA @ns1.example.comCache Poisoning
Section titled “Cache Poisoning”Cache poisoning occurs when an attacker injects forged DNS responses into a recursive resolver’s Cache, causing subsequent queries to return malicious IP addresses.
Mitigations:
- Source port randomization: The resolver uses random source ports for queries (RFC 5452). An attacker must guess both the query ID (16 bits) and the source port (16 bits), making spoofing much harder.
- DNSSEC: The resolver validates signatures. Even if a forged response is accepted into the cache, DNSSEC validation rejects it.
- DNS-over-TLS / DNS-over-HTTPS: Encrypt the query path, preventing interception and injection.
- 0x20 encoding: Randomize the case of the query name. The response must match the case, making forgery harder.