Lookup DNS on a Specific Nameserver with NSLOOKUP

The nslookup command is really easy to use. You just type nslookup [host-name] and you get an answer. But what do you do when it looks like it is working, but your monitoring is detecting intermittent issues connecting to a website? The answer is, you check each nameserver individually to make sure they are all giving out the same answer.

Find the Nameservers with NSLOOKUP

Let’s look up the nameservers for our website. We’ll usually get back multiple answers. Two or three is pretty common. We can use nslookup -querytype=ns [root domain] to do this.

C:\>nslookup -querytype=ns stevefenton.co.uk
Server:  UnKnown

Non-authoritative answer:
stevefenton.co.uk       nameserver = dane.ns.cloudflare.com
stevefenton.co.uk       nameserver = amy.ns.cloudflare.com

Check Each Nameserver with NSLOOKUP

This is how you look up records from a specific name server. It uses the syntax nslookup [host-name] [nameserver]. You can supply the name of the nameserver: nslookup www.stevefenton.co.uk amy.ns.cloudflare.com, or its IP address: nslookup www.stevefenton.co.uk 2a06:98c1:50::ac40:2065.

C:\>nslookup www.stevefenton.co.uk amy.ns.cloudflare.com
Server:  amy.ns.cloudflare.com
Address:  2a06:98c1:50::ac40:2065

Name:    www.stevefenton.co.uk

Repeat this for each nameserver and keep an eye out for any that are giving out bad answers.


And finally, some quick nslookup tips.

Simple DNS Check

nslookup [host-name]
nslookup www.example.com

Specific Record Type Check

nslookup -querytype=[record-type] [host-name]
nslookup -querytype=mx example.com

Nameserver Lookup

nslookup -querytype=ns [host-name]
nslookup -querytype=ns example.com

DNS Check Against Specific Nameserver

nslookup [host-name] [nameserver]
nslookup www.example.com a.iana-servers.net