Nslookup: Specify DNS Server – Windows, Linux & macOS

The nslookup (Name Server Lookup) – is a command-line tool for querying DNS (Domain Name System) servers, that is usually can be found on Windows, Linux and macOS systems out of the box.

This tool is used for resolving domain names, IP addresses and other specific DNS records.

By default, the nslookup command is using a DNS server configured locally, e.g. a DNS server provided by an ISP (Internet Service Provider).

Though with the nslookup you can change the default DNS server and query a specific one.

This short note shows how to specify the DNS server with the nslookup command.

Cool Tip: Get a hostname from an IP address using the nslookup! Read more →

Specify DNS Server for Nslookup

By default, the nslookup command queries a DNS server configured locally:

C:\> nslookup google.com
Server:  router.lan
Address:  192.168.88.1

Non-authoritative answer:
Name:    google.com
Addresses:  2a00:1450:4007:807::200e
          172.217.20.174

Usually it queries an IP address of your router or an IP address of the DNS server provided by your ISP.

To specify the DNS server for the nslookup command, use the syntax as follows:

C:\> nslookup <domain-name> <dns-server>
- example -
C:\> nslookup google.com 8.8.8.8
Server:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
Name:    google.com
Addresses:  2a00:1450:4007:80e::200e
          216.58.213.78

In the example above we used the nslookup command to query the public DNS server 8.8.8.8 to resolve the domain name google.com.

Cool Tip: How to setup a reverse name resolution! Read more →

Was it useful? Share this post with the world!

Leave a Reply