Module 1 · FundamentalsLesson 5 of 886 minBeginner
DNS, the internet's phone book
DNS turns names people can remember into addresses computers can connect to.
Play "First lookup" and count how many servers the resolver has to ask. Then play "Cached" and compare the lookup time.
Computers find each other with IP addresses like 93.184.216.34. People remember names like shop.com. DNS (Domain Name System) connects the two.
The lookup, step by step
- Your browser asks a resolver, usually run by your internet provider or a service like 1.1.1.1.
- If the resolver doesn't know, it asks a root server: "Who handles .com?"
- The root points to the .com servers (the top-level domain, or TLD).
- The .com servers point to shop.com's own name server (the authoritative server).
- That server gives the final answer: the IP address.
The resolver passes the address back to your browser, and the browser connects.
Caching and TTL
Walking the whole tree every time would be slow and would overload the root servers. So every answer comes with a TTL (time to live), for example one hour. Resolvers and browsers keep the answer until the TTL runs out.
That's a trade-off you will see again and again:
- Long TTL: fast lookups, but if you move your server, some users keep going to the old address for a while.
- Short TTL: changes spread quickly, but there are more lookups.
DNS as a tool for scale
DNS can do more than map one name to one address:
- Return several addresses, so different users go to different servers.
- Return the closest servers to each user (geo DNS).
- Stop returning a server that fails health checks, so traffic moves away from it.
So DNS is often the very first step in spreading load across many machines.