๐ Query types: recursive, iterative, forwarding
Asks a recursive resolver to go and find an answer.
dig @1.1.1.1 example.com AGO rd and ra on the flags line, and an answer
NO GO rd with no ra, which means that server will not recurse for you
RFC 1035 section 4.1.1 defines the RD, RA, and AA bits in the header. RFC 1034 section 4.3.1 describes the recursive and iterative modes those bits select. RFC 9499 is the current DNS terminology glossary.
| Mode | RD | RA | AA | Who does the walking |
|---|---|---|---|---|
| Recursive | 1 | 1 | 0 (usually) | the resolver |
| Iterative | 0 | n/a | 1 if the server owns the zone | you, hop by hop |
| Forwarding | 1 | 1 | 0 | a different resolver, on this one's behalf |
Recursive query (RD=1)#
client --RD=1--> resolver --...do the work...--> resolver --answer--> clientEvery stub resolver sets RD by default. The client never speaks to an authoritative server directly; the resolver does the walking and returns one answer. The capture above is a recursive query: rd and ra are both set.
Iterative query (RD=0)#
client --RD=0--> resolver
returns whatever it has, with referrals if needed
client itself walks the next hopA recursive resolver iterates on the client's behalf: root, then TLD, then the zone's authoritative servers. +norec on dig sets RD=0, for asking an authoritative server directly.
dig -4 @pns2.isitdns.net probe.isitdns.net SOA +norec;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: ...
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
probe.isitdns.net. 5 IN SOA pns2.isitdns.net. hostmaster.isitdns.net. \
2026082002 7200 3600 1209600 300aa is set because pns2.isitdns.net owns probe.isitdns.net. rd is absent because the query sent RD=0, and the server leaves it unset in the response. The serial number changes on every zone edit, so it will differ from the capture above. Watch the walk itself with dig +trace (dig reference): each referral hop prints as its own block, root to TLD to authoritative.
Forwarding#
client --RD=1--> local resolver --RD=1--> upstream resolver --answer--> ...The local resolver doesn't iterate: it passes the query to a configured upstream and returns whatever comes back. Forwarding requires recursion: a server with recursion disabled has nothing that reads its forwarders list. See forward for how forward zones are configured, including conditional forwarding by name.
Gotchas#
rdwithoutrafrom an authoritative server is normal. Servers echordback even when they will not recurse.adon its own proves nothing. Requesting+dnssecsets the DO bit, notad; the resolver setsadonly when it validates, and it can be stripped on the path (RFC 6840 section 5.8).- Forwarders enabled with an empty list still iterates from root. Confirm the path with
dig +tracefrom the resolver itself. raset on a server you expect to be authoritative-only usually means a middlebox is answering in its place, not the server itself: something on the path intercepts port 53 (captive portals, some routers) and responds directly.