Look up the name servers and SOA record of a domain

· 3 min read

Before you change a DNS record you need to know where the zone actually lives. Two records answer that: NS names the responsible name servers, SOA carries the zone's version. This guide covers the lookup with dig, nslookup, PowerShell and host, and how to tell whether the registry and the name servers agree.

NS and SOA lookup

Choose the record and your tool. Query the domain itself rather than www: subdomains normally have no NS records of their own.

What to check
Tool

Only inserted into the commands in your browser.

Name servers (NS) · dig · Linux, macOS

Lists the name servers responsible for the domain. The names usually give away the DNS provider.

Shell
dig +short NS example.com
Sample output
ns1.example.net.
ns2.example.net.

Name servers (NS) · nslookup · Windows, Linux, macOS

The same lookup on Windows, Linux and macOS. Each "nameserver =" line is one NS record.

Shell
nslookup -type=NS example.com
Sample output
Non-authoritative answer:
example.com	nameserver = ns1.example.net.
example.com	nameserver = ns2.example.net.

Name servers (NS) · PowerShell · Windows

The NameHost column holds the name servers. Resolve-DnsName often appends their IP addresses as extra rows.

PowerShell
Resolve-DnsName -Name example.com -Type NS -DnsOnly

Name servers (NS) · host · Linux, macOS

The short form for Linux and macOS.

Shell
host -t NS example.com
Sample output
example.com name server ns1.example.net.
example.com name server ns2.example.net.

SOA · dig · Linux, macOS

+multiline labels the SOA fields and converts the seconds. The ones that matter are the serial (the zone's version) and minimum (how long "does not exist" is cached).

Shell
dig +noall +answer +multiline SOA example.com
Sample output
example.com.		1800 IN	SOA ns1.example.net. hostmaster.example.net. (
				2026111001 ; serial
				10000      ; refresh (2 hours 46 minutes 40 seconds)
				2400       ; retry (40 minutes)
				604800     ; expire (1 week)
				1800       ; minimum (30 minutes)
				)

SOA · nslookup · Windows, Linux, macOS

origin is the primary name server, mail addr the address of the person responsible (the first dot stands for the @).

Shell
nslookup -type=SOA example.com
Sample output
Non-authoritative answer:
example.com
	origin = ns1.example.net
	mail addr = hostmaster.example.net
	serial = 2026111001
	refresh = 10000
	retry = 2400
	expire = 604800
	minimum = 1800

SOA · PowerShell · Windows

Format-List prints every field on its own line, including the primary name server and the serial number.

PowerShell
Resolve-DnsName -Name example.com -Type SOA -DnsOnly | Format-List

SOA · host · Linux, macOS

All seven fields on one line: primary name server, contact, serial, refresh, retry, expire, minimum.

Shell
host -t SOA example.com
Sample output
example.com has SOA record ns1.example.net. hostmaster.example.net. 2026111001 10000 2400 604800 1800

Ask for NS or SOA on a subdomain such as www.example.com and the answer is empty; dig shows the SOA record of the enclosing zone in the AUTHORITY section instead. That is a quick way to find where a zone starts.

What the registry has on file

Name servers are recorded in two places: the delegation at the TLD registry (set through your registrar) and the NS records inside the zone. Resolvers follow the delegation. To see it, ask a TLD server without recursion:

Shell
# find the TLD servers (here .com), then ask one of them
dig +short NS com.
dig +norecurse +noall +authority NS example.com @a.gtld-servers.net

The answer sits in the AUTHORITY section because the TLD server only refers you onward. If this list differs from what the name servers themselves return, a name server change is only half done.

Are all name servers in sync?

Every change to the zone raises the serial number in the SOA record. A name server that returns a lower serial is serving an old copy, and part of your visitors get stale answers. dig +nssearch asks every name server in turn:

Shell
$ dig +nssearch example.com
SOA ns1.example.net. hostmaster.example.net. 2026111001 10000 2400 604800 1800 from server 192.0.2.53 in 22 ms.
SOA ns1.example.net. hostmaster.example.net. 2026111001 10000 2400 604800 1800 from server 198.51.100.53 in 23 ms.

The third value after SOA is the serial; it has to match on every line. On Linux and macOS host -C example.com does the same job. Providers such as Cloudflare replicate internally and always show one serial, while a classic zone transfer between primary and secondary makes any drift obvious.

When the answer is not what you expected

Likely causes:

  • Different name servers than you assumed: the domain is hosted with another DNS provider, for instance after a move to Cloudflare. Records at the old host have no effect.
  • Status REFUSED or SERVFAIL when you query a name server directly: it does not host the zone (lame delegation). The domain was deleted there or never set up.
  • Registry and zone list different name servers: the change was not saved at the registrar, or the NS records in the zone were never updated.
  • Different serials: the zone transfer to the secondary is stuck, often behind a firewall or a transfer that was never allowed.
  • Only one name server: if it fails, the domain stops resolving. Many registries require at least two.
  • NXDOMAIN: the domain is not registered, has expired or has no delegation.

Checking without a terminal

The name server check asks every name server for the SOA record, verifies that it answers authoritatively with the same zone version, and shows whether the servers sit in different networks. The glossary explains how name servers, registrar and registry fit together.

Frequently asked questions

How do I find out which name servers a domain uses?
dig +short NS example.com on Linux and macOS, nslookup -type=NS example.com on Windows. The answer lists the host names of the responsible name servers.
What is the serial number in the SOA record?
It is the zone's version number and goes up with every change. Secondary name servers use it to notice that they need to fetch the zone again. YYYYMMDDNN is the usual format; some providers use a timestamp.
What is the email address in the SOA record for?
It names the person responsible for the zone. The first dot replaces the @: hostmaster.example.net means hostmaster@example.net.
Why does nslookup say "Non-authoritative answer"?
Because the reply came from your resolver's cache. It is not an error. You get an authoritative answer by passing one of the domain's name servers as the last argument.
Check now

Free name server check: does every NS answer authoritatively, do all serve the same zone data, are they in different networks? Finds lame delegation.

DomainWarn checks the name servers of all client domains on a schedule and alerts you when the delegation changes, a name server stops answering or the zone versions drift apart.

Monitor this domain continuously14-day free trial, no credit card.

More guides