06-01: Exercises¶
Question¶
A DNS resolver (recursive resolver) has a completely empty cache. A client asks it to resolve:
www.example.edu
List, in order, every query and response "hop" the resolver makes to fully resolve this name, from the resolver, to a root server, to a TLD server, to the authoritative server. For each hop, state:
- Who is asking whom
- What is being asked
- What kind of answer comes back — a referral (a pointer to another server) or the final answer (the actual IP address)
Solution¶
Step 0: Understand the setup¶
- The client (e.g., a browser or OS stub resolver) asks its configured recursive resolver to look up
www.example.edu. - The recursive resolver's cache is empty, so it cannot answer immediately from memory. It must walk the DNS hierarchy itself, starting from the root.
- The DNS namespace for
www.example.eduis read right-to-left in terms of authority: .(the root).edu(the top-level domain, or TLD)example.edu(the authoritative zone for the organization)www.example.edu(the specific host record inside that zone)
Step 1: Client → Recursive Resolver¶
- Who asks whom: Client asks the recursive resolver.
- What is asked: "What is the IP address (A record) of www.example.edu?"
- Answer type: None yet — this is the request that kicks off the whole process. The resolver now has to do the work on the client's behalf (that's what "recursive" means: the client makes one request and expects a final answer back).
Step 2: Recursive Resolver → Root Server¶
- Who asks whom: The recursive resolver asks one of the root servers (e.g., one of the 13 lettered root server clusters,
a.root-servers.netthroughm.root-servers.net). The resolver already knows these root server addresses from a built-in "root hints" file — it doesn't need to look those up. - What is asked: "What is the IP address of www.example.edu?"
- Answer type: Referral. The root server does not know the answer itself. It knows only which servers are authoritative for the
.eduTLD. It responds with a referral: the names and IP addresses (glue records) of the.eduTLD name servers.
Example of what the root server returns:
.edu. NS a.edu-servers.net.
.edu. NS b.edu-servers.net.
a.edu-servers.net. A 192.5.6.30 (glue record)
Step 3: Recursive Resolver → TLD Server (.edu)¶
- Who asks whom: The recursive resolver now asks one of the
.eduTLD servers it just learned about (e.g.,a.edu-servers.net). - What is asked: "What is the IP address of www.example.edu?"
- Answer type: Referral. The
.eduTLD server doesn't hold the actualwwwrecord either. It only knows which name servers are authoritative for theexample.eduzone specifically. It responds with another referral: the names/IPs ofexample.edu's authoritative name servers.
Example of what the TLD server returns:
example.edu. NS ns1.example.edu.
example.edu. NS ns2.example.edu.
ns1.example.edu. A 203.0.113.10 (glue record)
Step 4: Recursive Resolver → Authoritative Server (example.edu)¶
- Who asks whom: The recursive resolver asks the authoritative name server for
example.edu(e.g.,ns1.example.edu). - What is asked: "What is the IP address of www.example.edu?"
- Answer type: Final answer. This server is authoritative for the
example.eduzone, meaning it holds the actual DNS records for hosts in that zone, includingwww. It responds with the real A record.
Example of what the authoritative server returns:
Step 5: Recursive Resolver → Client¶
- Who asks whom: The recursive resolver replies to the original client.
- What is asked: N/A — this is the response leg, completing the recursive lookup.
- Answer type: Final answer. The resolver forwards the IP address
203.0.113.42to the client and caches the result (along with the TTL and the intermediate NS records) so future lookups can skip straight to (or closer to) the authoritative answer.
Summary table of hops¶
| # | From → To | Query | Response type | Response content |
|---|---|---|---|---|
| 1 | Client → Recursive Resolver | A? www.example.edu | (request only) | — |
| 2 | Recursive Resolver → Root Server | A? www.example.edu | Referral | NS records + glue for .edu servers |
| 3 | Recursive Resolver → .edu TLD Server |
A? www.example.edu | Referral | NS records + glue for example.edu servers |
| 4 | Recursive Resolver → Authoritative Server (ns1.example.edu) |
A? www.example.edu | Final answer | www.example.edu. A 203.0.113.42 |
| 5 | Recursive Resolver → Client | (reply) | Final answer | 203.0.113.42 |
Final Answer¶
- Hop 1: Client asks recursive resolver — triggers recursive lookup.
- Hop 2: Resolver asks a root server → gets a referral to the
.eduTLD servers. - Hop 3: Resolver asks a
.eduTLD server → gets a referral to theexample.eduauthoritative servers. - Hop 4: Resolver asks the authoritative server for
example.edu→ gets the final answer:www.example.edu = 203.0.113.42. - Hop 5: Resolver returns the final answer to the client and caches it.