Find a course

Module 2: Addresses and NamesLesson 4 of 1012 min

DNS: The Internet's Phone Book

Follow a DNS lookup from your device to root, top-level-domain and authoritative servers, and see how caching, TTLs and DNS problems affect you.

Step 1 of 12Learn

Names for people, numbers for machines

Routers deliver data using IP addresses, but nobody wants to type 93.184.215.14 to visit a website. People remember names like wikipedia.org. The Domain Name System (DNS) connects the two: it translates human-friendly domain names into IP addresses.

DNS is often called the internet's phone book, though it's more like a huge, distributed directory spread across millions of servers worldwide. No single computer holds all the names. Instead, responsibility is divided into a hierarchy.

Read a domain name from right to left to see the hierarchy:

  • www.example.com. (the final dot, usually invisible, stands for the root)
  • com is the top-level domain (TLD). Others include org, net, edu, gov and country codes like uk, de, jp and my.
  • example is the second-level domain, the part an organization registers.
  • www is a subdomain, which the domain's owner can create freely, like mail.example.com or shop.example.com.

Organizations rent domain names through companies called registrars, usually for a yearly fee. Owning example.com gives you control of everything ending in .example.com.

Every time you open a site or app, a DNS lookup usually happens first, often in just a few milliseconds.

Step 2 of 12Practice · Match the pairs

Match each part of the name "news.school.edu" to its role.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. edu
  2. school
  3. news

Step 3 of 12Practice · Diagram

The DNS hierarchy

Which node is the top-level domain for news.school.edu?

Tap the shape that answers the question, then press Check.

The DNS hierarchyHierarchy diagram: Root (.), .com, .org, .edu, example.com, wikipedia.org, school.edu, www.example.com, news.school.edu.Root (.).com.org.eduexample.comwikipedia.orgschool.eduwww.example.comnews.school.edu
Root (.)

The top of the tree, served by 13 named root server systems with many copies worldwide.

.com
.org
.edu

A top-level domain (TLD).

example.com
wikipedia.org
school.edu

A domain registered under .edu.

www.example.com
news.school.edu

A subdomain, set up by whoever owns school.edu.

Step 4 of 12Learn

Following a lookup

Say you type www.example.com and your device doesn't already know the address. Here's what typically happens:

  1. Your device asks a recursive resolver, usually run by your ISP or a public DNS service. The resolver's job is to find the answer on your behalf.
  2. If the resolver hasn't seen this name recently, it asks a root server: "Where is www.example.com?" The root doesn't know, but it replies: "Ask the servers for .com." (There are 13 named root server identities, operated by different organizations and copied to well over a thousand locations worldwide.)
  3. The resolver asks a .com TLD server, which replies: "Ask example.com's authoritative name server, here's where it is."
  4. The resolver asks the authoritative server, which holds the official records for example.com. It answers with the IP address.
  5. The resolver returns the address to your device, which can now connect to the website's server.

This might sound slow, but each step typically takes milliseconds, and most lookups skip steps thanks to caching.

The answer comes from a DNS record. The most common types: an A record gives an IPv4 address, an AAAA record gives an IPv6 address, a CNAME points one name to another name, and an MX record says which servers handle email for the domain.

Step 5 of 12Practice · Put in order

Put the steps of an uncached DNS lookup in order.

Drag the items, or use the arrow buttons, to put them in order.

  1. The resolver asks a root server
  2. The resolver asks the .com TLD server
  3. Your device receives the IP address and connects
  4. Your device asks a recursive resolver
  5. The resolver asks the domain's authoritative name server

Step 6 of 12Practice · Diagram

An uncached lookup, round trip

Which server actually knows the final address?

Tap the shape that answers the question, then press Check.

An uncached lookup, round tripCycle diagram: Your device asks resolver → Root: "ask .com servers" → .com: "ask example.com's servers" → Authoritative: "it's 93.184.215.14" → Resolver answers and caches.www.example.com?Your device asksresolverRoot: "ask .comservers".com: "askexample.com'sservers"Authoritative:"it's93.184.215.14"Resolveranswers andcaches
Your device asks resolver
Root: "ask .com servers"
.com: "ask example.com's servers"
Authoritative: "it's 93.184.215.14"

The authoritative server holds the real records for the domain.

Resolver answers and caches

It stores the answer for the record's TTL so the next lookup is instant.

Step 7 of 12Learn

Caching and TTL

If every lookup went all the way to the root, the root servers would drown in billions of requests. The solution is caching: storing recent answers so they can be reused.

Answers get cached in several places: your browser, your device's operating system, your home router and, especially, the recursive resolver. If thousands of people using the same ISP visit a popular site, the resolver looks it up once and answers everyone else from its cache.

How long can an answer be reused? Each DNS record includes a TTL (time to live), set by the domain's owner, in seconds. A TTL of 3,600 means "you may reuse this answer for up to one hour." After that, the cache must ask again.

TTL involves a trade-off:

  • Long TTLs (hours or a day) mean fewer lookups and faster browsing, but changes spread slowly. If a site moves to a new server, some people may keep being sent to the old address until their cached answer expires.
  • Short TTLs (a few minutes) let changes take effect quickly, at the cost of more lookups.

That's why website owners planning a move often lower their TTL a day or two in advance. It's also why "clear your DNS cache" is a classic troubleshooting step: it forces your device to fetch a fresh answer.

Step 8 of 12Tap to reveal

Where a DNS answer can be waiting

  1. 1. Browser cache

    Your browser remembers recent lookups for a short time, so reloading a page skips DNS entirely.

  2. 2. Operating system cache

    Your phone or computer keeps its own cache shared by all apps.

  3. 3. Home router

    Many routers also cache answers for every device on the network.

  4. 4. Recursive resolver

    Your ISP's or a public resolver serves millions of users, so popular names are almost always already cached there.

  5. 5. Only then: root, TLD, authoritative

    A full lookup happens only when every cache has missed or the TTL has expired.

Step 9 of 12Practice · Work it out

A DNS record has a TTL of 7,200 seconds. For how many hours can a resolver reuse the cached answer?

Step 10 of 12Note

Step 11 of 12Practice · What would you do?

What would you do?

Marcus can open sites by typing their IP addresses, and video calls already in progress keep working. But typing any website name gives an error like "server not found."

Step 12 of 12Practice · Choose one

What does an A record in DNS provide?