DNS: resolution path, TTLs, record types, and reading dig

Every DNS answer is a cached copy with a countdown, and negative answers are cached too. Changes propagate at the speed of the old TTL, not the new one.

Read the briefing
About 4 min to read 8 drills

What to remember

  1. Lower the TTL before you change the record, not after. Caches hold the old value for the old TTL. Cutovers are planned days ahead.
  2. NXDOMAIN is cached (RFC 2308). Querying a name before you publish it pins its absence for the SOA minimum. Never smoke-test early.
  3. dig @authoritative versus dig through a resolver. The difference tells you whether you are looking at bad zone data or a stale cache.
  4. A CNAME cannot coexist with other records — so never at the apex. ALIAS/ANAME are provider-side flattening, not CNAMEs.
  5. glibc's default is a 5-second timeout, twice. One dead nameserver at the top of resolv.conf adds five seconds to every lookup.

The big picture

DNS causes an outsized share of outages because it is a distributed cache with no invalidation. The interview version covers the resolution path from stub to authoritative, TTLs and negative caching, the record types with rules attached (CNAME at the apex, SRV, PTR), split-horizon views, and reading dig output well enough to say which layer is lying to you.

The mental model

Every answer you get is a cached copy with a countdown. The question is always "which cache answered, and how old is it?": the stub resolver's, the node's, the recursive resolver's, or the authoritative server. Changes propagate at the speed of the old TTL, not the new one.

Diagrams

Where a name actually gets resolved
getaddrinfo("api.example.com")
   |
   +-- /etc/nsswitch.conf   which sources, in what order
   +-- /etc/hosts           static override, wins early
   |
   v
stub resolver  (/etc/resolv.conf)
   |    search domains appended; ndots decides when
   |    "api" becomes "api.svc.cluster.local" first
   v
recursive resolver --> root --> .com --> example.com NS
   |                                          |
   |  <----------- A / AAAA record + TTL ------+
   v
cached for TTL, at every layer that saw it
   ^ this is why your DNS change "did not take"

In depth

The resolution path

An application calls getaddrinfo, which follows /etc/nsswitch.conf (files, then DNS, sometimes mdns) and /etc/resolv.conf (nameservers, search domains, ndots, timeout, attempts). The stub sends the query to a recursive resolver, which walks the hierarchy if it has nothing cached: root → TLD → authoritative, following NS delegations, then caches the answer for its TTL. Inside Kubernetes there is an extra layer: ndots:5 plus a search list means a name like api.example.com may be tried as several nonexistent names first, multiplying query volume; NodeLocal DNSCache exists mostly to keep this off the conntrack table. Glibc's defaults are unforgiving: a 5 s timeout per nameserver before it moves to the next, and 2 attempts over the whole list, so one sick resolver adds seconds of latency to every lookup.

TTL, negative caching, and record types

A TTL is counted down independently by every cache in the path. Lowering a TTL takes effect only after the previous TTL expires everywhere, which is why cutovers are planned days ahead: drop the TTL, wait for the old one to expire, then change the record. Negative answers are cached too: NXDOMAIN and NODATA for min(SOA MINIMUM, SOA TTL) per RFC 2308, so querying a name before you publish it pins its absence for that long, a classic self-inflicted outage during launches.

Record types with rules: A/AAAA map names to addresses; CNAME aliases a name and may not coexist with other records at the same name, so it cannot be used at a zone apex (hence provider-specific ALIAS/ANAME); SRV carries host, port, priority, and weight (used by Kubernetes headless services and by many discovery systems); TXT carries SPF/DKIM and verification strings; NS delegates; SOA holds the zone's serial and negative-cache TTL; PTR is reverse lookup and is often the reason a connection takes five seconds when reverse DNS is broken. Split-horizon views return different answers by source network, so the same name resolves to a private address inside and a public one outside, and a client on the wrong side gets an unreachable answer that looks like a firewall problem.

Reading dig and the failure modes

Read dig output in order: status (NOERROR, NXDOMAIN = name does not exist, SERVFAIL = resolver or DNSSEC failure, REFUSED = server will not answer you), flags (aa authoritative answer, ra recursion available, ad DNSSEC-validated), the ANSWER section with its TTLs counting down on repeat queries, and the SERVER line telling you which resolver answered. dig +trace walks the delegation from the root and is the fastest way to see whether the authoritative data is right; dig @<authoritative-ns> name skips caches entirely; comparing the two tells you whether you are looking at a stale cache or bad zone data.

