NS record: what it is and how to check it

Lists the authoritative nameservers that hold a domain's DNS records.

Check with the NS Lookup

What it is

An NS record (name server) names a server that is authoritative for a zone, meaning it holds the original copy of that zone’s records and answers for them with authority. Every domain has NS records, usually two to four of them, such as ns1.example.net and ns2.example.net.

NS records make the DNS a distributed database. Nobody holds all the records on the internet; instead, each zone tells resolvers where to find the next level down. This process is called delegation, and it is described in RFC 1034 and RFC 1035.

How it works

Take a resolver looking for www.example.com with an empty cache:

  1. It asks a root server. The root does not know the answer, but it returns the NS records of the .com zone: a referral.
  2. It asks a .com server, which returns a referral with the NS records of example.com, for example ns1.example.net and ns2.example.net.
  3. It asks one of those nameservers, which answers authoritatively with the A record of www.example.com.

The NS records therefore exist in two places:

  • In the parent zone (.com), as the delegation. You control these through your registrar.
  • At the apex of your own zone (example.com), as published by your DNS provider.

Both sets should match. Resolvers follow the parent’s referral, then usually prefer the child’s set once they reach it.

Glue records

If the nameservers are inside the zone they serve, such as ns1.example.com for example.com, there is a chicken-and-egg problem: to find ns1.example.com you must already know where example.com lives. The parent zone solves this by publishing the nameservers’ IP addresses alongside the delegation. These addresses are called glue records, and you register them at your registrar together with the NS names.

Choosing nameservers

Most domains use the nameservers of their registrar or of a dedicated DNS provider, which run them on anycast networks: each nameserver address is announced from many locations, so it is both fast and resistant to local outages. For extra resilience some organisations use two providers at once, keeping the zone identical on both and listing nameservers from each at the registrar. That protects against a provider-wide outage but requires keeping both copies in sync, and coordinating DNSSEC keys if the zone is signed.

Syntax and fields

Field Example Meaning
Name example.com. The zone being delegated (or a subdomain delegated to other servers).
TTL 86400 Cache lifetime. Often long, because nameservers rarely change.
Class IN Internet.
Type NS The record type.
Data ns1.example.net. Host name of an authoritative nameserver. One per record.

The target must be a host name with A or AAAA records, not an IP address and not a CNAME (RFC 2181, section 10.3).

Examples

A zone served by a DNS provider:

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

Self-hosted nameservers inside the zone, with the glue that the parent publishes:

example.com.        86400  IN  NS  ns1.example.com.
example.com.        86400  IN  NS  ns2.example.com.
ns1.example.com.    86400  IN  A   192.0.2.53
ns2.example.com.    86400  IN  A   198.51.100.53

Delegating a subdomain to another team’s nameservers:

lab.example.com.    3600   IN  NS  ns-lab1.example.org.
lab.example.com.    3600   IN  NS  ns-lab2.example.org.

Common mistakes

  • Changing NS records in the zone, not at the registrar. The delegation lives in the parent zone. Editing the apex NS records at your DNS provider does not move the domain.
  • Parent and child disagree. After a provider change, people often forget to update the apex NS records in the new zone, or they leave an old server in the registrar’s list. Answers then depend on which server a resolver happens to ask.
  • Lame delegation. A nameserver listed in the delegation that does not actually serve the zone, or answers without the authoritative flag, is called “lame”. Resolvers waste time on it and may fail.
  • Only one nameserver, or all on the same network. A single failure then takes your whole domain offline, including email.
  • Missing or outdated glue. If in-zone nameservers change IP and the glue at the registrar is not updated, the domain stops resolving.
  • Switching provider without copying the zone. Before moving the delegation, recreate every record at the new provider and check it by querying the new nameservers directly. If you use DNSSEC, coordinate the DS record change too; see DS and DNSKEY.

How to check it

The NS lookup shows the nameservers published at the apex of the zone. The WHOIS lookup shows the nameservers registered at the registry, so you can compare the two sets.

The DNS propagation checker goes further: it finds the authoritative nameservers and queries them directly, alongside Cloudflare, Google Public DNS and Quad9. If the authoritative servers disagree with each other, one of them has an outdated copy of the zone.

  • SOA: the zone’s administrative record, which names the primary nameserver.
  • A and AAAA: needed for every nameserver name, and as glue for in-zone nameservers.
  • DS and DNSKEY: extend the delegation with DNSSEC signatures.

Frequently asked questions

How many nameservers should a domain have?

At least two, as RFC 1034 recommends, and preferably on different networks so that one outage does not take the whole domain offline. Most DNS providers give you two to four, run on anycast networks.

Where do I change my nameservers?

At your registrar, the company where you registered the domain. The registrar sends the change to the registry of the TLD (for example .com or .it), which publishes the delegation. Changing NS records inside your zone alone does not move the delegation.

Why do I see different NS records at the registry and in my zone?

The parent zone (the TLD) holds the delegation NS records, and your own zone holds its copy at the apex. They should be identical. If they differ, resolvers may use either set, which leads to inconsistent answers. Fix whichever side is out of date.

How long does a nameserver change take?

Delegation NS records in TLD zones often have TTLs of one or two days, so allow up to 48 hours for every resolver to pick up a change of provider. Keep the old provider serving the same records during that time.