When you type www.example.com into a browser, how is it turned into an IP address? Explain the roles of the recursive resolver, root servers, TLD servers and authoritative servers, and the difference between recursive and iterative queries.
Show hints
Caches are checked first; the full lookup walks down the name from right to left.
Show the explanation
Model answer. DNS (Domain Name System) is a distributed, hierarchical database that maps names to records such as IP addresses.
Lookup sequence
- Local caches: the browser checks its own DNS cache, then the operating system's resolver cache (and the
hostsfile). - Recursive resolver: if not cached, the OS asks a configured recursive resolver — usually the ISP's, or a public one like 8.8.8.8 or 1.1.1.1. If the resolver has the answer cached, it replies immediately.
- Root servers: otherwise the resolver asks a root server, which does not know the address but replies with a referral to the servers for the
.comtop-level domain. - TLD servers: the
.comservers reply with a referral to the authoritative name servers forexample.com. - Authoritative server: this server holds the zone's records and returns the answer, e.g. an A record (IPv4) or AAAA record (IPv6) for
www.example.com. - The resolver caches the answer for its TTL (time-to-live) and returns it to the client, which also caches it.
Recursive vs iterative
- The client's query to the resolver is recursive: "give me the final answer".
- The resolver's queries to root, TLD and authoritative servers are iterative: each server returns the best referral it has, and the resolver does the next step itself.
Other useful facts
- DNS mainly uses UDP port 53 for speed; it falls back to TCP port 53 for responses too large for UDP and for zone transfers. Encrypted variants include DNS over HTTPS (DoH) and DNS over TLS (DoT).
- Common record types: A, AAAA, CNAME (alias), MX (mail server), NS (name server), TXT (verification, SPF).
Common follow-up: "Why do DNS changes take time to 'propagate'?" Nothing is pushed to the world — resolvers keep serving cached records until their TTL expires. Lowering the TTL well before a planned migration makes the switch faster.
Original UniCircle question. Last reviewed 28 Oct 2026.
