Interview Q&A / Computer Networks

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is the difference between a recursive and an iterative DNS query?

SHORT ANSWER

In a recursive query, the client asks a resolver to do all the work and return a final answer. In an iterative query, the server replies with its best referral and the asker follows it to the next server. Your device asks recursively; the resolver then asks iteratively.

Explain it simply

Recursive is telling a travel agent "get me a train ticket" and waiting. Iterative is going to the enquiry counter yourself, being told "try counter 5", then "try counter 9", until you get the ticket.

Example

text
Your phone -> resolver (8.8.8.8 or ISP)     recursive: "give me the final IP"
Resolver   -> root server                    iterative: "ask the .com servers"
Resolver   -> .com TLD server                iterative: "ask ns1.example.net"
Resolver   -> ns1.example.net                iterative: "203.0.113.10"
Resolver   -> phone                          answer, cached for the record's TTL

Root and TLD servers do not do recursion. They would be overloaded if they did the work for the whole world, so they only refer. The recursive resolver also caches answers, so the second person asking for the same name gets a fast reply without repeating the walk.

Your own device runs a small stub resolver that just forwards the question to the configured resolver.

What to say in the interview

"The stub resolver sends one recursive query to a resolver. The resolver performs iterative queries starting at the root, following referrals down to the authoritative server, and caches the result."

Common mistakes

  • Saying the root server returns the final IP address. It only refers to the TLD servers.

#dns#recursive#resolver

Related questions

Practise more Computer Networks questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Computer Networks quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.