← All 113 books dig, one query per page
One query per page

dig, one query per page

Thirty lessons for reading dig output with your own eyes: the four zones of a plain reply and its header, footer and OPT lines, +short and the +noall display switches, address and zone queries from A to SOA, asking the authoritative source directly and reading the aa flag, reverse lookups with -x and in-addr.arpa, the statuses NOERROR empty, NXDOMAIN, SERVFAIL and REFUSED, walking the delegation with +trace, cache evidence in falling and diverging TTLs, and trust: the AD bit, +dnssec signatures and comparing resolvers side by side.


Steve Hodgkiss 8 lessons

One dig command, its real output, and how to read it. That's a page.

dig, one query per page

Thirty lessons for reading dig output with your own eyes: the four zones of a plain reply and its header, footer and OPT lines, +short and the +noall display switches, address and zone queries from A to SOA, asking the authoritative source directly and reading the aa flag, reverse lookups with -x and in-addr.arpa, the statuses NOERROR empty, NXDOMAIN, SERVFAIL and REFUSED, walking the delegation with +trace, cache evidence in falling and diverging TTLs, and trust: the AD bit, +dnssec signatures and comparing resolvers side by side.


Set in Space Grotesk, Inter and JetBrains Mono (SIL Open Font License).

Every fact in this book is as the official source states it, fetched and read during this build: the dig(1) man page and the BIND 9 Administrator Reference Manual dig chapter, RFC 1034, RFC 1035 and RFC 2308, the Wikipedia articles on the dig command and DNSSEC, and live observed output captured with DiG 9.18.39 on 2026-10-18 (capture files live-dig-capture.txt and extra-capture-child.txt); TTLs quoted are from the capture moment. Demand evidence from live command output, reconfirmed at dispatch; no facts are sourced from Reddit, Stack Overflow or tutorials. An independent guide, not affiliated with or endorsed by the Internet Systems Consortium.

Your purchase is for personal use only. You do not have redistribution rights: please do not share, resell, or republish this book or its pages.

© 2026 Steve Hodgkiss. All rights reserved. Personal use only; no redistribution rights.

Edition 1.0 · stevehodgkiss.net

Contents

Contents


Part 1 · The plain query
Four sections4
Part 2 · Short forms
The +short habit5
Part 3 · Address queries
Two A answers6
Part 4 · Zone queries
MX, by preference7
Part 5 · Reverse
The -x habit8
Part 6 · Statuses
NXDOMAIN9
Part 7 · The chain
+trace from the root10
Part 8 · Trust
The AD bit11

Observed live, live capture sec. 1: one plain dig example.com A reply has four zones, the header line, the QUESTION section, the ANSWER section, then the footer lines from Query time to MSG SIZE.

dns companion · No. 01
The plain query

Four sections

One reply, four labelled zones

one plain reply, four labelled zones1;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 521542;; QUESTION SECTION:;example.com. IN A3;; ANSWER SECTION:example.com. 177 IN A 104.20.23.1544;; Query time: 2 msec ;; SERVER: 127.0.0.53#53 ;; MSG SIZE rcvd: 72header, question, answer, footer: read top to bottom, every time

Every plain dig reply has the same skeleton, top to bottom: the header line, the QUESTION section, the ANSWER section, the footer lines. The capture shows them all in one screen for example.com A.

The header tells you what happened. The question echoes what you asked. The answer is the payload, here two A records. The footer is the receipt: how long, from whom, when, how many bytes.

Learn the skeleton once and every dig output you ever see becomes navigable.

RUN IT THIS WEEK

Run dig example.com A and name the four zones out loud before reading any record.

Per dig(1), +short toggles whether a terse answer is provided; observed live, capture sec. 2: two bare addresses, 104.20.23.154 and 172.66.147.243, and nothing else.

dns companion · No. 02
Short forms

The +short habit

Just the data, nothing else

same answer, two dress codes;; ->>HEADER<<- ... id: 52154;; QUESTION SECTION:example.com. 177 IN A 104.20.23.154example.com. 177 IN A 172.66.147.243;; Query time: 2 msec;; MSG SIZE rcvd: 72$ dig +short example.com104.20.23.154172.66.147.243no header, no status,no proof: just the data+short prints the rdata and hides everything that explains it

For scripts and quick checks, the whole apparatus is noise. +short prints only the record data, one value per line: two addresses for example.com, nothing else.

The trade is real: no status, no counts, no proof. A typo'd name prints nothing and looks identical to a real empty answer. When debugging, run the plain form too.

+short for consuming, plain dig for understanding. Use each knowing which you are doing.

RUN IT THIS WEEK

Resolve three names with +short, then rerun one without it and list what +short hid.

Observed live, capture sec. 1: example.com returned two A records, 104.20.23.154 and 172.66.147.243, each on its own line with TTL 177 at the moment of capture.

dns companion · No. 03
Address queries

Two A answers

One name, two addresses

one name, two addressesexample.com.104.20.23.154172.66.147.243TTL 177TTL 177two A records, both the name: round robin, both must serve

Nothing forbids several A records for one name. Here example.com is 104.20.23.154 and 172.66.147.243 at once, two lines, one name, round robin.

Clients usually take the first and cache both. Operationally it means either address must serve: test against both, or one day the other half of the traffic is the outage.

Count the ANSWER lines before you pick an address. The second one is not a backup, it is half the name.

RUN IT THIS WEEK

Resolve five names you use daily with +short and count how many return more than one address.

Observed live, capture sec. 4: gmail.com MX returned five records, preferences 5, 10, 20, 30 and 40, printed in arrival order, not preference order.

dns companion · No. 04
Zone queries

