DNS — the Domain Name System — is the internet's phone book: it turns a human name like www.example.com into the numeric IP address a computer can actually connect to. The catch is that no single server knows every name on the planet. So instead of one giant lookup table, DNS distributes the knowledge across a hierarchy and walks it one referral at a time.
Reading a name from right to left
www.example.com is read in *reverse* order of authority. The trailing (invisible) dot is the root. To its left, com is the top-level domain (TLD). Then example is the domain, registered under .com. The hierarchy mirrors that structure, and the lookup climbs down it.
Walking the hierarchy
1You ask your recursive resolver to resolve the whole name — it does the chasing and returns only the final answer.
2It asks a root server. The root doesn't know example.com, but it points to the servers for .com.
3It asks the `.com` TLD server, which points to the authoritative servers for example.com.
4It asks the authoritative server, which holds the real records and returns the A record (the IPv4 address).
5The resolver caches that answer for its TTL and hands it back to you.
Recursive vs iterative
*You* do recursive resolution: you ask one resolver and get the final answer. The *resolver* does iterative resolution behind the scenes — each server it asks hands back a referral, not the answer, so it follows the chain step by step.
Caching makes it fast
A cold lookup is roughly three referrals (root, TLD, authoritative). But every answer carries a TTL, so the resolver reuses cached results until they expire. In practice the vast majority of lookups never leave the cache — that's why DNS feels instant.
OperationTimeSpace
Cached lookup · answer already held, within TTLO(1)O(cache)