FreeConceptDNS
How DNS finds a website
In one sentence: DNS turns a name you can remember into an address a computer can connect to, asking a chain of servers that each know a little more.
Animated diagrams are not available for printing. Get StackKinetic Pro to download this explainer.
Inspect:
Read this explainer as text
First lookup
Beginner
- You type stackkinetic.com. Your computer asks the librarian: where is that?
- The librarian starts at the top of the address book.
- “I don’t know that site, but here’s who handles .com.”
- The librarian asks the .com section.
- “Ask this domain’s own servers. Here’s where they are.”
- The librarian asks the domain’s own servers.
- “Here’s the address!” And it says how long the answer can be remembered.
- The librarian hands you the address and remembers it for next time.
- Now your browser can knock on the right door.
- The website appears. All those lookups took a blink.
Practitioner
- The browser asks its configured resolver for the IP address.
- The resolver asks a root server.
- The root replies with the .com servers.
- The resolver asks a .com server.
- The .com server replies with the domain’s name servers.
- The resolver queries the authoritative server.
- The authoritative server returns the IP address and a TTL.
- The resolver returns the address to the browser.
- The browser connects to the web server’s IP address.
- The page loads.
Architect
- Stub query for the A/AAAA record; local caches missed.
- Iterative query to a root server (usually skipped thanks to caching).
- Referral: NS records for the .com TLD.
- Query to a .com TLD server.
- Referral: NS records (plus glue) for the domain’s authoritative servers.
- Query to the authoritative server for the zone.
- Authoritative A/AAAA answer with TTL; the resolver caches it.
- Answer returned; resolver and OS caches now hold it until the TTL expires.
- TCP/TLS handshake to the resolved address; SNI carries the hostname.
- HTTP response. The DNS chain typically cost tens of milliseconds, once.
Cached answer
Beginner
- You visit the site again a bit later.
- The librarian remembers the address, so no need to ask anyone else.
- Your browser goes straight to the website.
- The page loads, faster than the first time.
Practitioner
- The browser asks the resolver again.
- The resolver answers from its cache.
- The browser connects to the web server.
- The page loads.
Architect
- Stub query; the OS cache may even answer first.
- Cache hit within TTL: no root, TLD or authoritative traffic.
- Connection to the cached address.
- Response. Low TTLs make changes propagate faster but cause more lookups.
Now add…
Take it with you
Pro adds video downloads, with embeds and editable source coming soon. Core explainers are always free to watch.