Heads up: posts on this site are drafted by Claude and fact-checked by Codex. Both can still get things wrong — read with care and verify anything load-bearing before relying on it.
why → how

Why is DNS hierarchical?

DNS could have been a giant flat lookup table — one machine somewhere mapping every name in the world to an IP. It isn't, and the reason is less about technology than about who gets to be in charge of what.

Networking intermediate Apr 29, 2026 · updated Aug 11, 2026 · 11 min read

On this page

The picture version

The whole idea in seven pictures, for a reader who knows nothing about DNS. The prose below fills in the seams the pictures skip.

1 · The problem

You speak names. The internet speaks numbers.

you mail.example.com a computer, somewhere 203.0.113.42 ? which number is this name?
DNS answers exactly one question: what number (IP address) belongs to this name? Everything below is just who you ask.

2 · The old way

At first, it really was one big list.

HOSTS.TXT every computer on Earth, one file, kept by one office “copy it, again” “copy it, again” ONE FILE · ONE BOSS · TOO SLOW
In the early 1980s the whole internet's names lived in one text file, HOSTS.TXT, kept by a single office that every computer copied. It broke the moment the internet grew: names collided, copies went stale, and one office decided everyone's names.

3 · The trick

Read the name backwards.

computers read it this way mail . example . com . start: the root (a dot you never type) stop 1 stop 2 stop 3: the answer
To DNS the name is really com → example → mail, starting from an invisible root dot at the end. Every dot is a hand-off from one desk to the next.

4 · The walk

A chain of receptionists, each holding one card.

you RESOLVER the helper that walks the chain for you name? number! THE ROOT “.com? Ask those desks →” .com “example.com? Ask them →” example.com 203.0.113.42 ✓ 1 2 3 same question three times: “mail.example.com?”
The resolver asks the same question three times. The root and .com don't know the answer — each card only points one desk further down. Only example.com's own server holds the number.

5 · The secret

Each hand-off gives away power, not data.

· root .org .com .uk “your job now” example.com “your job now” mail api staging YOURS. add anything, ask nobody
The root never learns your numbers; .com never learns what lives under example.com. That's why you can invent staging.example.com tonight without asking anyone on Earth — and why no single office runs the internet's names anymore.

6 · The shortcut

Mostly, nobody walks the chain at all.

you asks instant RESOLVER'S DRAWER mail.example.com = 203.0.113.42 photocopy — good for 1 hour · root .com example.com skipped — asked earlier, copy still fresh
Every answer comes with a timer (a TTL): “you may keep this copy for so many seconds.” While copies are fresh, lookups are instant and the chain rests. When you change a record and it “takes hours to propagate” — that's just old photocopies finishing their countdowns.

7 · Keep this card

The whole thing on one index card.

DNS = a tree of names + a hand-off of power at every dot + photocopies with timers
Picture to keep: a chain of receptionists, each holding one card that points one desk further down — and a helper near you who photocopies every card it sees. The tree exists so power can be handed off; the photocopies make it fast.

Why it exists

You register example.com for the price of a sandwich. Ten minutes later you have mail.example.com, api.example.com, and staging.example.com, and you invented all three yourself — no application form, no committee, nobody at ICANN even aware they exist. That’s odd if you think of DNS as a big global directory: how does the world’s directory let a stranger add rows without asking? It’s the delegation, and mail.example.com is the example this whole post follows.

In the early 1980s the entire internet’s name-to-address mapping lived in a single text file called HOSTS.TXT, maintained by the SRI-NIC and copied around by every host that wanted to know what mit-multics resolved to. This worked when “the internet” was a few hundred machines run by people who knew each other. It stopped working the moment it didn’t.

Three things broke at once:

  1. Name collisions. Only one machine in the world could be called vax. With one global file, every new host had to ask a central authority before picking a name.
  2. Update lag. Every host pulled HOSTS.TXT periodically. Adding a machine meant waiting for the file to propagate, and the file kept getting bigger.
  3. A single point of administrative failure. SRI-NIC was the bottleneck for every name change anywhere on the network. Worse, it was the wrong group of humans to be deciding what a university lab in Berlin should call its server.

DNS — the Domain Name System — was the redesign. The technical pieces — caching, UDP queries, resource records — are interesting, but the load-bearing idea is the shape of the namespace. It’s a tree. And the tree exists primarily so that authority can be delegated.

Why it matters now

Every modern system that has to name things at scale ends up with the same shape: Kubernetes namespaces, Java packages, npm scopes, AWS resource ARNs, S3 bucket subpaths, even file systems. The reason is the same reason DNS is hierarchical, and once you see it once you see it everywhere: hierarchy is how you split naming from control without losing either.

For an engineer this matters in concrete ways. When you register example.com, you’re not buying a row in some giant database — you’re being delegated authority over the entire subtree below example.com. Nobody at the root needs to know or approve when you create api.staging.example.com. That delegation is also what lets DNS scale, what lets caching work, and what determines whose key signs what under DNSSEC.

The short answer

DNS = tree of names + delegation of authority at every edge + caching

Picture to keep: a chain of receptionists, each holding one index card — the root’s card says “for .com, ask these servers,” .com’s card says “for example.com, ask these nameservers,” and only the last card in the chain has an actual address written on it. Where the picture breaks: in practice you rarely walk the chain, because a resolver near you kept a photocopy of the last card it fetched.

