Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
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.

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.

The shortcut

Think of the lookup as asking for directions from the top down: root knows the TLDs, the TLD knows the domains, the domain's own server knows the exact address. Each step only knows the next step.

Looking up shop.crumbbakery.com for the first timeStep 1 of 4
  1. Check the caches

    The browser and the operating system have no stored answer, so they ask the recursive resolver.

The trap: after changing a record, people panic when some visitors still see the old site. Usually nothing is broken; old answers are simply cached until their TTL runs out.

Drills

Answer fast — trust the rule.

quick drill

In blog.crumbbakery.com, which part is the subdomain?

quick drill

Which record type maps a name straight to an IPv4 address?

quick drill

In what order does a recursive resolver ask servers on a fresh lookup?

quick drill

The bakery moves to a new server and updates its A record, but some visitors still reach the old one for a few hours. Why?

Remember

  • DNS turns a name people remember into an address computers can route.
  • Top-down directions: root, then TLD, then the domain's authoritative server.
  • Trap: a changed record is not broken, just cached until its TTL expires.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainTracing a lookup

Explain how a browser finds the IP address for shop.crumbbakery.com the first time it is visited, naming the parts of the domain and the servers involved. Then explain why a changed record might not reach every visitor straight away.