Skip to main content

DNS Resolution

Recursive DNS Resolution Step-by-Step Simulator (`example.com`)

Step 1: Check browser cache, OS `/etc/hosts`, local DNS resolver cache (e.g. 1.1.1.1 or 8.8.8.8). On cache miss, recursive query starts.

DNS Resource Record Type Inspector & Zone File Explorer
example.com.    3600    IN    A    93.184.216.34  ; Maps hostname to 32-bit IPv4 address

What is DNS?

DNS (Domain Name System) translates human-readable domain names into IP addresses (and vice versa). It is the internet's distributed phone book.

"api.example.com" → DNS → "93.184.216.34"

DNS is a distributed, hierarchical, cached system — no single server knows everything; the answer is assembled through a chain of queries.


DNS Hierarchy

. (root)
/ | \
com org net io ... (TLDs — Top Level Domains)
/ | \
google example amazon (SLDs — Second Level Domains)
/
api www mail (Subdomains)

DNS Server Types

TypeRoleExample
DNS Resolver (Recursive)Queries on behalf of clients8.8.8.8 (Google), 1.1.1.1 (Cloudflare)
Root NameserverKnows TLD nameserver addresses13 root server clusters (a–m.root-servers.net)
TLD NameserverKnows authoritative NS for domainsVerisign (for .com), ICANN
Authoritative NameserverHas the actual records for a domainRoute 53, Cloudflare, your own NS

DNS Resolution Process

Browser → OS → Resolver → Root → TLD → Authoritative

User types: api.example.com

1. Browser cache: api.example.com → ? (miss)
2. OS cache / /etc/hosts: ? (miss)
3. OS → Resolver (e.g., 8.8.8.8):
"What is api.example.com?"

4. Resolver → Root NS:
"Who handles .com?"
Root NS: "Ask a.gtld-servers.net"

5. Resolver → TLD NS (a.gtld-servers.net):
"Who handles example.com?"
TLD NS: "Ask ns1.example.com"

6. Resolver → Authoritative NS (ns1.example.com):
"What is api.example.com?"
Auth NS: "93.184.216.34, TTL 300"

7. Resolver caches: api.example.com → 93.184.216.34 (for 300s)
8. Resolver → Client: 93.184.216.34
9. Client caches result
10. Browser connects to 93.184.216.34:443

Full resolution typically takes 50–200ms; cached responses are < 1ms.


DNS Record Types

TypeNameValueUse
AIPv4 Address93.184.216.34Map hostname → IPv4
AAAAIPv6 Address2606:2800:220:1::...Map hostname → IPv6
CNAMECanonical Nameexample.comAlias → another hostname
MXMail Exchanger10 mail.example.comEmail routing (with priority)
TXTText"v=spf1 include:..."SPF, DKIM, domain verification
NSName Serverns1.example.comAuthoritative NS for zone
SOAStart of Authorityadmin + serial + refreshZone metadata
PTRPointerexample.comReverse DNS (IP → hostname)
SRVService10 20 443 api.example.comService location (gRPC, SIP)
CAACA Authorization0 issue "letsencrypt.org"Which CAs may issue SSL certs

CNAME Chains

api.example.com → CNAME → api-lb.cdn.example.com
api-lb.cdn.example.com → A → 203.0.113.50

Restriction: CNAME cannot coexist with other records at the same name
→ Cannot put CNAME at zone apex (example.com itself) — use ALIAS/ANAME

MX Records and Priority

example.com MX 10 mail1.example.com (lowest priority = preferred)
example.com MX 20 mail2.example.com (backup)
example.com MX 30 mail3.example.com (last resort)

DNS TTL (Time To Live)

TTL controls how long DNS answers are cached by resolvers and clients.

api.example.com A 93.184.216.34 TTL=300 ← cached for 5 minutes

Low TTL (30–60s):
✅ Fast propagation when IP changes (failover, deployments)
❌ More DNS queries → higher load on nameservers

