The DNS Name Space: Names, Labels, Zones and Delegation
How DNS names are built and who controls them: the tree and its root, TLDs, label rules, names on the wire, IDNs, search lists, and how zones and delegation split the tree among servers, shown in a private DNS lab.
kvi5hnuCode Sprout team member17 min readOn this page
IP and TCP work only with addresses. People and configuration files work with names like www.example.com. The Domain Name System (DNS) connects the two: it's a distributed database that maps names to addresses, and also to mail servers, service locations, keys and much more. It has to answer billions of queries a day for names that millions of separate organizations create and change, and no single server knows all of it.
This part of the course, articles 49 to 56, covers DNS from the name space up to troubleshooting. This first article is about the names themselves and how responsibility for them is split up. The terminology follows RFC 9499, the current DNS terminology reference.
The lab for Part 9
Every DNS example in this part runs on a small, private copy of the DNS tree, built with BIND 9.20, the most widely used open-source DNS server, inside the course's Docker lab and completely cut off from the real Internet. It has its own root server, its own top-level domain server and the servers for example.com:
| Role | Name | Address | Serves |
|---|---|---|---|
| Root server | a.root.test | 198.51.100.201 | the root zone, . |
| TLD server | a.gtld.test | 198.51.100.202 | com., net., test., arpa. |
| Primary for example.com | ns1.example.com | 198.51.100.53 | example.com, example.net, reverse zones |
| Secondary | ns2.example.com | 198.51.100.54 | copies of example.com, and dev.example.com |
| Recursive resolver | none | 198.51.100.99 | answers the client's questions |
| Client | none | 192.0.2.10 | uses 198.51.100.99 as its name server |
The real Internet works the same way, just with 13 root server identities instead of one and about 1,400 TLDs instead of four.
A tree with an unnamed root
The DNS name space is a tree. Each node has a label, and a node's domain name is the list of labels on the path from that node up to the root. The root's label is empty, which is why fully written names end with a dot: www.example.com. is www, then example, then com, then the empty root label.

A domain is a whole subtree: the example.com domain is example.com plus every name below it. A name is read from left (most specific) to right (most general), the opposite of a file path.
Top-level domains
The labels just below the root are the top-level domains (TLDs). In November 2026, the IANA list held 1,436 of them, 151 of which were internationalized names. They fall into a few groups:
- Generic TLDs (gTLDs), such as
com,net,organdinfo, plus the more than 1,200 added since the 2012 expansion by ICANN (the Internet Corporation for Assigned Names and Numbers, which coordinates the root and TLDs), such asapp,devandshop. Some are restricted to specific communities, such asedu,gov,milandint. ICANN's next round accepted applications from April to August 2026 and received about 1,600 of them, so more are coming. - Country-code TLDs (ccTLDs): two letters, mostly from the ISO 3166 country codes, such as
de,jpanduk. Some countries market theirs for other meanings:tv(Tuvalu) andio(British Indian Ocean Territory) are popular for unrelated sites. - Internationalized ccTLDs, written in non-Latin scripts, such as
.рфor.中国. arpa, the infrastructure TLD, used for reverse lookups (in-addr.arpafor IPv4,ip6.arpafor IPv6, article 52) and for special zones such ashome.arpa.
Some names are reserved so that they never collide with real ones. This course uses them throughout:
| Name | Reserved for | Defined by |
|---|---|---|
example, example.com, example.net, example.org | Documentation | RFC 2606 |
test | Testing | RFC 2606, RFC 6761 |
invalid | Names that must fail | RFC 2606 |
localhost | The local host, never sent to DNS servers | RFC 6761 |
local | Multicast DNS on the local link (article 54) | RFC 6762 |
home.arpa | Home networks | RFC 8375 |
internal | Private use inside organizations | ICANN decision, July 2024 |
alt | Non-DNS naming systems | RFC 9476 |
Before internal was reserved, organizations often invented private TLDs like corp or lan. That's risky: if such a TLD is later delegated in the real root, the private names suddenly collide with public ones. The safe choices for private names are a subdomain of a domain you own, home.arpa for homes, or internal.
Labels and their rules
DNS itself is permissive about labels, but there are a few firm limits:
- A label is 1 to 63 bytes. The empty label is used only for the root.
- A full name is at most 255 bytes in its wire form, including the length bytes. That's at most 253 characters when written in text without the final dot.
- Comparisons are case-insensitive for ASCII letters (RFC 4343):
WWW.Example.COMandwww.example.comare the same name. Servers are supposed to preserve the case they received, though, and a later article shows a security trick based on that.
The stricter host name rules, from RFC 952 and RFC 1123, apply to names of hosts: letters, digits and hyphens only, not starting or ending with a hyphen. This is called the LDH rule (letters, digits, hyphen). Other DNS names may use other characters. Names of services, for example, begin with an underscore, such as _sip._udp.example.com (RFC 8552), so they can never clash with host names.
What a name looks like on the wire
In a DNS message, a name isn't written with dots. Each label is sent as a length byte followed by that many bytes, and a zero byte (the root's empty label) ends the name.