DNS is hierarchical because the names are the cheap part. The expensive part is deciding who’s allowed to say what something.com resolves to, and the tree is the data structure that lets that authority be handed off cleanly at every level. Caching then makes the whole thing fast enough to be invisible.

How it works

Naive fix for HOSTS.TXT: keep the flat table, just put it on a big server everyone queries. That solves propagation lag and nothing else. Your new mail.example.com still has to be entered by whoever runs that server, name collisions still need a global referee, and the whole internet’s naming now depends on one operator’s uptime and one operator’s judgment. The fix has to remove the central decision, not just the central file.

So: read a domain name right-to-left. mail.example.com is really com → example → mail, with an invisible root . at the very end. Each dot is a hand-off point.

The root is tiny on purpose. The root zone — the contents of . — only needs to know one thing per TLD: where to find the name servers for com, for org, for uk, and so on. That’s a small list. It’s served by the 13 root server letters, each of which is actually many machines spread around the world via anycast. The root almost never changes, so this works.

Each TLD operator runs its own zone. The .com registry operator (Verisign) doesn’t have to know your domain’s IP — it only has to know which name servers you’ve declared as authoritative. When a resolver asks .com “where is example.com?”, it doesn’t get an answer, it gets a referral: the NS records naming your nameservers, plus glue records with their IP addresses when those nameservers live inside the domain being delegated.

You run the leaves. Or your DNS provider does. Either way, the authoritative servers for example.com are the source of truth for mail.example.com — the only place the record is decided. Copies live all over the internet in resolver caches, but no level above you stores your records as anything but a delegation pointing down. That’s the trick: each level only knows enough to point further down.

flowchart TD
    Root["· root — knows where each TLD lives"] -->|delegates .com| COM[".com / Verisign — knows your nameservers"]
    Root -->|delegates .org| ORG[".org"]
    Root -->|delegates .uk| UK[".uk"]
    COM -->|delegates example.com| EX["example.com nameservers — knows the actual IPs"]
    EX --> MAIL["mail.example.com"]
    EX --> API["api.example.com"]

Each edge is a hand-off of authority, not a copy of data: the root never learns your IPs, and .com never learns what lives under example.com. Every level only knows enough to point one step further down.

A typical resolution looks like this:

client → resolver:           "mail.example.com?"
resolver → root:             "mail.example.com?"
root → resolver:             "ask the .com servers, here they are"
resolver → .com:             "mail.example.com?"
.com → resolver:             "ask example.com's nameservers, here they are"
resolver → example.com NS:   "mail.example.com?"
example.com NS → resolver:   "203.0.113.42"
resolver → client:           "203.0.113.42"

In practice most queries never do this walk. Your resolver did some of it earlier — the root and .com referrals in particular tend to sit in cache for a long time — and serves the rest from whatever it still holds. Each record carries a TTL, which is a ceiling on caching, not a promise of freshness: it says “don’t keep this longer than N seconds,” and a resolver is free to discard it sooner.

Why a tree, not a hash table?

You could imagine an alternative universe with a flat namespace and a distributed hash table — example.com is just a key, and some peer-to-peer protocol stores the value. People have built this; it doesn’t replace DNS, and the reason is mostly social, not technical.

A flat namespace forces a single answer to “who decides which names are allowed?” A tree lets that question be answered differently in every subtree. ICANN coordinates which TLDs exist. .com names are sold by registrars under policy set for that registry, with Verisign operating the zone. You decide what lives under your .com. Your team lead decides what lives under team.example.com. The same data structure that organizes the names also organizes the politics, and that turns out to be the thing you can’t skip.

Show the seams

A few places the clean story doesn’t quite hold:

You started with DNS = tree of names + delegation + caching. What did the walk down the tree add that the one-liner hides? — + each edge is a hand-off of authority, not a copy of data. That single property is why you could invent mail.example.com unilaterally, why the root zone stays tiny enough to fit on 13 named identities, and why DNSSEC’s chain of signatures has an obvious shape to follow: it just retraces the delegations.

Check yourself

Before you go — you cut the TTL on mail.example.com from 86400 to 60, wait five minutes, then change the IP. A colleague still gets the old address. What are the plausible explanations?

Answer

Lowering a TTL only affects copies handed out after the change. Any resolver that fetched the record before you lowered it is still counting down the old 86400 — so you need to lower the TTL at least one old-TTL period before the actual change, not five minutes before. Other candidates: your colleague’s resolver or OS/browser holds its own cache, or something in the path ignores small TTLs. The general lesson is that the “propagation” you’re waiting on is a set of independent countdowns you don’t control.

And one more — if .com’s nameservers went down entirely for an hour, would mail.example.com stop resolving for everyone?

Answer

Not for everyone, and not immediately. Any resolver that already has the example.com nameserver referral cached can skip .com and go straight to your authoritative servers; resolvers with the final A record cached don’t even do that. The outage bites the resolvers whose cached entries expire during the hour, plus anyone resolving the name for the first time. Caching isn’t just a speed trick — it’s what makes each level of the tree a partial rather than a total dependency.

Going deeper