Step by step
The example above, written out — the same steps the animation plays.
- 1Look up www.example.org (A). www.example.org is an alias (CNAME) for example.org, so the answer comes in two parts.
- 2Ask the resolver. Nothing cached locally: ask the resolver.
- 3Ask a root server. There are 13 root server names (hundreds of machines). They only know who runs each top-level domain.
- 4Root: try .org. A referral, not an answer.
- 5.org: try example.org's nameserver. The .org servers know which nameserver is in charge of example.org (its NS records).
- 6The authoritative answer. The nameserver returns the CNAME and, since it also runs example.org, its A record in the same reply.
- 7Answer in ~124 ms. The resolver caches every answer for its TTL, so the next person gets it in one hop.
What's happening?
- The browser and operating system check their caches first; a cached answer costs nothing.
- Otherwise a resolver asks the root, then the .org servers, then the domain's own nameserver — or answers from its cache if someone asked recently.
- Every answer carries a TTL saying how long it may be cached; until it expires, changes to the record are not seen.
Complexity
- Time
- 0 queries from cache · up to 4 network queries when nothing is cached
- Space
- Cached answers on every layer, for their TTL
Where you'll meet it
Pointing a domain at a new server, setting up email (MX), using a CDN (CNAME), and every "it works for me but not for them" after a DNS change.
Common mistake
Changing a record and expecting everyone to see it at once. Old answers stay cached until their TTL runs out — lower the TTL before a planned move.
FAQ
What is a TTL?
Time to live: how many seconds an answer may be cached. 3,600 means caches can reuse it for an hour.
What is the difference between A and CNAME?
An A record gives an IP address; a CNAME says "this name is an alias of that name — look that one up instead".
What is an MX record?
It names the server that receives email for the domain, with a priority. Email follows MX, not the website's A record.