Notes

Debug DNS with dig

Compare recursive and authoritative answers, inspect status and TTLs, and distinguish DNSSEC signals from local validation.

Start with a full dig response, then compare resolvers and authoritative servers. Keep the name, record type and server explicit. A short answer is convenient for scripts, but it hides the status, flags and authority section that explain most failures.

Ask the question precisely

Tested with BIND dig 9.20.24:

dig example.com. A
dig example.com. A +short
dig @1.1.1.1 example.com. A +dnssec
dig @1.1.1.1 example.com. A +norecurse
dig example.com. A +trace

The final dot makes the name absolute. @1.1.1.1 selects a resolver instead of the one in your system configuration. This is a comparison tool, not a guarantee that the browser uses that resolver: browsers may use encrypted DNS and their own caches.

The header’s status is the DNS response code. rd means recursion was requested, ra means the server offers recursion, and aa means an authoritative answer. +norecurse clears the request’s recursion-desired bit. A recursive server can still return cached data or refuse the request; this flag does not turn it into an authoritative server.

+trace walks delegations from the root and queries servers directly. It is useful when a parent delegation and a child zone disagree. It can fail on networks that permit DNS only through the configured resolver. That failure does not prove normal recursive resolution is broken.

Compare the source with the cache

dig example.com. NS +short
dig @hera.ns.cloudflare.com example.com. A +norecurse
dig @1.1.1.1 example.com. A +noall +answer
dig @1.1.1.1 example.com. A +noall +answer

The authoritative hostname above is a public example; use the NS answer for your own zone. Answer rows contain name, TTL in seconds, class, type and data. A resolver’s TTL normally decreases while an entry is cached. The authoritative TTL is its starting lifetime, not a promise that an old cached value disappears when you publish a new one. Resolver policies and serve-stale behavior can affect observations.

Result Meaning
NXDOMAIN The queried name does not exist
NOERROR, no requested data, usually an SOA NODATA: the name exists but has no answer of that type
SERVFAIL Resolution failed; possible causes include DNSSEC validation and unreachable authorities
Timeout No usable response arrived before the client’s deadline

Do not diagnose NODATA from an empty answer section alone: a referral also has no final answer. Inspect authority records and flags. Negative responses can be cached; the SOA controls the negative-cache lifetime under RFC 2308.

Check signatures and service records

dig @1.1.1.1 cloudflare.com. A +dnssec
dig cloudflare.com. HTTPS
dig @1.1.1.1 _dns.resolver.arpa. SVCB

+dnssec requests DNSSEC records by setting DO. Dig does not thereby become a validating resolver. An ad flag is the resolver’s authenticated-data assertion; trust it only over a trusted path to a resolver whose validation policy you trust. Absence of AD alone does not establish forgery or failure.

HTTPS records can advertise ALPN values such as h3, target names and address hints. Query HTTPS for a website, rather than expecting every site to publish generic SVCB at its apex. Older dig versions can query TYPE65 and TYPE64 if symbolic names are unsupported.

See the BIND dig manual, service-binding specification, and the DNS resolution dive.