Opscraft
Name servers & SOA · Lesson 2 of 8 · 6 min read

Zones, delegation and the namespace tree

Domains vs zones

The DNS namespace is a tree: root (.) → TLDs (com, in, org) → second-level domains (example.com) → subdomains. A domain is a subtree of names. A zone is the part of the tree managed as one administrative unit by one set of authoritative servers.

example.com and dev.example.com are in the same zone unless dev.example.com is delegated with NS records — then it's a separate zone with its own servers, SOA and NS. Not every subdomain is a zone.

Enlarge diagramZONE: EXAMPLE.COMZONE: DEV.EXAMPLE.COMexample.comwww.example.comapi.example.comNS for dev → …the cutdev.example.comx.dev.example.com
Figure 1. A domain is a branch of the name tree; a zone is the part one set of servers manages. Delegating dev.example.com cuts it into its own zone.
Swipe sideways to see all of it, or tap to open it full screen.

How delegation works

A parent zone delegates a child by publishing NS records for the child's name pointing at the child's authoritative servers:

; in the .com zone (run by Verisign)
example.com.     172800  IN  NS  ns-1234.awsdns-12.org.
example.com.     172800  IN  NS  ns-567.awsdns-07.net.
example.com.     172800  IN  NS  ns-89.awsdns-11.com.
example.com.     172800  IN  NS  ns-2001.awsdns-50.co.uk.

When a resolver asks the .com servers about api.example.com, they don't know the answer; they return a referral: "ask these name servers". The resolver follows it.

The delegation chain for api.example.com:

Enlarge diagramResolverRoot.com serversVerisignexample.comNSRoute 53api.example.com?referral: .com NSapi.example.com?referral: example.com NS (+ glue)api.example.com?A 203.0.113.10 (aa)
Figure 2. Delegation in action: each level does not know the answer, but refers the resolver one step closer.
Swipe sideways to see all of it, or tap to open it full screen.
  1. Resolver asks a root server → referral to the .com TLD servers.
  2. Asks a .com server → referral to example.com's authoritative servers (NS + glue if needed).
  3. Asks an example.com authoritative server → the A record for api (with aa).
  4. Caches everything along the way (NS records, addresses) for their TTLs.

dig +trace api.example.com shows these steps yourself.

NS records live in two places

  • At the parent (the delegation, published by the TLD from what your registrar sends).
  • At the child (the zone's own apex NS records, authoritative).

They should match. When they don't, behaviour depends on which a resolver happened to cache. The parent's records are what the world uses to find you — if your registrar still lists the old provider's servers, your shiny new Route 53 zone is simply ignored.

Enlarge diagramParent (.com) delegationset through your registrar; what resolversfollow firstChild (your zone apex) NSauthoritative copy inside Route 53must matchIf they differ, some resolvers use one set and some the other: confusing, intermittent results.
Figure 3. NS records live in two places. The parent's copy is what the world follows; your zone's own copy should match it.
Swipe sideways to see all of it, or tap to open it full screen.

Glue records

If a zone's name servers are named inside the zone they serve — example.com served by ns1.example.com — there's a circular dependency: to find ns1.example.com you need to ask example.com's name servers, which are ns1.example.com. The parent breaks the loop by publishing glue: A/AAAA records for those name servers, included in the referral's additional section.

; in the .com zone
example.com.       IN  NS  ns1.example.com.
ns1.example.com.   IN  A   198.51.100.53      ; glue

Glue is only needed for in-bailiwick name servers. Route 53's name servers (*.awsdns-*.com/net/org/co.uk) are in other domains, so you never need glue for Route 53-hosted zones. If you run your own ns1.example.com and the glue is missing at the registrar, resolution fails or is flaky.

Enlarge diagramWITHOUT GLUEWITH GLUE IN THE .COM ZONEexample.com is served byns1.example.comto find ns1.example.com, ask…example.comexample.com. NS ns1.example.com.ns1.example.com. A 198.51.100.53the glue record
Figure 4. Glue breaks a chicken-and-egg loop: to find ns1.example.com you would need example.com's name servers. The parent supplies ns1's address directly.
Swipe sideways to see all of it, or tap to open it full screen.

Lame delegation

A lame delegation happens when an NS record points at a server that doesn't actually serve the zone authoritatively — a decommissioned server, a deleted hosted zone, a typo. Resolvers that pick that server get REFUSED/SERVFAIL or time out, then try others; users see intermittent slowness or SERVFAIL.

The registrar's role

You register a domain through a registrar (Route 53 Domains, GoDaddy, Namecheap, BigRock for .in). The registrar submits your name servers (and glue, DS records for DNSSEC) to the registry that runs the TLD. The registrar and the DNS host can be different companies: domain registered at GoDaddy, DNS hosted in Route 53 — then you change NS at GoDaddy.