DNS NS Record

The NS DNS record indicates the authoritative and secondary name server(s) (NS servers or DNS servers) for a given domain name.

 

What is a DNS NS record?

The NS record (NS stands for "Nameserver") indicates which DNS server is authoritative for a given domain name; that is, which server contains the original (or actual) DNS records associated with the domain and manages the corresponding domain's DNS zone. A domain's DNS zone is stored in a zone file that contains all DNS records.

NS records are fundamental to the functioning of DNS and a domain name.

A domain often has multiple NS records that specify primary and secondary name servers (NS) for that domain. Without correctly configured NS records, a domain is inaccessible and does not resolve, no associated services can function, including email and web services, and therefore its website cannot be displayed and there is no mail services.

 

Here is an example of NS records:

example.com. 86400 IN NS  ns1.exampleserver.com
example.com. 86400 IN NS  ns2.exampleserver.com

 

example.com Record Type NS Hostname TTL
@ NS ns1.exampleserver.com 86400
example.com Record Type NS Hostname TTL
@ NS ns2.exampleserver.com 86400

 

In the example above, the first name server (NS) for the domain example.com is "ns1.exampleserver.com", and the second is "ns2.exampleserver.com". If the administrator of this domain example.com wants to change the NS server(s), he simply needs to replace the desired nameserver with the new NS to update the relevant NS record.

When NS records are updated, it can take several hours for the changes to replicate across the entire DNS and propagate to all name servers on the internet.

 

Why use and modify NS records?

To associate or link a domain name to the various services you want to use it for, you must specify in your DNS settings which DNS servers (NS) will store/host the domain's DNS records. Generally, two or three DNS servers are used (one authoritative, and at least one secondary).

Domain administrators must therefore create NS records with the NS servers that will store all the records in the DNS zone file, and then update these records when they need to change the name servers (NS) associated with their domain. For example, when you transfer your domain name to a new registrar, it's very common to switch your NS servers to those of your new registrar, particularly to manage your records and your DNS zone file on your new registrar's interface.

Also, when delegating a subdomain's DNS zone, the delegation must be included in the parent zone definition. NS records are used to do this. The parent zone must therefore contain NS records corresponding to the name of the delegated zone, and containing all the name servers for the delegated zone. The delegated zone is constructed like any other zone, with an SOA record and NS records. The NS records in the delegated zone must be identical to the NS records specified in the parent zone for that child zone.