What Is DNS? The Internet's Phone Book, Explained
You type example.com into your browser and the page appears, yet machines find each other by IP (Internet Protocol) address, as lesson 2 showed. Something translated the name for you. So what is DNS? This lesson explains the Domain Name System: why names exist, how one lookup travels, why answers are remembered, and what you see when it breaks.
Names for people, numbers for machines
Routers deliver packets by IP address alone, a number such as 203.0.113.7. Numbers suit machines, but people remember words: example.com is easier to recall and type than a string of digits.
Names also let the number change: a site can move to a new server, its owner updates one entry, and visitors keep typing the same name. The Domain Name System (DNS) is the internet's shared directory that turns these domain names into addresses.
Following one lookup, step by step
Your device does not hold the directory. It asks a recursive resolver: a DNS server that does the whole search for you and remembers recent answers. Usually your Internet Service Provider (ISP) runs it, and your home router often relays your questions to it, but you can choose a public one, such as Google's 8.8.8.8 or Cloudflare's 1.1.1.1.
With no saved answer, the resolver works down the name from right to left. Each server it asks either answers or sends it to one that knows more, a reply called a referral:
- A root server, the top of the directory, refers it to the servers for .com, the top-level domain (TLD) at the end of the name. There are 13 named root servers, each copied to many sites worldwide; here is the official list.
- A TLD server for .com refers it to the servers that hold example.com.
- The authoritative server for example.com, which holds the domain's official entries, answers: 203.0.113.7 (an example address).
In the flowchart, follow the numbers: eight messages, yet your device sends only the first and receives only the last.
Each message is small and goes to port 53, usually over UDP (User Datagram Protocol), a lightweight way of sending data that lesson 5 explains. The full walk is rare: a busy resolver already knows the .com servers, so it usually starts at step 4 or later.
Caching and TTL: why answers are remembered
Walking the chain for every click would be slow, so answers are cached: kept as saved copies. Your browser, operating system and resolver each keep their own and check it first.
Every record carries a time to live (TTL), set by the domain's owner: how many seconds a copy may be kept, such as 3600 for an hour. Despite the shared name, this is not the hop counter from lesson 1.
In the timeline, the first lookup walks the chain, while one two minutes later comes from the resolver's saved copy. Once the TTL runs out, the copy is thrown away and the next lookup starts over.
Caching is also why DNS changes take time to spread, called propagation. Nothing pushes a change out: each resolver keeps the old answer until its own copy expires. With a TTL of 86400 seconds (one day), some visitors may reach the old address for up to a day, so owners lower the TTL at least a day before a planned move.
Here the contacts analogy shows its twist: a saved contact stays wrong until you edit it, but a DNS copy expires by itself.
Record types a beginner needs
An authoritative server stores records, entries that each hold one fact about a name. Its type says what kind of fact; five types cover most needs:
- A (address): the name's IPv4 (IP version 4) address, such as 203.0.113.7.
- AAAA ("quad-A"): the IPv6 (version 6) address; four A's, because an IPv6 address is four times as long.
- CNAME (canonical name): an alias that points one name at another, such as www.example.com at example.com; the resolver then looks up that name's address.
- MX (mail exchange): the server that receives the domain's email, with a priority number; lower numbers are tried first.
- TXT (text): free-form notes, often used to prove you own a domain or to list which servers may send its email.
One name can hold several records at once: your browser asks for A and AAAA, a mail server for MX.
When DNS breaks: the internet works, the site does not
If the lookup fails, your browser has no address, so it never even tries to connect. Chrome shows "This site can't be reached" and says the server's IP address could not be found, with a code such as DNS_PROBE_FINISHED_NXDOMAIN. NXDOMAIN (non-existent domain) means DNS replied that the name does not exist.
The giveaway is that your connection is fine: other sites may load, a video call keeps running because it already has its addresses, and the site's server may be healthy. Only the lookup failed.
Common causes are a typo, a domain whose registration (the yearly rental of the name) has lapsed, a missing record, or a resolver that has stopped answering. To tell a broken resolver from a broken name, ask a different resolver, as in the exercise. Lesson 20 goes deeper.
Check yourself
You move your site to a new server and update its A record. An hour later a friend still reaches the old server. Why?
Their resolver or device still holds a saved copy of the old answer whose TTL has not run out. Once it expires, the next lookup fetches the new address.
Chrome says a site's server IP address could not be found, but your video call keeps running. Is your internet down?
No. The call already has its addresses, so the connection works; only the name lookup failed. Check for typos, or ask another resolver to see if yours is at fault.
shop.example.com is a CNAME for shops.host.example. Does that record give your browser an IP address?
Not directly. A CNAME holds another name, not an address, so the resolver then looks up the A or AAAA record of shops.host.example and returns that.