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. | sortRoot servers
Thirteen names, from a.root-servers.net to m:
dig @1.1.1.1 +short NS . | wc -l | tr -d ' 'They are named a through m:
dig @1.1.1.1 +short NS . | sort | head -3Thirteen 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)$'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'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 -uNS records
A zone’s nameservers, published by the zone and its parent:
dig @1.1.1.1 +short NS example.com | sortThose 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 -3Zones 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 -1Changing 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 -uYour registrar writes it there for you. That is why the change is slow and why nothing in your own zone speeds it up.