Skip to the workspace
Pebellslearn by building
How the Internet Works  ›  Lesson

Domain Names and DNS

DNS and how it works? 15 minA domain name is a rented, human-friendly name read from right to left, and DNS translates it into an IP address by asking root, TLD and authoritative servers, caching each answer for its TTL.

frontend / Domain Names and DNS

Explore each scene at your own pace.

01 · The rule

The rule

Domain Names and DNS

Routers deliver to IP addresses, but nobody wants to print 203.0.113.10 on a bakery's paper bags. People remember crumbbakery.com. Something has to translate the friendly name into the number every time someone visits, and do it in a few milliseconds. That something is the Domain Name System.

The rule

DNS turns a name people remember into an address computers can route.

Reading a domain name. Read it from right to left, from the most general part to the most specific:

  • com is the top-level domain (TLD). Others include org, dev, in and uk.
  • crumbbakery is the name the bakery registered under com. Together, crumbbakery.com is its domain.
  • www or shop in front is a subdomain, a sub-name the owner creates freely, such as shop.crumbbakery.com.

You do not buy a domain forever. You rent it, usually by the year, from a registrar, which records you as the holder.

DNS records. The domain's owner publishes records that say where things live:

Record Answers Example value
A the IPv4 address 203.0.113.10
AAAA the IPv6 address 2001:db8::10
CNAME "this name is an alias of that name" shop → crumb.shops.example.net
MX which server receives email mail.crumbbakery.com

The lookup. When the browser needs the address, it first checks caches (its own, then the operating system's). On a miss, it asks a recursive resolver, usually run by the internet provider or a public service. The resolver does the legwork:

  1. It asks a root server: "who handles .com?"
  2. It asks the .com TLD server: "who handles crumbbakery.com?"
  3. It asks that domain's authoritative server: "what is the A record for crumbbakery.com?"

Every answer carries a TTL (time to live), the number of seconds it may be cached. Caching makes repeat lookups instant, and it is also why a changed record can take a while to reach everyone.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.