MX, by preference

The small number goes first

preference is a cost: the lowest number goes first40 alt4...l.google.com.30 alt3...l.google.com. 5 gmail-smtp-in.l.google.com.20 alt2...l.google.com.10 alt1...l.google.com.as printed: arrival order, not preferencesort -n if the order mattersthe numberis a cost,5 is tried first;10 waits behind 5;40 is last resortequal numbers shareread the preference column, not the row order

The MX number is a cost, not a rank of quality. Preference 5, gmail-smtp-in.l.google.com, is tried first; 40 is the last resort. Lower reaches the mail first.

dig prints the rows in whatever order they arrived, observed 40, 30, 5, 20, 10. Sort by the number when order matters. Equal numbers mean the zone wants the load shared.

When mail flows to the wrong host, this column is the first thing to check.

RUN IT THIS WEEK

Ask MX for three mail providers, sort each by preference, and confirm the lowest number is the primary.

Per dig(1), with -x dig performs a lookup for a name like 94.2.0.192.in-addr.arpa and sets the query type and class to PTR and IN; observed live, capture sec. 9: dig -x 1.1.1.1 answered one.one.one.one.

dns companion · No. 05
Reverse

The -x habit

Reverse lookups, one flag

one flag, and the question is built for you$ dig -x 1.1.1.1no name, no type to type;1.1.1.1.in-addr.arpa. IN PTR1.1.1.1.in-addr.arpa. 1405 IN PTR one.one.one.one.an ordinary query, made of anaddress turned into a name-x sets the name, type PTR and class IN for you

Addresses have names too, and dig has a flag for asking: dig -x 1.1.1.1. No name to type, no type: -x builds the question and sets type PTR, class IN for you.

Everything else is an ordinary query. Observed live: question 1.1.1.1.in-addr.arpa. IN PTR, answer one.one.one.one., TTL 1405, the same four zones as ever.

Logs full of addresses become names with one flag. That is the whole habit.

RUN IT THIS WEEK

Run dig -x 8.8.8.8 and dig -x for your own IP, and compare the two QUESTION sections.

Observed live, extra capture E1: dig nxdomain-check-11347.invalid returned status: NXDOMAIN, flags qr aa rd ra ad, ANSWER: 0; per RFC 1035 RCODE 3 is a name error, and per RFC 2308 resolvers negative-cache it.

dns companion · No. 06
Statuses

NXDOMAIN

The name does not exist

the name does not exist$ dig nxdomain-check-11347.invalid;; status: NXDOMAIN, id: 43744;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 0,zero answers, and the word is NXDOMAIN, not NOERRORRCODE 3:a name error,per RFC 1035negative-cachedper RFC 2308so retrying will not helpbefore diagnosing: retype the name; NXDOMAIN is often a typo

NXDOMAIN is the strongest no in DNS: this name does not exist, not under this zone, not with any type. Captured live, the .invalid tree answered exactly that, zero answers, flags qr aa rd ra ad.

Two consequences. Per RFC 2308 the no is negative-cached: retrying immediately changes nothing. And in practice the usual cause is a typo, so retype before you diagnose.

When NXDOMAIN is real, it ends the search. When it is yours, it ends the typo.

RUN IT THIS WEEK

Run dig nxdomain-check-11347.invalid and read the status, then try a deliberate typo of a real domain.

Per dig(1), +trace toggles tracing of the delegation path from the root name servers and dig makes iterative queries following referrals; observed live, capture sec. 12: root, then net, then cloudflare, four Received lines.

dns companion · No. 07
The chain

+trace from the root

Walk the delegation

dig walks the delegation itselfroota-m.root-servers.netreferral: ask net.net.a-m.gtld-servers.netreferral: ask cloudflarestevehodgkiss.net.lloyd, mia.ns.cloudflare.comthe answer, at 300three hops, three Received lines: root, tld, the zone's own servers

A normal dig delegates the walking to one resolver. +trace makes dig do the walk itself: start at the root servers, follow each referral down.

Observed live, three hops: the root's 13 NS names, then net. at the gtld servers, then lloyd and mia.ns.cloudflare.com holding stevehodgkiss.net, then the answer. Each hop ends with a Received line naming the server that spoke.

It is the whole lookup chain from the concepts book, now visible, hop by hop, on your own screen.

RUN IT THIS WEEK

Run dig stevehodgkiss.net +trace and name each zone that referred you onwards, using the Received lines.

Observed live, capture sec. 16: the same cloudflare.com ask showed flags qr rd ra on one server and qr rd ra ad on another; per RFC 4033, the AD bit hints that the recursive server validated the response signatures.

dns companion · No. 08
Trust

The AD bit

The resolver validated it

one flag, added by a resolver that checkedwithout validation shown:;; flags: qr rd rathe same name, validating server:;; flags: qr rd raadauthentic data:the resolver says itchecked the wholechain of signaturesa hint from themachine, not the zoneno ad does not mean fake: ask a validating resolver before concluding

One letter in the flags line changes what a reply is worth. ad, authentic data: the resolver says it checked the signatures on this answer, the whole chain.

Observed live, the same name came back qr rd ra from one server and qr rd ra ad from another. The record was identical; the trustworthiness travelled separately, from the validating resolver.

No ad does not mean fake. It means this resolver does not vouch. Ask a validating one before concluding.

RUN IT THIS WEEK

Ask a signed domain through @1.1.1.1 with +dnssec and find ad in the flags; check whether your default resolver sets it.

Index

Index


+trace from the root10
Four sections4
MX, by preference7
NXDOMAIN9
The +short habit5
The -x habit8
The AD bit11
Two A answers6