What is a DNS zone? Zones, SOA and NS records
A DNS zone is the portion of the DNS namespace that one set of nameservers is responsible for, described by a zone file of records starting with an SOA and NS records.
- Updated Nov 27, 2026
- Markdown
Explain what a DNS zone is, read its SOA and NS records and decide whether a subdomain needs its own zone.
- dig installed (dnsutils or bind-utils)
- A domain you can query, such as example.com
A DNS zone is the part of the DNS namespace that one set of nameservers is responsible for. If you own example.com and keep all its records at one DNS provider, that provider hosts a single zone called example.com. The zone is the thing you edit when you add an A record or an MX record. A domain is a name; a zone is the administrative unit that stores the records for it.
How it works#
DNS is a tree. The root sits at the top, then top-level domains such as com, then names like example.com, then names below that. Responsibility for each branch is handed down. The com servers do not know your records. They only know which nameservers are authoritative for example.com and refer resolvers to them.
A zone covers a name and everything under it, except any part that has been delegated to someone else. If you never delegate, example.com, www.example.com and api.example.com all live in one zone. If you delegate app.example.com, that name and everything beneath it moves into a separate zone with its own nameservers.
The records for a zone are often written in a zone file. Providers hide the file behind a web form or API, but the model is the same: a list of records, each with a name, a TTL, a type and a value.
Zone vs domain#
Think of a domain as an address and a zone as the filing cabinet that holds the records for it. Most small sites have exactly one zone per registered domain, so people use the words interchangeably. They split apart in two cases:
- A large organization delegates parts of its name to other teams, so one domain spans many zones.
- A reverse zone such as one under in-addr.arpa maps IP addresses back to names and is a zone with no matching domain you registered.
The registrar is a third party. It records which nameservers are authoritative for your domain in the parent zone (com for example.com). The zone itself lives wherever those nameservers say it does.
The SOA record#
Every zone has one SOA (start of authority) record at its top. Ask for it with dig:
dig example.com SOA +noall +answerThe answer has one line with the zone name, a TTL, the type, and then seven fields in order: the primary nameserver, the responsible mailbox (written with a dot instead of the at sign), a serial number, and the refresh, retry, expire and minimum timers.
- Primary nameserver: the server that holds the master copy.
- Serial: a number that increases whenever the zone changes. Secondary servers compare it to know when to copy the zone again.
- Refresh, retry, expire: timers that control how secondary servers poll and when they give up on a dead primary.
- Minimum: today this is used as the negative caching time, how long resolvers may remember that a name does not exist. See TTL and DNS caching explained.
NS records and the apex#
The NS records at the top of the zone name the authoritative nameservers:
dig example.com NS +noall +answerA zone normally lists at least two nameservers so one outage does not take the domain offline. The top name of the zone, example.com itself, is called the apex (or root of the zone, or bare domain). It always carries the SOA and NS records. That is the reason a CNAME cannot be placed there: a CNAME means “this name is an alias for another name and has no other records”, which conflicts with the SOA and NS that must exist. The fix is covered in CNAME flattening and ALIAS records.
Delegating a subdomain into its own zone#
Delegation is how a zone gives up part of its tree. To delegate app.example.com, add NS records for the name app in the example.com zone:
app.example.com. 3600 IN NS ns1.other-dns.example.net.
app.example.com. 3600 IN NS ns2.other-dns.example.net.From then on, resolvers that ask about anything under app.example.com are sent to those servers. The other provider must have a zone called app.example.com, with its own SOA and NS, or queries will fail. Parent and child NS sets should match, since resolvers may use either.
People delegate to let another team or tool manage a branch, to give a platform control of its own records, or to point an automation at a narrow slice so a bug cannot touch the main domain. If a name is delegated, any other records you add for it or below it in the parent zone are ignored by resolvers that follow the delegation.
Who hosts the zone#
Three parties are involved, and they are often one company:
- The registrar, where you pay for the name and set the nameservers.
- The DNS provider, whose servers answer queries for your zone.
- You, who edit the records through the provider’s interface.
Changing nameservers at the registrar moves the zone to a new host. You must recreate every record there first, because the old zone does not move on its own. See DNS propagation myths for why that switch is slower than a normal record edit.
Check it worked#
Find out which servers are authoritative, then ask one directly:
dig example.com NS +short
dig @ns1.example.net example.com SOA +noall +answerThe first command lists the nameserver names. The second sends your question to one of them instead of your local resolver. The answer should carry the aa flag (authoritative answer) when you drop the +noall options and read the header. To see the delegation chain from the root down, run dig +trace example.com. See Check DNS with dig for the full toolkit.
Edge cases and gotchas#
- Lame delegation: if the parent lists a nameserver that does not actually serve your zone, some queries fail while others work. Check every NS name with
dig @<ns> example.com SOA. - Mismatched NS sets: the parent zone and the zone itself can list different nameservers. Resolvers may follow either, so keep them identical.
- Orphaned records after a move: switching providers without copying records first makes the new zone empty, and your site disappears.
- Delegated names hide parent records: an A record for app.example.com in the parent zone is dead once NS records for app exist.
- Serial confusion: editing a self-hosted zone file without raising the serial leaves secondary servers serving stale data.
- Registrar vs DNS host: editing records at your registrar does nothing if its nameservers are not the ones in use.
Troubleshooting#
| Symptom | Likely cause | Fix |
|---|---|---|
| New record never appears | You edited a zone at a provider that is not authoritative | Run dig example.com NS +short and edit the zone at that provider |
| SERVFAIL for a delegated subdomain | The child zone does not exist at the delegated nameservers | Create the zone there, with its SOA and NS |
| Some lookups return old data, some new | Parent and child NS sets differ | Make both lists identical |
| Site vanished after changing nameservers | Records were not copied to the new zone | Recreate records at the new provider, then compare answers with dig |
| CNAME rejected at the apex | SOA and NS must share that name | Use an ALIAS or flattening feature, or an A record |
| Zone changes not seen by secondary servers | The SOA serial was not increased | Increase the serial and reload |
Quick reference#
dig example.com SOA +noall +answer # zone settings and serial
dig example.com NS +short # authoritative nameservers
dig @ns1.example.net example.com A # ask one server directly
dig +trace example.com # follow delegation from the rootRelated lessons#
- DNS record types explained: what A, CNAME, MX and TXT records hold.
- TTL and DNS caching explained: how the SOA minimum affects negative answers.
- Subdomains and wildcard DNS records: adding names inside a zone.
- Point a domain at your server: the practical first edit to your zone.
- Fix a domain that does not resolve: a checklist when lookups fail.
Next#
Continue with TTL and DNS caching explained.
Check what you learned
Frequently asked questions
What is the difference between a DNS zone and a domain?
A domain is a name in the DNS tree. A zone is the slice of that tree managed by one set of authoritative nameservers. One domain can contain several zones when subdomains are delegated.
What is in a DNS zone file?
A zone file is a text list of resource records for the zone. It starts with an SOA record, lists the NS records, and then holds A, AAAA, CNAME, MX, TXT and other records.
Do I need to edit the SOA record myself?
Usually not. Most DNS providers manage the SOA for you and bump the serial on each change. You mainly read it to find the primary nameserver and the negative caching time.
Who hosts my DNS zone?
Whoever runs the nameservers listed in your domain's NS records. That is often your registrar by default, but you can move it to a separate DNS provider by changing the nameservers at the registrar.
Sources
Keep going: guides and tutorials
- Self-Hosted Static Site Hosting: Deploy a Folder With Levelrail Self-hosted static site hosting from a plain folder: one deploy command, _redirects, _headers and a custom 404 honored, plus a one command rollback.
- Deploy Next.js on a VPS With Docker, Git Push and HTTPS Deploy a Next.js app to your own VPS with Docker, a health check, HTTPS and rollback. Includes the NEXT_PUBLIC build trap that leaves variables empty.