Skip to content

Lesson 1 of 9 · 22m

The Resolution Chain: Stub, Recursive, Root, TLD, Authoritative

The mental model of who asks whom, what recursive really means, and how to read the evidence dig leaves behind.

DNS incidents feel magical until you can name every hop. A laptop almost never talks to an authoritative server directly: it asks a stub resolver, which asks a recursive resolver, which walks a delegation chain from the root to the TLD to the domain's authoritative nameservers. Once you can draw that chain, most "DNS is down" reports become a smaller question: which hop is lying, unreachable, or cached?

The three roles

  • Stub resolver — the OS or application library. Usually reads /etc/resolv.conf and sends one recursive query.
  • Recursive resolver — the workhorse (1.1.1.1, 9.9.9.9, your ISP resolver, or your own Unbound). It follows referrals, validates if configured, and caches.
  • Authoritative server — the server that owns zone data. It answers from local state, not by chasing other nameservers.
# /etc/resolv.conf controls only the first hop
nameserver 10.20.0.2
nameserver 10.20.0.3
search corp.internal

Follow the delegation yourself

$ dig +trace www.cloudflare.com
.                       518400  IN  NS  a.root-servers.net.
com.                    172800  IN  NS  a.gtld-servers.net.
cloudflare.com.         172800  IN  NS  ns1.cloudflare.com.
www.cloudflare.com.     300     IN  A   104.16.123.96

The first answers are referrals, not final answers. The recursive resolver asks the root, gets sent to .com, gets sent to Cloudflare, and only then receives the A record.

Read the header, not just the answer

$ dig @1.1.1.1 www.cloudflare.com
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

rd means recursion was requested; ra means the server offers recursion. aa means authoritative answer. ad means DNSSEC-authenticated data when validation succeeded and the client asked for DNSSEC metadata. An authoritative-only server normally lacks ra; a recursive answer normally lacks aa because it is relaying cached or delegated data.

Recursion is a service boundary

Test the same name at each layer:

dig @10.20.0.2 www.sudosecurity.org
dig @1.1.1.1 www.sudosecurity.org
dig @ns1.sudosecurity.org www.sudosecurity.org

If the authoritative answer is right and public resolvers are wrong, suspect cache, delegation, or DNSSEC. If the authoritative answer is wrong, nothing downstream can save you. Never mix an open recursive resolver with public authoritative service: you have built both a security incident and an amplifier.

Field notes

  • "It works on 8.8.8.8 but not locally" means the paths differ, not that DNS is magically fixed.
  • +trace performs the iterative walk itself after bootstrapping; it bypasses most of your normal recursive path.
  • Compare answer, status, TTL, flags, and server identity; "did it resolve?" is too coarse to be useful.
  • The first hop in /etc/resolv.conf is only the beginning of the evidence trail.

Was this lesson helpful?

Sign in to rate