DNS Resolution Process: Iterative Queries
You'll learn how DNS resolvers navigate the hierarchy step-by-step when nameservers provide referrals instead of final answers.
What Are Iterative Queries?
In an iterative query, the DNS resolver does all the work of walking up and down the DNS hierarchy. When you contact a nameserver, it doesn't fetch the answer for you—instead, it gives you a referral pointing to the next nameserver that might know the answer. Your resolver must then make another query to that referral, repeating the process until it gets a definitive answer.
How It Works
Imagine asking for directions at a gas station. Instead of giving you the full route, the attendant says, "I don't know exactly, but ask the person at the library down the street." You drive there, ask again, and they say, "Try the post office on Main Street." You keep asking until someone finally gives you the complete directions.
Here's the DNS version for looking up www.example.com:
- Your resolver queries a root nameserver
- Root responds: "I don't have that, but ask the
.comnameserver at this IP" - Resolver queries the
.comnameserver .comresponds: "I don't have that, but askexample.com's nameserver"- Resolver queries
example.com's authoritative nameserver - Finally gets the A record with the IP address
Iterative vs Recursive
Unlike recursive queries (where the nameserver does the legwork), iterative queries put the burden on the client resolver to follow each referral manually. Most actual DNS implementations use recursive queries to local resolvers, which then use iterative queries to contact other nameservers.
Key Takeaway: Iterative queries return referrals instead of answers, requiring the resolver to make successive queries up the DNS hierarchy until reaching the authoritative source.