November 26, 2026

How to Troubleshoot DNS With dig: +trace, TTLs and Propagation

A laptop terminal running DNS queries next to a small home server on a workbench

www.lab. 283 IN A 10.46.9.1. That answer came from a caching resolver two seconds after the authoritative server for the zone had been changed to say 10.46.9.2, and the authoritative server, asked directly, was already giving the new address. No fault had occurred, and no data was “propagating” anywhere. The resolver was doing exactly what the DNS standards tell it to do with a record that still had 283 seconds left to live, and dig is the tool that shows that countdown in plain numbers instead of leaving people to refresh a browser and wait.

Video: Learn Linux TV on YouTube

A DNS lab small enough to watch

Three servers, one client, and a clock

Testing DNS changes against the real internet means waiting on other people’s caches. So the examples here come from a private DNS hierarchy built on an Ubuntu 24.04 test container with Linux network namespaces:

Role Software Address Holds
Root server for the lab BIND 9 (named) 10.46.0.10 the “.” zone, delegating lab.
Authoritative server BIND 9 (named) 10.46.0.20 the lab. zone, www.lab with TTL 300
Caching resolver Unbound 10.46.0.53 nothing at first; learns by asking
Client dig 9.18.39 10.46.0.99 nothing

The lab. zone’s SOA record ends in 60, which matters later. Every dig command below ran on the client namespace, and the bracketed times are seconds since the first query.

That isolation turned out to be necessary for a second reason. On the same test container, an ordinary dig example.com sent to the configured upstream resolver came back status: NXDOMAIN with the SERVER: line reading 8.8.8.8, for a domain that unquestionably exists, and a retry over TCP got “connection refused.” Something on the container’s network path was answering DNS on that address’s behalf. The SERVER: line says where dig sent the question. Who actually answered is a separate matter.

A countdown timer above network equipment, a picture of a DNS record's TTL running out

Reading dig output

Four lines that do most of the work

The BIND 9 manual pages describe @server as “the name or IP address of the name server to query,” and explain that without one, dig falls back to the servers listed in /etc/resolv.conf. That default is where a lot of confusion starts, since the resolver in that file might be a router, a Pi-hole, or a VPN’s DNS server rather than anything the domain owner controls.

A full answer from the lab resolver, with blank lines removed:

$ dig @10.46.0.53 www.lab
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42346
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;www.lab.           IN  A
;; ANSWER SECTION:
www.lab.        300 IN  A   10.46.9.2
;; Query time: 0 msec
;; SERVER: 10.46.0.53#53(10.46.0.53) (UDP)

status is the verdict: NOERROR, NXDOMAIN (the name doesn’t exist), SERVFAIL (the resolver gave up), REFUSED (the server won’t answer this client). In flags, rd means recursion was requested and ra means the server offers it; an authoritative server usually returns aa instead. The second column of the answer is the TTL, the number of seconds the record may still be cached. RFC 1035, from November 1987, defines it as the interval “that the resource record may be cached before the source of the information should again be consulted.”

For daily use, +short gives “a terse answer,” and +noall +answer clears every display flag and turns the answer section back on, which is the format most of the examples below use.

+trace: walking down from the root

Asking every server on the way instead of trusting one

The manual says +trace “toggles tracing of the delegation path from the root name servers for the name being looked up,” and that dig “follows referrals from the root servers, showing the answer from each server that was used to resolve the lookup.” One subtlety catches people: “If @server is also specified, it affects only the initial query for the root zone name servers.” After that first step, dig does the walking itself.

In the lab:

$ dig +trace www.lab @10.46.0.10
.           86400   IN  NS  a.root-servers.lab.
;; Received 103 bytes from 10.46.0.10#53(10.46.0.10) in 0 ms
lab.            172800  IN  NS  ns1.lab.
;; Received 98 bytes from 10.46.0.10#53(a.root-servers.lab) in 0 ms
www.lab.        300 IN  A   10.46.9.2
lab.            300 IN  NS  ns1.lab.
;; Received 114 bytes from 10.46.0.20#53(ns1.lab) in 0 ms

