Octet

Walk me through troubleshooting name resolution with dig and nslookup.

Show the answer

Say this first

I query the resolver the client uses, then a different resolver, then the authoritative server. dig name @resolver shows the status (NOERROR, NXDOMAIN, SERVFAIL, REFUSED), the answer, its remaining TTL and which server replied. dig +trace name walks from the root down, which shows where a delegation breaks. dig name @authoritative +norecurse shows the source of truth. Comparing the three tells me whether the fault is the resolver, a cache, or the zone itself.

Go deeper

A healthy answer

Output
$ dig app.example.com @10.0.0.53

; <<>> DiG 9.18.28 <<>> app.example.com @10.0.0.53
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41872
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

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

;; ANSWER SECTION:
app.example.com.        247     IN      A       203.0.113.40

;; Query time: 3 msec
;; SERVER: 10.0.0.53#53(10.0.0.53) (UDP)
;; MSG SIZE  rcvd: 60

Read the status, the flags (aa means an authoritative answer, ra means recursion is available), the TTL (a cached answer counts down), and the SERVER line.

Statuses

StatusMeaning
NOERROR with an answerresolved
NOERROR with ANSWER: 0the name exists, but not with that record type
NXDOMAINthe name does not exist
SERVFAILthe resolver could not get an answer: upstream unreachable, broken delegation, DNSSEC failure
REFUSEDthe server will not answer you, often recursion not allowed for your source
connection timed out; no servers could be reachedthe server is down or port 53 is blocked

Useful options

  • dig +trace app.example.com follows the delegation from the root and shows where it breaks.
  • dig app.example.com @ns1.example.com +norecurse asks the authoritative server directly.
  • dig -x 203.0.113.40 for the PTR record, dig example.com MX, dig example.com SOA.
  • dig +tcp app.example.com tests DNS over TCP 53.

nslookup equivalents

nslookup app.example.com 10.0.0.53 and nslookup -type=mx example.com. "Non-authoritative answer" only means the answer came from a resolver's cache, not from the zone's own server.

Traps

  • Reading "Non-authoritative answer" as an error.
How did you do?Book 9.3 Infrastructure Applications