NS Record — Nameserver Delegation
Learn how NS (Name Server) records delegate DNS authority for a domain or subdomain. Understand glue records, delegation hierarchy, and nameserver best practices.
Zone File Entry
example.com. IN NS ns1.example.com. example.com. IN NS ns2.example.com.
Detailed Explanation
What Is an NS Record?
An NS record (Name Server record) specifies which DNS servers are authoritative for a particular domain or zone. NS records form the backbone of the DNS delegation hierarchy, telling resolvers where to find the definitive answers for a domain's DNS queries.
BIND Zone File Syntax
; Authoritative nameservers for the domain
example.com. 86400 IN NS ns1.example.com.
example.com. 86400 IN NS ns2.example.com.
; Delegating a subdomain to different nameservers
dev.example.com. 86400 IN NS ns1.devteam.example.com.
dev.example.com. 86400 IN NS ns2.devteam.example.com.
; Using a DNS hosting provider
example.com. 86400 IN NS ns1.cloudprovider.com.
example.com. 86400 IN NS ns2.cloudprovider.com.
How NS Delegation Works
DNS operates as a distributed hierarchy. When a resolver needs to find the IP for www.example.com:
- Root servers provide NS records for
.com .comTLD servers provide NS records forexample.com- The authoritative nameservers for
example.comprovide the final answer
Each level delegates authority to the next via NS records. This distributed design ensures no single server must know every DNS record in existence.
Glue Records
When your nameservers are within the same domain they serve (e.g., ns1.example.com for example.com), a chicken-and-egg problem arises: you need to resolve ns1.example.com to reach the nameserver, but the nameserver is the one with that information.
Glue records solve this by providing A records for the nameservers at the parent zone level (the TLD servers):
; At the .com TLD level (configured at your registrar)
example.com. 86400 IN NS ns1.example.com.
example.com. 86400 IN NS ns2.example.com.
ns1.example.com. 86400 IN A 203.0.113.10
ns2.example.com. 86400 IN A 203.0.113.11
Best Practices
- Minimum two nameservers: Most registries require at least two NS records for redundancy
- Geographic diversity: Place nameservers in different data centers or networks
- High TTL: NS records should have long TTLs (86400 seconds / 24 hours) since they change infrequently
- Consistent NS records: The NS records at the parent zone (registrar) must match the NS records within your zone file
- Avoid single points of failure: If both nameservers share the same network, a network outage takes your entire domain offline
Subdomain Delegation
You can delegate subdomains to entirely different nameservers, which is useful for large organizations where different teams manage different subdomains:
; Main domain
example.com. NS ns1.example.com.
example.com. NS ns2.example.com.
; Delegated subdomain
internal.example.com. NS ns1.internal-dns.example.com.
internal.example.com. NS ns2.internal-dns.example.com.
Use Case
Configure NS records to delegate DNS authority for your domain to your chosen DNS hosting provider, or to delegate a subdomain to a separate set of nameservers managed by a different team.