Production failure modes: stale answers after a failover (TTL too long), resolver timeouts adding seconds (glibc's 5 s), a missing search-domain assumption that works on one host and not another, DNSSEC expiry producing SERVFAIL everywhere at once, negative caching after a premature query, and CNAME chains that add round trips. Monitor DNS as a dependency: resolution latency and failure rate from the client's perspective, not just whether the servers are up.

Myths and facts

Myth: Lowering the TTL makes the change propagate now.

Fact: Caches keep the old record for the old TTL; lower it in advance, then change the record.

Myth: NXDOMAIN is not cached, so retries fix it.

Fact: Negative answers are cached per RFC 2308 for the SOA's minimum/TTL; a premature query pins the absence.

Myth: A CNAME can be used at the zone apex if the provider allows it.

Fact: The protocol forbids CNAME alongside other records; providers implement ALIAS/ANAME as a server-side flattening, which is not a CNAME.

Myth: If dig works, the application will resolve the name.

Fact: dig bypasses nsswitch, search domains, and the application's own resolver library; check with getent hosts or from inside the container.

Myth: DNS outages are the DNS servers' fault.

Fact: Most are TTL and caching semantics, resolver configuration, or dependency design: the servers were fine.

How pros do it

  • Plan cutovers around TTLs: lower well in advance, verify from multiple resolvers, then change.
  • Never query a name before it exists; negative caching will outlast your patience.
  • Use dig @authoritative and dig +trace to separate cache staleness from zone errors.
  • Treat resolver latency and failure as an SLI; cache locally (NodeLocal DNSCache) where query volume is high.
  • Keep TTLs short for records used in failover and long for stable infrastructure records; document the choice.

Questions people ask

I changed a record and half our clients still get the old address. Why?

Because their caches still hold the old record for the old TTL — nothing at the authority can reach into a cache. Every resolver, node cache and application counts its own copy down from the moment it fetched it, so a cache that fetched just before your change keeps the old answer for the full old TTL. Verify with dig against several resolvers, and remember the caches DNS cannot see: JVM resolver caches and long-lived connection pools.

Why does every lookup — or an SSH login — take exactly five seconds?

A dead or unreachable nameserver first in resolv.conf. glibc tries nameservers in order for every lookup, waits the full timeout (5 s by default) before moving to the next, and keeps no memory that the first one was dead. The SSH variant is a reverse (PTR) lookup timing out on the server: fix the reverse zone or set UseDNS no, and in either case put a local caching resolver in front so a dead upstream costs milliseconds.

Why is my container resolving api.internal as api.internal.svc.cluster.local?

ndots:5 — a name with fewer than five dots is treated as relative and tried with every search domain before the bare name. That is why one lookup becomes four or five queries and why a wildcard in a search domain can answer for a name that was never meant for it. Use a trailing dot to make the name absolute, or lower ndots in the pod spec when the extra queries hurt.

What does SERVFAIL usually mean?

The recursive resolver could not get a valid answer — not that the name is missing. Broken delegation, unreachable authoritative servers, or a DNSSEC validation failure are the usual causes. Split it in two commands: dig +trace shows whether the delegation works, and dig +cd (checking disabled) shows whether DNSSEC is the reason.

How do I make failover fast with DNS?

Mostly you do not — use short TTLs as a floor and design the failover at the connection layer. A record can only move as fast as the longest cache in the path, and clients ignore TTLs more than you would like. Anycast, load balancers, or client-side failover move traffic in seconds; DNS is for the planned, slow moves.

Further reading

Drills · 8

Answer in your head, or out loud, before you reveal. Mark each one: "Again" brings it back, "Got it" counts on your desk.

1 Pick the strongest answer

You are planning to move db.example.com to a new IP at 14:00. Its A record has a TTL of 3600 s. 10 minutes before the cutover you drop the TTL to 60; at 14:00 you change the address. How long after 14:00 can a client still be handed the old IP, and why?

  1. Exactly 3600 s after 14:00 for everyone, because the TTL restarts when the record changes. TTL counts down from each cache's fetch, not from the change; a cache that fetched long before the change has less residual, and the maximum is old TTL minus lead time.
  2. Up to 50 minutes after 14:00: a resolver that cached the record just before you lowered the TTL still holds the old IP with the old 3600 s TTL and never re-asks until that expires; the 60 s TTL only governs resolvers that refetched after the change. To make 14:00 clean you had to lower the TTL at least 3600 s before. Each cache counts its own copy down from its own fetch time; the worst-case staleness after the cutover is old TTL minus lead time, and it differs per resolver.
  3. About 60 s — once the authoritative server publishes the 60 s TTL, caches everywhere pick up the new TTL within a minute. A cache never re-checks a record until its own copy expires, so a TTL change is invisible to any cache still holding the old copy with the old TTL.
  4. Zero — authoritative servers send NOTIFY when a record changes, so resolver caches are flushed. NOTIFY runs between a zone's primary and its secondaries; recursive resolvers are never told about changes and serve what they cached.
In short

Caches that fetched before you lowered the TTL keep the old IP for the full old TTL, so lower the TTL at least one old TTL before the change.

Why

A TTL is an instruction to caches, and every cache in the path — the recursive resolver, a node-local cache, the application's own resolver cache — counts its copy down independently from the moment it fetched the record. Nothing at the authority can reach into those caches: a cache learns about a new TTL or a new address only when its current copy expires and it asks again. So the resolvers that matter for a cutover are the ones that fetched before you lowered the TTL; they hold the old value for up to the old TTL, which is why the TTL must be lowered at least one old TTL ahead of the change. Plan for the application layer too: JVM resolver caches and long-lived connection pools are caches that ignore DNS TTLs entirely.

The common mistake

Saying the change "propagates in about a minute" once the TTL is 60. Nothing pushes to a cache; a resolver that fetched just before you lowered the TTL keeps the old answer for the whole old TTL.

Read the docs

2 Find what's broken

Why is DNS slow on this host? The resolver at 10.0.0.53 was decommissioned last week. Since then every lookup takes at least 30 s, short internal names such as api.payments.svc take about two minutes, and strace -e trace=sendto shows a burst of DNS packets per lookup. Which lines are responsible and what do you change?

# Managed by cloud-init; edits are overwritten on reboot
search prod.internal.example eu-west-1.compute.internal example.com
nameserver 10.0.0.53
nameserver 10.0.0.2
nameserver 10.0.1.2
options ndots:5
options timeout:30 attempts:5
options edns0 trust-ad
In short

Lines 3, 6 and 7: remove the dead first nameserver, lower ndots, and cut the timeout and attempts.

What's broken
  • Line 3: The first nameserver is dead. glibc tries nameservers in order for every new lookup and keeps no memory of a dead server, so each getaddrinfo waits the full timeout on 10.0.0.53 before trying 10.0.0.2.
  • Line 6: ndots:5 makes any name with fewer than five dots relative: api.payments.svc is tried as api.payments.svc.prod.internal.example, then .eu-west-1.compute.internal, then .example.com (each NXDOMAIN, each paying the dead-server timeout) before the bare name is finally tried.
  • Line 7: timeout:30 attempts:5 sets the per-server wait to its maximum and repeats the whole nameserver list five times, so a single unanswered query can hold a thread for minutes instead of the default ~5 s × 2.
Why

glibc's stub resolver is deliberately simple: for each lookup it walks the nameserver list in order (unless rotate), waits timeout seconds per server, and repeats the list attempts times — with no memory that a server was dead a millisecond ago. A dead first entry therefore taxes every lookup by the timeout. ndots decides whether a name is tried as-is or with each search suffix first; Kubernetes ships ndots:5 so that svc short names resolve, and the cost is extra queries per lookup — tolerable with a fast local cache, brutal with a dead nameserver in front. The search line (2), the healthy nameservers (4–5) and edns0 trust-ad (8) are fine. The structural fix is a local caching resolver that hides upstream failures, plus FQDNs with trailing dots in configuration.

The common mistake

Blaming the resolver that answers. The five-second tax (here thirty) is paid on the dead nameserver before the healthy one is even asked, and it is paid again for every search-suffix candidate.

Read the docs

3 Answer out loud

Walk me through what happens when a Linux application resolves api.example.com — every hop from the process to the authoritative server. Then: you lower that record's TTL from 3600 to 60 ten minutes before a planned IP cutover. Cache by cache, what actually changes? Four to seven sentences — I am timing you.

In short

A strong answer names each hop (nsswitch, stub, recursive, authoritative) and says each cache counts its own copy down, so the old IP can survive up to 50 minutes after cutover.

What a strong answer does
  • resolution path: getaddrinfo consults nsswitch (hosts file first) and resolv.conf; the stub sends to the recursive resolver, which answers from cache or walks root → TLD → authoritative following NS referrals, caching every answer by TTL; notes a local cache layer (systemd-resolved, node-local) as yet another cache.
  • ttl dynamics: Each cache counts its own copy down from its own fetch time; only caches that refetch after the change see 60; a cache that fetched just before the change serves the old IP for up to 3600 − 600 = 50 minutes after cutover; states the TTL should be lowered at least one old TTL ahead; names application resolver caches and connection pools as caches too.
  • communication: Path in order with each cache named, then the countdown rule, then the numeric worst case and the operational rule; precise vocabulary.
Why

Interviewers listen for three things: that the candidate names the actual hops (nsswitch, stub, recursive, authoritative) rather than "the DNS server"; that they understand a TTL as a per-cache countdown that nothing upstream can shorten; and that they turn that into the operational rule — lower the TTL one old TTL ahead — with the 50-minute worst case computed rather than guessed. Mentioning connection pools as a cache that ignores DNS is the senior tell.

The common mistake

Saying "the DNS server" for three different things. Name the stub, the recursive resolver and the authoritative server, or the follow-ups will expose it.

Read the docs

4 Pick the strongest answer

A deploy pipeline adds api-eu.example.com to the zone at 10:00:00 and starts a smoke test through the company's recursive resolver. A health checker had already queried the name at 09:59:58. The smoke test gets NXDOMAIN on every attempt until 10:04:58, although dig @ns1.example.com api-eu.example.com has returned the A record since 10:00:00. What is going on?

  1. Zone transfer to the secondaries takes that long, and the resolver is asking a secondary that has not caught up. The stem says the authoritative servers already answer correctly; the persistence lives in the recursive resolver's cache, which never re-asks until the negative TTL expires.
  2. The new A record's TTL governs how long the NXDOMAIN persists. The A record was never in this cache; the negative answer's lifetime comes from the SOA MINIMUM / SOA TTL, not from the record that later appears.
  3. The 09:59:58 query received NXDOMAIN, and per RFC 2308 the resolver caches that negative answer for the zone's negative TTL — min(SOA MINIMUM, SOA TTL) = 300 s — so every query through that resolver is answered NXDOMAIN from cache until it expires at 10:04:58. Negative answers are cached like positive ones; their lifetime comes from the SOA record the authoritative server returned in the AUTHORITY section of the NXDOMAIN.
  4. Negative answers are never cached; the resolver must be holding a stale copy of the zone. RFC 2308 requires negative caching; the SOA in the NXDOMAIN's AUTHORITY section carries the TTL to use, and resolvers honour it.
In short

The 09:59:58 query cached the NXDOMAIN answer for the zone's negative TTL, so the resolver keeps saying the name does not exist until that expires.

Why

When a name does not exist, the authoritative server returns NXDOMAIN with the zone's SOA record in the AUTHORITY section; RFC 2308 tells the resolver to cache that absence for min(SOA MINIMUM field, SOA record TTL). Querying a name before it is published therefore pins "does not exist" into every resolver that asked, for that many seconds, regardless of when the record appears. The operational rules: publish before wiring health checks, keep SOA MINIMUM modest (300 s is common) for zones you change often, and know your resolver's flush command (rndc flushname, unbound-control flush) for the day you forget. dig shows the negative TTL in the AUTHORITY section of the NXDOMAIN answer.

Read the docs

5 Read the output

You are about to repoint shop-prod.lb.example at a new balancer. Read me this output: where did the answer come from, and how quickly will clients behind this resolver see the change?

$ dig www.shop.example A

; <<>> DiG 9.18.24 <<>> www.shop.example A
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41007
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.shop.example.              IN      A

;; ANSWER SECTION:
www.shop.example.        287    IN      CNAME   shop-prod.lb.example.
shop-prod.lb.example.    17     IN      CNAME   lb-eu-1.cloudlb.example.
lb-eu-1.cloudlb.example. 60     IN      A       203.0.113.10

;; Query time: 0 msec
;; SERVER: 10.0.0.2#53(10.0.0.2) (UDP)
;; MSG SIZE  rcvd: 131
  1. The answer is authoritative because the status is NOERROR, so these are the live zone values. NOERROR only says the name exists and nothing failed; authoritativeness is the aa flag, which is absent here.
  2. The answer came from the cache of the recursive resolver 10.0.0.2 (no aa flag, 0 ms query time), and each record in the chain has its own remaining TTL: the middle CNAME is refetched in 17 s while the first CNAME is pinned for 287 s. A change to shop-prod.lb.example becomes visible to this resolver within ~17 s; a change to the www CNAME itself would take up to 287 s here and up to its full original TTL in caches that fetched it more recently. Flags without aa plus a 0 ms query time mean a cached answer; a cache reports remaining TTLs, and every RR in a CNAME chain is cached and expires independently.
  3. The whole chain expires together when the first CNAME's 287 s runs out, so any change takes 287 s to appear. Each resource record is cached by its own TTL; the resolver reassembles the chain on every query, so the 17 s record is refreshed long before the 287 s one.
  4. The TTLs 287, 17 and 60 are the values configured in the zone files. A cache reports the remaining TTL counting down; configured values are only visible when you query an authoritative server directly (dig @ns1 ...).
In short

This is a cached answer from resolver 10.0.0.2, and each record in the chain expires on its own clock; the middle CNAME refreshes in 17 seconds.

Why

Read dig in a fixed order: status (NOERROR), flags (qr rd ra — no aa, so this is a recursive resolver's cached answer, confirmed by the 0 ms query time), the ANSWER section, and the SERVER line naming who answered. A CNAME chain is three separate resource records, each cached and expiring on its own clock, which is why the remaining TTLs are unrelated numbers. To see configured TTLs and the truth at the source, query an authoritative server (dig @ns1.lb.example shop-prod.lb.example); to see only what a cache holds without triggering a fetch, use +norecurse; +trace walks the delegation from the root.

Read the docs

6 Scenario: what do you do next?

02:10 — the managed Postgres primary fails over; the provider updates db.prod.example.com (TTL 300) to the new primary's IP at 02:11. It is now 02:30 and the write-error rate is still ~40%: about half the application pods log cannot execute INSERT in a read-only transaction — they are talking to the old primary, which is now a replica. Pods run on 3 nodes, each with a node-local DNS cache at 169.254.20.10.

Step 1. You join the incident channel. What do you do first?

  1. From one failing pod and one healthy pod, run dig db.prod.example.com and compare the ANSWER IP, the remaining TTL and the SERVER: line; then dig @<authoritative-ns> db.prod.example.com for the truth at the source. Two minutes of evidence tells you whether a cache is stale, which cache, and how long it thinks it may keep lying — before anyone changes anything.
  2. Raise the record's TTL to 3600 so the answer stabilises. Longer TTLs make failover slower; the problem is that some cache is holding the old answer too long already.
  3. Ask the provider to fail back to the old primary so the stale half works again. That breaks the currently-healthy half, reverses a failover the provider made for a reason, and treats a caching problem as a database problem.
  4. Restart all application pods so they reconnect to the new primary. If a node-local cache is stale, restarted pods re-resolve the same wrong answer; you also lose the evidence of which pods were wrong and why.

Step 2. Failing pods get 10.20.0.5 (old primary) with TTL 3187 remaining from SERVER 169.254.20.10; healthy pods get 10.20.0.9 with TTL 2700. The authoritative servers return 10.20.0.9 with TTL 300. The node-local cache config contains cache-min-ttl: 3600, added last quarter to reduce upstream DNS load; the healthy nodes' caches happen to have been restarted at 02:15. What is your mitigation?

  1. Edit every pod's resolv.conf to point straight at the authoritative servers, bypassing the node-local cache. A fleet-wide config change under pressure that removes caching entirely and raises latency and upstream load, when a one-line flush fixes the actual fault.
  2. Restart the failing application pods right away. Their node's cache still has 53 minutes of the old record to serve; the new pods connect straight back to the replica.
  3. Flush the stale name on every node-local cache (or restart those cache pods) first, confirm with dig from a pod on each node that 10.20.0.9 comes back, then recycle the affected application pods so their connection pools reconnect — in that order. Fixes the lying cache, verifies it, then clears the pooled connections that would otherwise stay on the replica; reversing the order re-resolves the stale entry into fresh pods.
  4. Add 10.20.0.9 db.prod.example.com to /etc/hosts on the three nodes. Pods have their own /etc/hosts, and a pinned IP turns the next failover into a manual edit across the fleet; the cache is the fault, fix the cache.

Step 3. Writes recovered at 02:44 — 34 minutes at 40% write failures. Which action items do you put in the postmortem?

  1. Ask the provider to publish the record with TTL 0. TTL 0 sends every lookup upstream, some caches clamp it, our own floor would still override it, and it does nothing about pooled connections.
  2. Hardcode the primary's IP in the application configuration. Turns the next failover into a deploy; DNS indirection exists precisely so the address can move.
  3. Lower the cache's minimum TTL from 3600 to 600. Still a floor: the next failover on a 300 s record would hang for ten minutes. Overriding authoritative TTLs is the fault, not its size.
  4. Remove cache-min-ttl so the cache honours authoritative TTLs (if a floor is truly needed, cap it below any failover record's TTL); make the application verify it reached a writable primary after connecting and evict pooled connections on read-only errors; alert on writes hitting a replica; rehearse the provider failover in staging with the node-local cache in the path. Each item is a mechanism with a verifiable effect, and the rehearsal proves the chain end to end rather than assuming.
In short

Compare dig from a failing pod and a healthy pod first; the node-local cache holds the old IP, so flush it, verify, then restart the pods.

Why

Failover by DNS only works if every cache between the application and the authority honours the record's TTL. A cache configured with a minimum TTL silently rewrites 300 to 3600, and it will faithfully serve the old primary for an hour after the provider moved the record — the dig SERVER line and the impossible remaining TTL (3187 on a 300 s record) expose it in seconds. Two more caches hide behind DNS: the application's resolver cache and its connection pool, whose established connections never re-resolve at all, which is why the mitigation order is cache first, verify, then pods. The postmortem fixes the mechanism (no TTL floors, connection validation, an alert on the symptom) and proves it with a rehearsal.

Read the docs

7 Pick the strongest answer

A Kubernetes pod has search payments.svc.cluster.local svc.cluster.local cluster.local example.com and options ndots:5. It calls http://ledger.internal/, an on-prem service with an A record for ledger.internal. in corporate DNS. Since the platform team appended example.com to the search list, the call lands on the corporate marketing site and returns an HTML 404. dig ledger.internal from inside the pod returns the correct on-prem IP. What is happening — and why does dig look fine?

  1. With ndots:5, ledger.internal (one dot) is a relative name: the resolver tries every search suffix before the bare name, and ledger.internal.example.com matches a wildcard *.example.com record, so the bare name is never queried. dig does not apply the search list unless given +search, which is why it looks fine. Fix: use the FQDN with a trailing dot (ledger.internal.), lower ndots, or remove the wildcard or the search entry. Names with fewer dots than ndots get the search suffixes first; a wildcard in a search domain captures them, and dig's default behaviour hides the problem.
  2. The resolver always tries the name exactly as typed first and only then appends search domains, so the search list cannot be the cause. The order depends on ndots: a name with fewer dots than ndots is tried with each search suffix first and as typed last.
  3. An NXDOMAIN for the first suffix aborts the search, so only one suffix is ever tried. NXDOMAIN and NODATA both move the resolver on to the next suffix; only a positive answer ends the search, which is exactly how the wildcard wins.
  4. dig and the application use the same resolution logic, so the application must be caching an old answer. dig ignores the search list by default (only +search applies it) while glibc's getaddrinfo honours ndots and search, so the two can legitimately disagree.
In short

ndots:5 makes the resolver try the search suffixes first, and a wildcard in example.com answers; use the name with a trailing dot.

Why

The search list is a convenience for short names, and ndots is the threshold: a name with fewer dots is presumed relative and is expanded with each search suffix in order, the literal name being tried last. Any search domain that contains a wildcard record (*.example.com pointing at a web frontend is common) will therefore answer for names that were never meant for it, and the resolver stops at the first positive answer. RFC 1535 described this trap in 1993; Kubernetes' ndots:5 default makes it likely again. getent hosts ledger.internal reproduces what the application sees because it uses glibc; dig +search does the same; a trailing dot makes a name absolute and immune.

Read the docs

8 Quick recall

Quick one: a lookup fails on two hosts. dig shows status: SERVFAIL on one and status: NXDOMAIN on the other. Which of the two is the authoritative side saying the name does not exist?

In short

NXDOMAIN means the name does not exist; SERVFAIL means the resolver could not get an answer at all.

Accepted

NXDOMAIN · nxdomain · Nxdomain

Why

NXDOMAIN (RCODE 3) is the authoritative answer 'no such name' — and it is cached negatively per RFC 2308, so a premature query pins it. SERVFAIL means the recursive resolver could not get a valid answer at all (broken delegation, unreachable authoritative servers, a DNSSEC validation failure), so the name may well exist; dig +trace and dig +cd split those causes. NOERROR with an empty ANSWER (NODATA) means the name exists but has no record of that type.

Next lesson HTTP versions, L4 vs L7 balancing, health checks, retries, and the 5xx taxonomy
Drill · DNS
0:00

Loading…