NsLookup logo
Command line tools

How to specify a DNS server in nslookup?

Copy article link
The nslookup command line tool uses your system's DNS stub resolver by default. This resolver uses your ISP's DNS servers if you haven't changed them. You can overwrite this default setting by specifying a DNS server in the command itself.

To query a specific DNS server in nslookup, add the server's IP or hostname at the end of your command. For example:

nslookup isc.org

Nslookup will now use Google's DNS server — running at the IP address — to query the DNS records of isc.org.

The syntax for nslookup is:

nslookup [-option ...] domain-name [dns-server]
A specific DNS server in nslookup
A specific DNS server in nslookup.

Checking the nslookup documentation from the command line

If you ever forget the order of nslookup's parameters, remember that you can check them from the command line.

On Windows, you can type nslookup /? to get a short help message.

On Linux and macOS, type man nslookup instead.

Specifying the port number

DNS uses port 53. But some DNS servers listen on a different port. In that case, you'll have to tell nslookup to use that port instead. You can change the port nslookup uses by adding the -port=42 option.

For example:

nslookup -port=42 isc.org

Looking up DNS records at multiple servers

The nslookup command line tool doesn't have any way to check DNS records at multiple servers at once. You need to run the command multiple times if you want to check multiple servers.

A simpler way to check the DNS propagation for a domain name is using our DNS checker. This will show you the DNS records at global and regional DNS servers.