DNS Resolution, Step by Step
Introduction¶
DNS feels like magic until the first time a record change "doesn't take" or a site resolves for you but not for a colleague. Both are ordinary once you know how resolution actually works and can trace it.
Concepts¶
There are two kinds of DNS server:
- Recursive resolver — the one your machine talks to (
1.1.1.1,8.8.8.8, your ISP's, your router). It does the legwork and caches the answer. - Authoritative server — holds the real records for a zone.
example.com's authoritative servers are the only source of truth forexample.com.
A cold lookup for www.example.com A:
- Resolver asks a root server (
.). Root replies: "I don't know, but ask the.comservers — here they are." - Resolver asks a
.comTLD server. It replies: "askexample.com's nameservers —ns1.example.comat this glue IP." - Resolver asks
ns1.example.com. It replies with the actual A record. - Resolver caches every answer for its TTL and returns the A record to you.
Steps 1–2 are almost always already cached (the root and .com referrals
change rarely), so a "cold" lookup in practice is usually just step 3.
Hands-on¶
Trace the full recursion¶
dig +trace www.example.com A
This makes dig do the resolver's job itself, printing each referral. You see
. → .com → authoritative → answer. If it stops at the .com level, the
domain's delegation (NS records at the registrar) is broken.
Query a specific server¶
# Ask the authoritative server directly — bypasses all caching
dig @ns1.example.com www.example.com A +norecurse
# Ask a public resolver
dig @1.1.1.1 www.example.com A
# What's the TTL and is it counting down (i.e. a cached answer)?
dig www.example.com A | grep -A1 "ANSWER SECTION"
See the delegation¶
dig example.com NS +short # authoritative nameservers
dig com NS +short # the .com TLD servers
Reverse the flow (PTR)¶
dig -x 93.184.216.34 +short
Verification and troubleshooting¶
- "It works for me but not for them" — TTL. You (or your resolver) cached
the old record; theirs cached the new one, or vice versa. Wait out the TTL,
or check both against the authoritative server directly with
dig @nsX. Lower the TTL before a planned change, not after. NXDOMAIN— the name genuinely doesn't exist at the authoritative server, or the delegation is broken so the resolver can't find the authoritative server.dig +traceshows which.SERVFAIL— the resolver tried and failed. Common causes: all authoritative servers unreachable, a broken DNSSEC chain (dig +cddisables validation — if that fixes it, it's DNSSEC), or a resolver bug. Check with the DNSSEC checker.- Right IP from one resolver, wrong from another — a stale cache on one
resolver, or a GeoDNS / split-horizon setup returning different answers by
location. Compare
dig @1.1.1.1vsdig @8.8.8.8vs the authoritative. - Propagation "stuck" — there's no global push; every resolver just caches until its copy's TTL expires. Check spread with the propagation checker.
CNAMEat the apex breaks things — you can't have a CNAME on the bare domain alongside other records (SOA, NS, MX). Use ALIAS/ANAME (provider feature) or an A record.
Related tools and reading¶
- On-site: DNS Lookup, DNS Propagation Checker, DNSSEC Checker, WHOIS, RDNS.
- Related posts: What happens when you type a URL, DHCP DORA explained.
Stuck on something this site can't fix?Reach out to Prabath directly on LinkedIn.More in Network Protocols
DHCP DORA: How a Host Gets Its Address
The four DHCP packets, the renewal timers, why relays exist, and the tcpdump filter to watch it happen.
October 24, 2026SMB Versions and Signing, Demystified
SMB1 is a security liability, SMB3 encrypts and signs. Here's how dialect negotiation works and how to tell which one a connection actually used.
October 24, 2026DNS over TLS and DNS over HTTPS
Plain DNS is unencrypted and unauthenticated. DoT and DoH fix the transport — here's how each works, and the trade-off between privacy and network visibility.
October 24, 2026