Three hops: the root names itself, the root refers lab. to ns1.lab, and ns1.lab answers for www. Every answer comes from the source, not from a cache, which makes +trace the fastest way to prove whether a change exists at the authoritative level at all. If the trace shows the new address and a resolver still shows the old one, the zone is fine and the resolver is caching. If the trace shows the old address, no amount of waiting will help.

The first attempt at this trace failed, and the failure was instructive. The root server’s own name was placed under lab., but the lab. zone didn’t contain it, so dig printed couldn't get address for 'a.root-servers.lab': not found. A nameserver whose name can’t be resolved is a broken delegation, and +trace surfaces it immediately.

An open card catalog drawer, a lookup system that, like DNS, returns whatever is filed

Propagation is a countdown, tested

The resolver keeps the old answer exactly as long as it was told to

The lab run, start to finish:

[t+0s] first query through resolver
www.lab.        300 IN  A   10.46.9.1
[t+15s] same query 15 s later
www.lab.        285 IN  A   10.46.9.1
[t+15s] EDIT ZONE: www -> 10.46.9.2, add new.lab, serial 2, reload authoritative
[t+17s] authoritative, asked directly with +norecurse
www.lab.        300 IN  A   10.46.9.2
[t+17s] resolver, same moment
www.lab.        283 IN  A   10.46.9.1
[t+79s] www still cached?
www.lab.        221 IN  A   10.46.9.1
[t+305s] resolver finally returns 10.46.9.2
www.lab.        300 IN  A   10.46.9.2

The TTL ticks down one second per second. The authoritative server had the new address at t+17; the resolver served the old one until its 300 seconds ran out, then fetched fresh data and started a new 300-second clock. Julia Evans described the real-world version in a 2021 post, DNS “propagation” is actually caches expiring: “a DNS update doesn’t fully take effect until all cached versions of that record have expired.” Nothing travels outward from the authoritative server. Each resolver on earth holds its own copy and lets it expire on its own schedule.

The practical move follows directly, and a Netlify support guide puts it bluntly: “Preparation is the surest way to avoid TTL issues when changing records.” Lower the TTL ahead of a planned change, wait at least one full period of the old TTL, make the change, then raise it again. The cache that matters is the one populated before the TTL dropped.

+norecurse is the other tool here. The manual says it toggles “the RD (recursion desired) bit in the query.” Sent to an authoritative server, it asks for that server’s own data only. Sent to a resolver, it asks “what is in your cache right now?” without triggering a fresh lookup, which is the cleanest way to see what a resolver is holding. The lab resolver at first answered that question with status: REFUSED. The Unbound configuration manual explains why: with access-control: ... allow, “Non-recursive queries are refused,” while allow_snoop “gives both recursive and non recursive access.” After the switch, the peek returned the cached 283 IN A 10.46.9.1.

Negative caching: the record that doesn’t exist yet

A lookup made too early gets remembered

The same run checked a name before creating it:

[t+15s] negative answer, before the name exists
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN
lab.            45  IN  SOA ns1.lab. hostmaster.lab. 1 3600 600 86400 60
[t+17s] new.lab through resolver right after the edit
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN
lab.            43  IN  SOA ns1.lab. hostmaster.lab. 1 3600 600 86400 60
[t+79s] new.lab after the 60 s negative TTL
new.lab.        300 IN  A   10.46.9.3

At t+17 the record existed on the authoritative server, and the resolver still said it didn’t. The SOA record riding along in the NXDOMAIN reply carries its own countdown. RFC 2308, from March 1998, sets that countdown: the TTL “is set from the minimum of the MINIMUM field of the SOA record and the TTL of the SOA itself,” and it governs how long a resolver may cache the negative answer. Here that is the smaller of 60 and 300. Evans flags the same trap: “If you query for a DNS record that doesn’t exist, your resolver might cache the absence of that record.”

The habit that causes it is checking whether a new subdomain works before creating it. That check stores a “no” that outlives the fix.

Three small servers wired to one switch, like a root server, an authoritative server and a resolver

Where people get burned

Six ways dig gets blamed for telling the truth

