Question presented to candidate:
"When I type www.example.com into a browser, how does my computer find out which IP address to connect to? Walk me through every server involved, and tell me where caching happens and what that means when we change a DNS record."
What a strong answer should cover:
The cast: the stub resolver on the device, a recursive resolver (ISP, company, or public such as 1.1.1.1 or 8.8.8.8), and the root, TLD and authoritative name servers, each answering with a referral or an answer
Iterative queries from the recursive resolver down the hierarchy versus the recursive query the stub sends to it
Caching at every layer (browser, OS, recursive resolver) governed by the record TTL, including negative caching of NXDOMAIN; a warm cache answers in zero upstream queries
Record types that matter in design: A/AAAA, CNAME (and why CDNs use it), NS, plus TTL strategy before a migration (lower it in advance)
Transport: UDP port 53 by default, TCP fallback for large answers, EDNS(0), and encrypted DNS (DoT, DoH)
DNS as a system-design tool and risk: GeoDNS and weighted records for traffic steering, and DNS as a single point of failure
Code / implementation expected: No โ a clear walk-through of the lookup path and caching is the answer; the example simulates a resolver for anyone who wants to see it step by step.
networking
dns
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Beginners to system design โ you have used a browser; no networking background assumed.
Difficulty: Easy
Verified with: Node 22.22 and Python 3.12 (both print identical output).
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also learn the exact words an interviewer expects. Behaviour claims come from running the example; the Verified section quotes the full output.
1. Why This Even Matters โ A Story First
You want to call a friend, but you only know their name. You ask the receptionist at your office. The receptionist does not know either, so she calls the national directory, which says "I do not keep individual numbers, but the directory for that city is at this number." The city directory says "for that street, ask the building manager." The building manager finally gives
The solution is hidden so you can try first
15 min read ยท 11 sections
4
Read the code
A recursive resolver: referrals, TTL cache, CNAME chain, negative caching