Skip to content
Sign inGet all access
Chapter 2·8 minFree

Delegation

How the internet agrees who owns a name.

No server knows every name. Each one knows who to ask next.

The tree

www.example.com reads right to left: root, com, example, www. Each level delegates the one below.

Level Knows
root which servers run com, org, uk
com which servers run example.com
example.com the actual records

The trailing dot

The real name ends in a dot, naming the root explicitly. dig accepts either:

dig @1.1.1.1 +short A example.com. | sort
Output104.20.23.154172.66.147.243

Root servers

Thirteen names, from a.root-servers.net to m:

dig @1.1.1.1 +short NS . | wc -l | tr -d ' '
Output13

They are named a through m:

dig @1.1.1.1 +short NS . | sort | head -3
Outputa.root-servers.net.b.root-servers.net.c.root-servers.net.

Thirteen names, not thirteen machines — each is anycast to hundreds of servers worldwide, which is why the root has never been down.

dig +trace

One command walks the chain, asking each level in turn:

dig +trace example.com 2>/dev/null \
  | awk '$4=="NS" || $4=="A" {print $1,$4}' | sort | uniq -c \
  | grep -E '\. (NS|A)$'
Output 13 . NS 13 com. NS 2 example.com. A 2 example.com. NS

Three hops: thirteen root servers, thirteen com servers, then the domain’s own two.

That is the entire DNS model in one command. Everything else is detail hanging off these three steps.

Referrals

Ask a root server directly and it answers without answering:

dig @198.41.0.4 +noall +comments example.com 2>/dev/null | grep '^;; flags'
Output;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 27

ANSWER: 0, AUTHORITY: 13. It knows thirteen servers that know more:

dig @198.41.0.4 +noall +authority example.com 2>/dev/null \
  | awk '{print $1,$4}' | sort -u
Outputcom. NS

NS records

A zone’s nameservers, published by the zone and its parent:

dig @1.1.1.1 +short NS example.com | sort
Outputelliott.ns.cloudflare.com.hera.ns.cloudflare.com.

Those two names are the delegation — everything under example.com is theirs.

Glue records

A circular problem: nameservers named ns1.example.com need DNS to find. The parent ships their addresses alongside the referral:

dig @198.41.0.4 +noall +additional example.com 2>/dev/null \
  | awk '$4=="A"{print $1,$5}' | sort | head -3
Outputa.gtld-servers.net. 192.5.6.30b.gtld-servers.net. 192.33.14.30c.gtld-servers.net. 192.26.92.30

Zones versus domains

A domain is a name. A zone is what one server is authoritative for, and a subdomain may be in the parent zone or delegated.

In the parent zone Delegated
blog.example.com records edited with the rest edited elsewhere
Who can change them whoever holds the zone whoever holds the delegation
Needs an NS record no yes

s3.amazonaws.com is a delegated subdomain — it has its own nameservers, separate from amazonaws.com:

dig @1.1.1.1 +short NS s3.amazonaws.com | sort | head -1
Outputns-1300.awsdns-34.org.

Changing nameservers

The delegation lives in the parent zone, which you do not control:

dig @198.41.0.4 +noall +authority example.com 2>/dev/null \
  | awk '{print $1,$4}' | sort -u
Outputcom. NS

Your registrar writes it there for you. That is why the change is slow and why nothing in your own zone speeds it up.