The lab captured a query from the client and decoded its question name:
QNAME bytes: 03 77 77 77 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00
length 3: 'www'
length 7: 'example'
length 3: 'com'
length 0: (the root)
QTYPE 1 QCLASS 1
The last line gives the question's type and class: type 1 is an A record (an IPv4 address), and class 1 is IN, the Internet class. The length byte explains the 63-byte limit: its top two bits are reserved, because the value 11 in those bits marks a compression pointer (article 51), leaving 6 bits for the length. The 255-byte limit also counts these length bytes. The lab's dig enforces both limits before it sends anything:
status: NXDOMAIN
dig: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.example.com' is not a legal name (label too long)
dig: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is not a legal name (ran out of space)
The first query, with a 63-byte label, was valid and simply got NXDOMAIN (non-existent domain) because the name doesn't exist. The 64-byte label was rejected, and so were four 63-byte labels, which need 4 × 64 + 1 = 257 bytes on the wire.
Case is preserved in the question, as the lab shows when asking for a mixed-case name:
;; QUESTION SECTION:
;WwW.ExAmPlE.CoM. IN A
;; ANSWER SECTION:
www.example.com. 3600 IN A 198.51.100.10
The server echoed the question exactly as asked, WwW.ExAmPlE.CoM, and answered with the name as written in its zone. Both are the same name.
Internationalized names
Labels can technically hold any byte, but applications and the DNS protocol assume ASCII. Internationalized domain names (IDNs) solve this by converting Unicode labels into ASCII before they reach the DNS, using an encoding called Punycode with the prefix xn-- (IDNA2008, RFC 5890 to 5893). A browser shows bücher.example.com, but the DNS only ever sees xn--bcher-kva.example.com:
bücher -> xn--bcher-kva
-- typed as bücher.example.com, sent as:
;xn--bcher-kva.example.com. IN A
-- displayed with +idnout:
bücher.example.com. 3600 IN A 198.51.100.81
The first line is Python's conversion. dig did the same conversion when the name was typed with ü, sent the ASCII form, and with +idnout converted the answer back for display. Because many Unicode characters look alike, IDNs allow homograph attacks: a name with a Cyrillic а looks identical to one with a Latin a. Browsers defend against this by showing the xn-- form when a label mixes scripts in suspicious ways.
Fully qualified names, search lists and the trailing dot
A fully qualified domain name (FQDN) names a node all the way to the root. Strictly, it ends with a dot, www.example.com., which tells the resolver the name is complete. Names without the final dot may be treated as relative, and the resolver may append domains from its search list before trying them. The search list usually comes from DHCP (option 119, article 29), from IPv6 router advertisements (the DNSSL, DNS Search List, option, article 42) or from the host's configuration.
The lab client's resolver configuration:
nameserver 198.51.100.99
search example.com
2001:db8:2::10 www.example.com
www. (fully qualified): not found
www.example.com has address 198.51.100.10
www.example.com has IPv6 address 2001:db8:2::10
getent hosts www found www.example.com, because the resolver appended example.com from the search list. With a trailing dot, www. was taken as complete, a single-label name directly under the root, and it doesn't exist. And host www.example.com. with a trailing dot worked without any search.
On Linux, the ndots option (default 1) decides the order: a name with fewer dots than ndots is tried with the search domains first, and a name with at least that many dots is tried as-is first. Search lists are convenient but can leak queries: a typo can send printer.example.com.example.com to the Internet, or a short name can match an unexpected public TLD. In Kubernetes, the default ndots:5 causes several extra lookups for every external name, which is a known performance pitfall.
Zones: the units of administration
A domain is a part of the tree. A zone is the part of the tree that one set of servers is responsible for. The difference matters: the example.com domain covers everything under example.com, but the example.com zone stops where responsibility is handed to someone else.
Handing off a subtree is called delegation. The parent zone keeps only a pointer: a set of NS records naming the child zone's name servers, placed at the point where the child starts, called the zone cut. The child zone has the real data, starting with its SOA record (start of authority, article 52). In the diagram, com delegates example.com, and example.com in turn delegates dev.example.com to a different server.
Delegation is what makes DNS scale. The administrators of example.com can add mail.example.com or create dev.example.com without asking the operators of com or the root. The original Internet used a single file of all host names, HOSTS.TXT, kept by one organization and copied by everyone. By the early 1980s, it was too big and changed too often, and DNS replaced it, defined in RFC 1034 and RFC 1035 in 1987.
Following the delegations by hand
You can watch delegation by asking each server directly, with recursion turned off (+norecurse) so the server only says what it knows itself. First, the root server, asked for www.example.com:
; (1 server found)
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42029
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.example.com. IN A
;; AUTHORITY SECTION:
com. 172800 IN NS a.gtld.test.
;; ADDITIONAL SECTION:
a.gtld.test. 172800 IN A 198.51.100.202
a.gtld.test. 172800 IN AAAA 2001:db8:2::202
Article 6 introduced dig; here is how to read its full output. The HEADER line gives the status (NOERROR: no error) and the query id. flags lists the header bits that are set; qr means "this is a response". Then come the number of records in each section. The OPT PSEUDOSECTION shows EDNS, the extension mechanism (article 51), with the largest UDP response the server accepts. Each record line reads: name, TTL (how many seconds it may be cached), class (IN), type and data. The types here are NS (a name server for the zone), A (an IPv4 address) and AAAA (an IPv6 address).
The root doesn't know the answer. It returns a referral: no answer section, and in its authority section the NS record for com., plus the name server's addresses in the additional section. Those addresses are called glue: without them, a resolver would need to look up a.gtld.test before it could ask a.gtld.test anything.
Next, the TLD server:
; (1 server found)
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32025
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 5
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.example.com. IN A
;; AUTHORITY SECTION:
example.com. 172800 IN NS ns2.example.com.
example.com. 172800 IN NS ns1.example.com.
;; ADDITIONAL SECTION:
ns1.example.com. 172800 IN A 198.51.100.53
ns2.example.com. 172800 IN A 198.51.100.54
ns1.example.com. 172800 IN AAAA 2001:db8:2::53
ns2.example.com. 172800 IN AAAA 2001:db8:2::54
Another referral, one level down: the servers for example.com, with glue. Finally, ns1.example.com:
; (1 server found)
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43267
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 5
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.example.com. IN A
;; ANSWER SECTION:
www.example.com. 3600 IN A 198.51.100.10
;; AUTHORITY SECTION:
example.com. 3600 IN NS ns1.example.com.
example.com. 3600 IN NS ns2.example.com.
;; ADDITIONAL SECTION:
ns1.example.com. 3600 IN A 198.51.100.53
ns2.example.com. 3600 IN A 198.51.100.54
ns1.example.com. 3600 IN AAAA 2001:db8:2::53
ns2.example.com. 3600 IN AAAA 2001:db8:2::54
This time there's an answer, and the aa (authoritative answer) flag is set: the data comes from the server's own zone, not from a cache. Article 50 shows how a recursive resolver does all of this automatically.
The same thing happens one level further down. Asking ns1 about a name in the delegated dev.example.com:
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
; EDNS: version: 0, flags:; udp: 1232
;; AUTHORITY SECTION:
dev.example.com. 3600 IN NS ns2.example.com.
ns1 is authoritative for example.com but not for dev.example.com, so it refers the client to ns2. Through the resolver, the name resolves normally:
198.51.100.90
You can find which zone a name belongs to by asking for its SOA record. The answer (or, for a negative answer, its authority section) names the zone's apex:
www.example.com zone: example.com.
api.dev.example.com zone: dev.example.com.
example.com zone: example.com.
www.example.com lives in the example.com zone, but api.dev.example.com lives in dev.example.com.
Primary and secondary servers
Every zone should be served by at least two name servers, preferably on different networks, so it stays reachable if one fails (RFC 2182 explains how to choose them). Traditionally, one is the primary, which loads the zone from a file or database, and the others are secondaries, which copy the zone from the primary with a zone transfer (article 53). Clients can't tell the difference: all of them answer authoritatively. The older terms master and slave are still found in older documentation.
The root zone itself is served by 13 server identities, a.root-servers.net to m.root-servers.net, run by 12 independent organizations. The number 13 comes from fitting all their addresses into a 512-byte response in the 1990s. Each identity is actually anycast (article 12) from many sites: in November 2026, the root server operators listed 2,046 instances worldwide, so most users reach a root server close to them.
Common questions
What's the difference between a domain and a zone?
A domain is a subtree of names. A zone is the part of that subtree that's administered together and served by the same name servers, ending where a child zone is delegated. The example.com domain includes api.dev.example.com, but the example.com zone doesn't, because dev.example.com is delegated.
Why do some names end with a dot?
The dot represents the root, so a name ending in a dot is fully qualified: complete, with nothing to be appended. In zone files and in dig output, names are written that way. In everyday use, the dot is left off, and resolvers treat names with enough dots as complete anyway.
Are DNS names case-sensitive?
No. ASCII letters compare without regard to case, so EXAMPLE.com and example.com are the same. Servers try to preserve case in responses, but you can't rely on it for anything except some security checks.
Can I create my own top-level domain for my company network?
Not safely, unless you use one reserved for that purpose. Invented TLDs like corp or lan may later be delegated in the real root, and then lookups can leak to or collide with someone else. Use a subdomain of a domain you own, home.arpa for home networks, or internal, which ICANN reserved in 2024.
Why is there a limit of 63 bytes per label?
Each label is sent with a length byte whose top two bits are reserved, so that a value starting with binary 11 can mark a compression pointer. That leaves 6 bits, or 0 to 63, for the length.
Do I need a server for every subdomain?
No. A zone can contain names many levels deep without any delegation: a.b.c.example.com can live in the example.com zone. You delegate only when a different person or team should run that part of the tree.
How do browsers handle non-ASCII domain names?
They convert each label to its ASCII-compatible xn-- form using IDNA before any DNS lookup, and convert back for display, unless the mix of scripts looks like a spoofing attempt. The DNS servers only ever see ASCII.
Summary
- DNS names form a tree with an unnamed root. A name lists labels from the node up to the root, and a fully qualified name ends with a dot.
- Below the root are about 1,400 TLDs: generic, country-code, internationalized, and
arpafor infrastructure. Names such asexample,test,localhost,local,home.arpaandinternalare reserved. - Labels are 1 to 63 bytes, a whole name at most 255 bytes on the wire, and comparisons ignore ASCII case. Host names follow the stricter letters-digits-hyphen rule.
- On the wire, a name is a series of length-prefixed labels ending in a zero byte. Internationalized names are sent in their
xn--Punycode form. - Relative names may be completed from a search list. A trailing dot prevents that.
- A zone is the part of the tree served by one set of servers. A parent delegates a child zone with NS records at the zone cut, plus glue addresses when needed.
- Non-recursive queries show referrals from root to TLD to the zone's servers, which answer with the
aaflag. - Each zone should have at least two authoritative servers. The root has 13 server identities from 12 operators, anycast at about 2,000 sites.
Practice questions
1. How many labels does api.dev.example.com. have, counting the root? How many bytes does it take on the wire?
Answer
Five labels: api, dev, example, com and the empty root label. On the wire: (1 + 3) + (1 + 3) + (1 + 7) + (1 + 3) + 1 = 21 bytes.
2. A resolver's search list is corp.example.com example.com, and ndots is 1. In what order does it try names when a user types printer? And printer.?
Answer
printer has zero dots, fewer than ndots, so the resolver tries printer.corp.example.com, then printer.example.com, and finally printer as-is. printer. has a trailing dot, so it's fully qualified: only the single-label name printer. under the root is tried, and it fails.
3. The example.com zone contains NS records for dev.example.com pointing to ns.dev.example.com. Why must it also contain an A record for ns.dev.example.com?
Answer
That A record is glue. The name server's name is inside the zone it serves, so a resolver couldn't find its address without already being able to query it. The parent supplies the address in referrals so the resolver can contact the child zone's server.
4. You query a root server directly, with recursion off, for www.example.com. The response has no answer section and no aa flag. Is something wrong?
Answer
No. It's a referral: the root isn't authoritative for www.example.com, so it returns the NS records for com in its authority section, with their glue addresses in the additional section, and the resolver continues from there.
5. Which of these are valid host names under the LDH rule: web-01.example.com, -web.example.com, web_01.example.com, _sip._udp.example.com?
Answer
Only web-01.example.com. -web starts with a hyphen, and web_01 contains an underscore, so neither follows the host name rule. _sip._udp.example.com isn't a host name at all: underscore labels name services (for SRV records) and are valid DNS names, deliberately outside the host name syntax.
6. A company uses .lan for internal names and finds that some laptops occasionally fail to reach files.lan when off the VPN. What's going on, and what would be a better name?
Answer
Off the VPN, the laptops use public resolvers, which know nothing about .lan and return NXDOMAIN, while queries for internal names leak to the Internet. Worse, if lan were ever delegated as a real TLD, the names could resolve to someone else's servers. A subdomain of a domain the company owns, such as files.corp.example.com, or a name under internal, avoids collision.
Previous: Building on UDP: Datagram Sizes, Server Design, UDP-Lite and UDP in Today's Internet
Next: How a Name Is Resolved: Stub, Recursive and Authoritative Servers and Caching

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.