Querying the wrong resolver. Plain dig name goes to whatever /etc/resolv.conf lists. On a machine using a Pi-hole for DNS blocking, that is the Pi-hole, with its own cache and its own block list. Name the server with @.

Trusting the SERVER line. The test container above returned NXDOMAIN for example.com while dig reported 8.8.8.8 as the server, so something on that path was answering port 53 traffic itself. The defense is comparing answers from several resolvers and from +trace.

Checking a name before creating it. Negative caching, tested above. The fix is patience equal to the SOA minimum, or a resolver that can be flushed.

Flushing one cache and expecting the world to follow. Google Public DNS offers a flush cache tool with the instruction: “If the registrar or DNS hosting for a domain changed recently, flush the main domain name first before flushing subdomains.” That clears Google’s resolver only. Every ISP resolver, router cache and operating system cache keeps its own copy.

Forgetting the delegation. Changing nameservers at the registrar touches records in the parent zone, with the parent’s TTL. Evans notes the TTL on those records “is usually something like 1 day, so this can easily take a day.” The lab’s root zone used a two-day TTL on its lab. delegation, visible in the +trace output as 172800.

Broken nameserver names. The failed first trace in the lab: a delegation pointing to a name nothing resolves. Resolvers fail on it, and +trace shows exactly where.

When propagation is a fair word

The strongest case for the old phrase

From a user’s chair, “propagation” describes something real. A change goes out, and over the following hours a growing share of the world sees it, as millions of independent caches expire on their own clocks. Plotted over time, that looks like something spreading, and calling it propagation is a reasonable name for the curve even if no data moves. Hosting support pages that warn of a day or more are budgeting for the slowest cache with the longest TTL; the same Netlify guide says changes “can sometimes take 24 hours (or more!!!) to take effect,” and that the wait “depends on the TTL value in the previous – not the new record.”

What the phrase hides is control. A TTL is a number the zone owner chose, and every resolver obeying it is following orders. Unbound’s defaults show the ceiling the resolver imposes on its side: cache-max-ttl defaults to 86400 seconds, one day, according to its configuration manual, and serve-expired defaults to “no.” Inside those bounds, the zone owner sets the wait.

DNS also shows up in stranger places than websites. The x9m8 report on an AI agent sandbox escape through a DNS lookup turned on the fact that a name lookup leaves the building even when nothing else is allowed to. Every lookup in this post left a trace somewhere, too, and the traceroute and mtr walkthrough from the day before covers the path those packets took. Every DNS migration eventually runs into the same question: what TTL was on the record the night before the change, and who set it?

Sources

  • BIND 9 manual pages (dig): https://bind9.readthedocs.io/en/latest/manpages.html
  • RFC 1035, Domain Names: Implementation and Specification (November 1987): https://www.rfc-editor.org/rfc/rfc1035
  • RFC 2308, Negative Caching of DNS Queries (March 1998): https://www.rfc-editor.org/rfc/rfc2308
  • Julia Evans, DNS “propagation” is actually caches expiring (December 6, 2021): https://jvns.ca/blog/2021/12/06/dns-doesn-t-propagate/
  • Unbound unbound.conf(5) manual: https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html
  • Google Public DNS, Flush Cache: https://developers.google.com/speed/public-dns/cache
  • Netlify Support, Why do DNS / SSL changes take up to 48 hours to propagate? (TTL) (February 21, 2020): https://answers.netlify.com/t/support-guide-why-do-dns-ssl-changes-take-up-to-48-hours-to-propagate-ttl/9359/1

488 Posts

Peter Kalafatis writes and edits X9M8. He holds a bachelor's degree from LIU Post and a master's in Media Studies from The New School, with academic work in the philosophy of science, human behavior, AI, and memetics.

View All Posts

2 Responses to “How to Troubleshoot DNS With dig: +trace, TTLs and Propagation”

  1. Find What's Using a Port on Linux: ss, lsof, fuser

    […] State column says UNCONN. A DNS server, a game server or anything speaking mDNS will need -u. The dig troubleshooting guide covers the other half of a port 53 problem, once something is actually […]

Leave a Reply

Your email address will not be published. Required fields are marked *