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

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

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
Server:  dns.google

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

In the example above we used the nslookup command to query the public DNS server 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