High TTL (3600–86400s):
✅ Less DNS lookup overhead, fewer queries
❌ Slow to update on IP changes

Deployment strategy:

  1. Lower TTL to 60s a few hours before a change
  2. Make the DNS change
  3. After TTL passes, raise TTL back to normal

DNS Caching Layers

1. Browser DNS cache (chrome://net-internals/#dns)
2. OS DNS cache (nscd, systemd-resolved)
3. Router/modem cache
4. ISP resolver cache (your ISP's recursive resolver)
5. Public resolver cache (8.8.8.8, 1.1.1.1)
6. Authoritative server (source of truth)
# Flush OS DNS cache
# Linux (systemd-resolved)
sudo systemd-resolve --flush-caches

# macOS
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

# Windows
ipconfig /flushdns

# Query DNS directly
nslookup api.example.com 8.8.8.8
dig api.example.com @8.8.8.8
dig +trace api.example.com # full resolution chain
dig -x 93.184.216.34 # reverse DNS lookup

DNS Load Balancing

DNS can distribute traffic without a dedicated load balancer.

Round-Robin DNS

api.example.com A 10.0.0.1
api.example.com A 10.0.0.2
api.example.com A 10.0.0.3

Resolver rotates the order each query:
Query 1: [10.0.0.1, 10.0.0.2, 10.0.0.3] → client picks first
Query 2: [10.0.0.2, 10.0.0.3, 10.0.0.1] → client picks first

Limitations: no health checking — if one server dies, DNS still returns it.

GeoDNS / Latency-Based Routing

Serve different IPs based on the client's geographic location:

Client in US → api-us.example.com → 203.0.113.10 (US servers)
Client in EU → api-eu.example.com → 198.51.100.20 (EU servers)

Used by: Route 53 latency-based routing, Cloudflare GeoDNS.


DNSSEC

DNSSEC adds cryptographic signatures to DNS responses to prevent spoofing.

Without DNSSEC:
Attacker intercepts DNS response → returns malicious IP → cache poisoning

With DNSSEC:
Zone signs records with private key → DS record in parent zone
Resolver validates signature chain back to root (IANA)
Tampered responses fail signature check → rejected
# Verify DNSSEC
dig DNSKEY example.com
dig +dnssec A example.com # check AD (Authenticated Data) flag

Common DNS Issues & Diagnostics

DNS Propagation

After changing DNS records, old records may be cached globally for the duration of the TTL. "Propagation" is just waiting for caches to expire.

# Check from multiple global DNS resolvers
# whatsmydns.net — visual global propagation check
dig @8.8.8.8 example.com A # Google
dig @1.1.1.1 example.com A # Cloudflare
dig @9.9.9.9 example.com A # Quad9

Split-Horizon DNS

Different DNS answers for internal vs external clients:

Internal client: api.example.com → 10.0.0.5 (private IP)
External client: api.example.com → 203.0.113.5 (public IP/load balancer)

Used for: routing internal traffic through private network, keeping internal structure private.


Java DNS Configuration

// Java caches DNS results internally — configure TTL
// Default: 30s positive, 10s negative

// Set in jvm options or security properties
// $JAVA_HOME/conf/security/java.security
networkaddress.cache.ttl=30 // successful lookups
networkaddress.cache.negative.ttl=10 // failed lookups

// Or programmatically:
Security.setProperty("networkaddress.cache.ttl", "30");

// Spring Boot: use DNS-aware connection pool
// HttpClient automatically re-resolves on new connections
WebClient client = WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(
HttpClient.create()
.resolver(DefaultAddressResolverGroup.INSTANCE))) // DNS-aware
.baseUrl("https://api.example.com")
.build();

DNS on the Wire: UDP, TCP, EDNS and Encrypted DNS

  • Queries normally use UDP port 53. The classic limit is 512 bytes. EDNS0 raises it (up to 4096), but since the 2020 DNS Flag Day resolvers advertise about 1232 bytes to avoid IP fragmentation.
  • If the answer does not fit, the server sets the TC (truncated) bit and the client retries over TCP port 53. Zone transfers (AXFR) and large DNSSEC answers also use TCP, so blocking TCP/53 breaks DNS in subtle ways.
  • DoT (DNS over TLS, port 853) and DoH (DNS over HTTPS, port 443) encrypt the stub-to-resolver hop. Note that DoH can bypass enterprise DNS filtering, and neither one encrypts the resolver-to-authoritative hop.

Negative Caching, CNAME Rules and Record Gotchas

  • NXDOMAIN (name does not exist) and NODATA (name exists, no such type) are cached too, for the TTL given by the zone's SOA minimum / negative TTL (RFC 2308). A name created right after a failed lookup can stay "missing" for minutes.
  • SERVFAIL means the resolver could not get an answer (broken DNSSEC, unreachable authoritative servers). It is a different failure from NXDOMAIN and resolvers may retry other servers.
  • A CNAME cannot exist at the zone apex (it would conflict with the mandatory SOA and NS records) and cannot coexist with other records of the same name. Providers offer ALIAS/ANAME flattening for example.com pointing at a load balancer hostname.
  • Lowering a TTL only helps after the old TTL has expired. Before a migration, drop the TTL a full old-TTL period in advance, then cut over. Some resolvers and clients ignore low TTLs, so expect a long tail.
  • DNS-based load balancing cannot drain a node precisely. Clients cache answers and ignore health, so pair it with real health checks and low TTLs, or use an L4/L7 load balancer.
dig +trace example.com # walk root -> TLD -> authoritative
dig +norecurse example.com @8.8.8.8 # cache-only check
dig example.com +tcp # confirm TCP/53 works
dig -x 93.184.216.34 # reverse lookup

Kubernetes DNS: The ndots:5 Trap

Pods get /etc/resolv.conf with several search domains and options ndots:5. A name with fewer than 5 dots is tried against each search suffix before being tried as an absolute name:

search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

So resolving api.example.com (2 dots) first queries api.example.com.default.svc.cluster.local, then ...svc.cluster.local, then ...cluster.local (each returning NXDOMAIN), and only then the real name, for both A and AAAA. One lookup becomes about 8 queries.

Mitigations:

  • Use a trailing dot (api.example.com.) for external hosts in hot paths.
  • Set dnsConfig.options: ndots: 2 per pod when most lookups are external.
  • Run NodeLocal DNSCache to cache on each node and upgrade the upstream hop to TCP.
  • Known failure mode: UDP DNS through conntrack can hit a race that drops packets and causes 5-second resolution stalls. Symptoms are random 5 s latency spikes. NodeLocal DNSCache is the standard fix.
  • Remember the JVM caches lookups too (see Java DNS Configuration above), so check both layers.

Dual-Stack: Happy Eyeballs

When a host has both A and AAAA records, clients using Happy Eyeballs (RFC 8305) start IPv6 first and, if it has not connected within about 250 ms, race an IPv4 attempt. A broken IPv6 path therefore costs about 250 ms, not a timeout, but only in clients that implement it. Plain socket code may still hang on a dead AAAA address.


Interview Questions

Q1. Describe the full DNS resolution process for api.example.com.

Client checks browser cache → OS cache → if miss, asks local resolver. Resolver checks its cache → if miss, queries root NS for .com TLD NS → queries TLD NS for example.com authoritative NS → queries authoritative NS for api.example.com → gets A record (IP + TTL). Resolver caches result and returns to client. Full chain: ~4 queries, 50–200ms. Cached: < 1ms.

Q2. What is a CNAME record and when can't you use it?

A CNAME aliases one hostname to another (the canonical name). The resolver follows the CNAME and looks up the final A/AAAA record. You cannot use CNAME at the zone apex (naked domain: example.com) because RFC 1034 forbids other records coexisting with a CNAME, and zones must have SOA/NS records. Use ALIAS or ANAME (Route 53, Cloudflare) for apex aliases — they resolve to A records.

Q3. What is DNS TTL and how does it affect deployments?

TTL is how long resolvers and clients cache a DNS answer. Low TTL (60s) allows fast IP changes but increases query load. Before changing IPs (failover, deployment), lower TTL to 60s and wait for the current TTL to expire globally. Then make the change. After traffic shifts, raise TTL again. Ignoring TTL is why "DNS propagation takes 24-48 hours" — high TTLs of existing records.

Q4. What is DNS cache poisoning and how does DNSSEC prevent it?

Cache poisoning: an attacker convinces a resolver to cache a fraudulent DNS mapping (e.g., bank.com → attacker's IP). Classically exploited via Kaminsky attack by guessing the transaction ID. DNSSEC prevents this by signing zone data with cryptographic keys — the resolver validates the signature chain from the root. A tampered response has an invalid signature and is rejected.

Q5. What is the difference between a recursive resolver and an authoritative nameserver?

Recursive resolver (e.g., 8.8.8.8): accepts DNS queries from clients, does the work of traversing the hierarchy, caches results. It knows how to find answers but doesn't own any zones. Authoritative nameserver: owns the actual DNS records for a zone (example.com). It is the final source of truth and doesn't recurse — it just answers questions about its own zones.

Q6. What are SRV records and when are they used?

SRV (Service) records specify the hostname and port for a service: _service._proto.name TTL class SRV priority weight port target. Used by gRPC (for load balancing and discovery), SIP/VoIP, XMPP, and Kubernetes internal DNS. Example: _grpc._tcp.api.example.com SRV 10 20 443 api-grpc.example.com. Allows clients to discover service endpoints from DNS.

Q7. What is split-horizon DNS?

Split-horizon DNS returns different answers based on the requester's source IP. Internal clients get private IP addresses (routing traffic over the internal network), external clients get public IPs. Uses: keeping internal topology hidden, routing internal traffic without external NAT traversal, geographic load balancing. Implemented via DNS views in BIND or separate internal/external zones in cloud DNS.

Q8. Why might a Java application not respect a DNS TTL change immediately?

Java's JVM has its own DNS cache separate from the OS. By default it caches successful lookups indefinitely (networkaddress.cache.ttl=-1 in some older versions) or for 30 seconds. When DNS TTL expires, the OS and resolver update, but the JVM still serves the old cached IP. Fix: set networkaddress.cache.ttl in java.security or via Security.setProperty(). HTTP connection pools may also cache connections to specific IPs beyond the DNS TTL.


Deep Dive: DNS Infrastructure, EDNS0 Client Subnet, DNSSEC Chain & Encrypted DNS

Reference: Sujeet Pro — DNS Deep Dive

While developers treat DNS as a simple hostname-to-IP lookup (getaddrinfo), at the internet infrastructure level DNS is a globally distributed, cryptographically verifiable, latency-steering state machine that dictates both time-to-first-byte (TTFB) and multi-region failover RTO.

1. Under the Hood of the Resolution Hierarchy (13 Logical Roots, Anycast & Glue Records)

A client's stub resolver (inside libc / OS) sends a recursive query (RD=1, Recursion Desired) to a Recursive Resolver (8.8.8.8, 1.1.1.1, or ISP resolver). The Recursive Resolver then performs iterative queries (RD=0) down the delegation tree, aggressively caching each delegation layer (NS records) so almost no real-world lookup ever touches the Root servers twice:

  • Why Exactly 13 Logical Root Server Letters (a.root-servers.net to m.root-servers.net)? Original RFC 1035 DNS over UDP limited packets to 512 bytes (to avoid IPv4 fragmentation on early internet links with 576-byte MTU). Fitting the root hints response—containing the names and IPv4 addresses of all root servers—into a single unfragmented 512-byte UDP packet mathematically capped the list at 13 logical root identities. Today, those 13 logical IP addresses are backed by over 1,700 physical server clusters worldwide using BGP Anycast, combined with QNAME Minimization (RFC 7816) so root/TLD servers only see the minimal label they need (.com to Root, example.com to TLD) rather than leaking the full secret-project.internal.example.com query string.
  • The Circular Dependency Problem & Glue Records: If the authoritative nameserver for example.com is ns1.example.com, how can a resolver find the IP of ns1.example.com without already knowing how to query example.com? The parent .com TLD zone breaks this infinite loop by returning Glue Records—explicit A and AAAA records for ns1.example.com embedded directly inside the Additional Section of the TLD's NS referral packet.

2. Record Types Semantics & Architectural Constraints

RecordWire Format & Structural RuleCritical Production Use Case & Gotchas
A / AAAA32-bit IPv4 / 128-bit IPv6 addressDirect endpoint mapping; multiple records enable DNS Round-Robin or Happy Eyeballs (RFC 8305) dual-stack racing.
CNAMECanonical Name pointer to another domainRFC 1034 Invariant: A CNAME record cannot coexist with any other record type at the same node—therefore CNAME is illegal at the Zone Apex (example.com) because the apex must hold SOA and NS records. Cloud DNS providers solve this via virtual ALIAS / ANAME / CNAME Flattening (resolving the target at the authoritative edge and returning a synthesized A/AAAA record).
SOAMNAME RNAME Serial Refresh Retry Expire MinimumThe final field (Minimum, RFC 2308) defines the Negative Caching TTL (NXDOMAIN / NODATA cache lifetime).
SRV_service._proto.name TTL IN SRV Priority Weight Port TargetEnables port-aware and weighted service discovery (e.g., gRPC, Consul, SIP, Active Directory) where Priority (lower = preferred) provides active-passive failover and Weight provides proportional load balancing.
CAAFlags Tag Value (e.g., 0 issue "letsencrypt.org")Certification Authority Authorization (RFC 8659): Mandatory checked by all public CAs before issuing a TLS certificate. Prevents rogue/compromised CAs from issuing unauthorized certs for your domain.
PTRMaps 34.216.184.93.in-addr.arpa. →\rightarrow hostnameReverse DNS lookup; required by enterprise SMTP servers to verify sending mail servers aren't residential botnets.
TXT / SVCB / HTTPSArbitrary text (SPF/DKIM/DMARC) or Service Binding (HTTPS record, RFC 9460)HTTPS / SVCB records allow the browser to discover HTTP/3 (QUIC h3 ALPN) support and Encrypted Client Hello (ECH) keys during the initial DNS lookup, saving an entire HTTP/1.1-to-HTTP/3 upgrade RTT!

3. Global Traffic Steering: EDNS0 Client Subnet (ECS) vs. Anycast CDN Routing

When a user in Tokyo queries api.global-app.com, how does the CDN route them to the Tokyo PoP?

  1. The Public Resolver Blindspot: Authoritative DNS servers normally see only the Recursive Resolver's IP address, not the end user's IP. If a user in Tokyo configures an obscure corporate VPN DNS resolver in Virginia, classic GeoDNS thinks the user is in Virginia and returns a Virginia IP!
  2. EDNS0 Client Subnet (ECS — RFC 7871):
    • Public resolvers like Google (8.8.8.8) and OpenDNS attach an OPT pseudo-record containing the truncated prefix of the client's IP (typically /24 for IPv4 or /56 for IPv6 to preserve individual host privacy) when querying the Authoritative Nameserver.
    • The Authoritative Nameserver returns a scope prefix-specific A record (e.g., Tokyo Unicast PoP IP) that the recursive resolver caches specifically for that /24 subnet.
    • Trade-off: ECS fragments the recursive resolver's cache (separate cache entries per /24 subnet) and exposes coarse client location. Because of privacy concerns, Cloudflare (1.1.1.1) disables ECS, relying instead on BGP Anycast where both the DNS resolver and CDN edge share the same global Anycast footprint.

4. DNSSEC Chain of Trust (KSK, ZSK, RRSIG, DS)

Classic UDP DNS has zero cryptographic authentication, making it vulnerable to Kaminsky DNS Cache Poisoning (flooding a resolver with forged UDP replies guessing the 16-bit Transaction ID and source UDP port before the real authoritative server responds). DNSSEC establishes an unbroken cryptographic chain of trust from the IANA Root down to the leaf record:

[ Root Zone (.) ] ──Signs──▶ DS(com)
│ (Verifies Hash of KSK_com)
▼
[ TLD Zone (.com) ] ──Signs──▶ DNSKEY(KSK_com, ZSK_com) + DS(example.com)
│ (Verifies Hash of KSK_example)
▼
[ Auth Zone (example.com) ] ──Signs──▶ DNSKEY(KSK, ZSK) + RRSIG(A api.example.com)
  • Zone Signing Key (ZSK): Signs the actual resource record sets (RRset →\rightarrow produces RRSIG). Rotated frequently (every 1–3 months) and kept smaller for fast signature verification.
  • Key Signing Key (KSK): Signs only the zone's DNSKEY RRset (which contains both ZSK and KSK). Rotated rarely (1+ years) because rotating the KSK requires updating the parent zone.
  • Delegation Signer (DS): A SHA-256 cryptographic hash of the child zone's KSK, published in the parent zone (.com). This bridges the chain of trust across zone boundaries without requiring the parent zone to re-sign every time the child updates an A record or rotates its ZSK.
  • Authenticated Denial of Existence (NSEC / NSEC3): Because DNSSEC signatures are pre-computed offline (authoritative servers don't keep private keys online to sign arbitrary non-existent domains on the fly, which would allow CPU-exhaustion DoS), DNSSEC proves a domain does not exist by returning a signed NSEC ("Next Secure") record proving no names exist lexicographically between alpha.example.com and gamma.example.com (or hashed NSEC3 records to prevent attackers from "zone walking" / enumerating all internal subdomains).

5. Modern Encrypted Transports (DoT, DoH, DoQ) & Negative Caching

  • DNS over TLS (DoT — Port 853) vs. DNS over HTTPS (DoH — Port 443) vs. DNS over QUIC (DoQ — UDP Port 853):
    • DoT uses a dedicated port (TCP/853), allowing enterprise firewalls and network administrators to identify, audit, or block unauthorized external DNS resolvers easily.
    • DoH multiplexes DNS queries inside standard HTTPS (TCP/443 or UDP/443 HTTP/3) traffic, making DNS queries indistinguishable from normal web traffic (great for censorship resistance, challenging for enterprise split-horizon security).
    • DoQ (RFC 9250) runs DNS natively over QUIC streams, eliminating TCP head-of-line blocking and supporting 0-RTT handshake resumption.
  • Negative Caching Trap (SOA Minimum TTL): Under RFC 2308, when a lookup returns NXDOMAIN (domain does not exist) or NODATA (domain exists, but has no AAAA record), resolvers cache that negative answer for min⁡(SOA.TTL,SOA.Minimum)\min(\text{SOA.TTL}, \text{SOA.Minimum}). If an engineer tests new-service.prod.example.com two minutes before Terraform creates the DNS record, and the zone's SOA Minimum is set to 3600s (1 hour), every resolver that saw the test query will cache NXDOMAIN and refuse to resolve the new service for the next 60 minutes! Always keep SOA Minimum between 60s and 300s.

Senior/Staff Interview Playbook: How to Ace DNS Architecture & Failover Interviews

1. The Senior Framing Strategy (First 60 Seconds)

When DNS comes up in a System Design or Production Troubleshooting interview, immediately reframe DNS from a "lookup directory" to a Multi-Layer Eventually Consistent Cache with Asymmetric Failure Modes:

  1. Separate Data-Plane Latency from Control-Plane Failover:
    • Latency Math: Cold iterative resolution takes 40ms40\text{ms}–150ms150\text{ms}, while cached recursive/OS resolution takes <1ms<1\text{ms}. Adding HTTPS/SVCB records enables simultaneous TLS + QUIC (h3) negotiation, shaving 1–2 RTTs off cold connection setup.
    • Failover Math: DNS failover is governed by Tfailover=Thealth_check_detection+TTLDNS+Tclient_connection_pool_drainT_{\text{failover}} = T_{\text{health\_check\_detection}} + \text{TTL}_{\text{DNS}} + T_{\text{client\_connection\_pool\_drain}}. Even with TTL = 30s, active HTTP keep-alive or HTTP/2 connections never re-query DNS until the existing TCP socket is closed or reset!
  2. State the Control Plane Static Stability Principle (RFC 8767 serve-stale): Authoritative DNS outages (e.g., DDoS on a DNS provider) should be mitigated via Multi-Provider Secondary/Dual Authoritative DNS (NS records split across Route 53 + Cloudflare) and recursive resolvers configured with serve-stale (RFC 8767)—continuing to serve expired DNS records for up to 24–72 hours if all authoritative nameservers return SERVFAIL or time out.

2. Classic Interviewer Traps & Principal Rebuttals

Trap 1: "For our Multi-Region Disaster Recovery plan, we set our Route 53 DNS TTL to 60 seconds. If us-east-1 goes down, 100% of our users will fail over to us-west-2 in exactly 60 seconds, right?"​

  • Junior/Mid Answer: "Yes, once the 60-second TTL expires, clients will query DNS again and get the new us-west-2 IP address."
  • Principal Rebuttal: "In production, a 60-second DNS TTL never guarantees a 60-second traffic cutover, for three concrete reasons: (1) Connection Pool Pinning: Existing clients with established HTTP/1.1 keep-alive pools or HTTP/2 connections already resolved the IP; they do not perform a DNS lookup per HTTP request, and if us-east-1 is degraded (returning HTTP 500 rather than dropping TCP sockets), clients stay pinned to the broken region indefinitely! (2) Rogue Resolver & Runtime Caching: Some consumer ISP resolvers clamp minimum TTLs to 300s+, and unconfigured JVMs/SDKs cache DNS lookups beyond the wire TTL. (3) Control-Plane Dependency: If your DNS health-check control plane itself lives in us-east-1, it may fail to update the record during a regional outage. A Principal DR architecture pairs low DNS TTLs (30–60s) with BGP Anycast / Global Accelerator at the edge (which shifts packets at the routing layer in seconds regardless of client DNS caches) or forces the degraded region's load balancer to actively close TCP sockets (Connection: close / TCP RST) to force client re-resolution."

Trap 2: "Our Kubernetes cluster's CoreDNS CPU suddenly spiked to 100% and external API calls are experiencing random 5-second latency spikes—what is happening?"​

  • Junior/Mid Answer: "We need to scale up the CoreDNS deployment replicas because our pods are making too many external API calls."
  • Principal Rebuttal: "Two classic Linux/Kubernetes networking mechanics are colliding here: (1) The ndots:5 Search Path Amplification: By default, Kubernetes /etc/resolv.conf sets ndots:5 with 3 cluster search domains. Calling an external domain like api.stripe.com (only 2 dots) forces the stub resolver to query api.stripe.com.namespace.svc.cluster.local, .svc.cluster.local, and .cluster.local for both A and AAAA records in parallel—generating 6 wasted NXDOMAIN queries before the 2 real queries (4×4\times DNS load amplification!). (2) The Linux Kernel conntrack UDP Race Condition: Because A and AAAA UDP DNS packets are sent concurrently from the same socket over iptables DNAT to a CoreDNS pod, two packets can race to insert into the kernel netfilter conntrack table; the losing packet is silently dropped, hitting the stub resolver's hardcoded 5-second UDP retry timeout! The Principal fix is deploying NodeLocal DNSCache (listening on a node-local link-local IP with NOTRACK iptables rules and upgrading upstream queries to TCP), lowering ndots: 2, or appending a trailing dot (api.stripe.com.) to external FQDNs."

Trap 3: "Why can't we put a CNAME record on our root domain (example.com -> myapp.elb.amazonaws.com)? Why does our DNS provider block it?"​

  • Junior/Mid Answer: "DNS providers just require an A record for the root domain because that's how registrars work."
  • Principal Rebuttal: "RFC 1034 Section 3.6.2 enforces a strict protocol invariant: if a node in the DNS tree has a CNAME record, it may not have any other resource records of any type (except DNSSEC RRSIG/NSEC). Because a CNAME means 'this name is an alias; look up all records at the target name instead', placing a CNAME at the zone apex (example.com) creates a fatal ambiguity with the mandatory SOA (Start of Authority), NS (Name Server), and MX (Mail Exchanger) records that must exist at example.com. If a mail server queried MX example.com and followed the CNAME to myapp.elb.amazonaws.com, all company emails would break! Modern authoritative providers (Route 53 ALIAS, Cloudflare CNAME Flattening, NS1 ANAME) solve this by resolving the target hostname server-side inside the authoritative nameserver and returning a synthesized A/AAAA record on the wire, preserving full RFC compliance."

Trap 4: "We enabled DNSSEC to encrypt our users' DNS queries and stop ISPs from snooping on what websites they visit."​

  • Junior/Mid Answer: "Yes, DNSSEC secures DNS traffic using public-key cryptography."
  • Principal Rebuttal: "That confuses Data Integrity/Origin Authentication with Confidentiality (Encryption). DNSSEC does not encrypt a single byte of DNS traffic—all queries and responses remain 100% plaintext on the wire! DNSSEC only attaches cryptographic digital signatures (RRSIG verified via DNSKEY and DS records) so resolvers can verify the response was not forged or tampered with in transit (defeating cache poisoning). To encrypt the DNS transport channel and prevent ISP snooping on the stub-to-resolver hop, you must use DoH (DNS over HTTPS), DoT (DNS over TLS), or DoQ (DNS over QUIC)—combined with QNAME Minimization and Oblivious DoH (ODoH) on the resolver-to-authoritative hop."

3. Quick Reference — Mid-Level vs. Principal Candidate Cheat Sheet

Concept / ScenarioMid-Level Candidate SaysPrincipal Candidate Demonstrates
Zone Apex Routing"Point the root domain example.com to the load balancer using a CNAME.""Recognize RFC 1034 forbids CNAME coexisting with apex SOA/NS/MX records; use ALIAS / ANAME / CNAME Flattening or Anycast static IPs."
Global Traffic Steering"Use GeoDNS to route users to the closest server.""Compare GeoDNS + EDNS0 Client Subnet (ECS /24) (fine-grained ISP-level capacity steering) against BGP Anycast (instant DDoS absorption and zero DNS-cache lag)."
Failover & Migration"Change the DNS A record and set TTL to 60 seconds.""Lower Both positive TTL and SOA Minimum (Negative TTL) 24h in advance, account for HTTP/2 & keep-alive socket pinning by actively draining/closing old LB sockets, and enable RFC 8767 serve-stale."
Kubernetes DNS Latency"Add more CoreDNS pods when DNS gets slow.""Diagnose ndots:5 search-domain multiplication and Linux kernel UDP conntrack packet-drop races (5s timeouts); deploy NodeLocal DNSCache over TCP."
DNS Security"Enable DNSSEC to secure DNS.""Distinguish DNSSEC (KSK/ZSK/DS/RRSIG chain of trust for authenticity + NSEC3 for non-existence) from DoH/DoT/DoQ (transport encryption for privacy)."
📖
Track Page Progress0 / 635 Read
Knowledge Base Completion0%
Reinforce this topic: Test your recall and earn cosmic XP in the Engineering Arcade
Play Flashcard Arena →