What is an NS Record?
An NS (Nameserver) record specifies which nameservers are authoritative for a domain or subdomain. In other words, NS records tell the DNS system: "go ask this server for records about this domain." Every domain on the internet has at least two NS records for redundancy.
example.com. 86400 IN NS ns1.cloudflare.com. example.com. 86400 IN NS ns2.cloudflare.com.
NS records typically have high TTLs (86400 = 24 hours) because they change rarely and you want the delegation information cached everywhere to speed up DNS resolution.
Root Domain NS Records vs. Subdomain Delegation
NS records serve two different purposes:
- ▸Root domain NS records: Set at your registrar. These tell the global DNS system which nameservers hold records for your domain.
- ▸Subdomain delegation: NS records on a subdomain (e.g.,
dev.example.com NS ns1.otherprovider.com) delegate that subdomain to a different DNS provider. This allows separate teams to manage DNS for different subdomains independently.
Subdomain Delegation Example
Imagine your main domain uses Cloudflare, but you want your dev subdomain to be managed separately by your development team:
# In your main zone (Cloudflare), add NS records for the subdomain: dev.example.com. 3600 NS ns1.devteam-dns.com. dev.example.com. 3600 NS ns2.devteam-dns.com. # Now the dev team manages all records under dev.example.com independently
NS Records and Cloudflare
When you add a domain to Cloudflare, they assign you two nameservers (e.g., hazel.ns.cloudflare.com and pete.ns.cloudflare.com). You update these at your registrar, pointing the global DNS system to Cloudflare's servers. All your DNS records then live inside Cloudflare's zone editor.
Common Mistakes
- ▸Changing NS records at your registrar without first setting up DNS on the new nameserver — this takes your site offline
- ▸Having NS records that don't resolve — always ensure your nameservers are reachable
- ▸Mixing up nameserver changes (at registrar) with NS records (in your DNS zone) — these are different things