How to specify a DNS server in nslookup?Copy article link
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 188.8.131.52
Nslookup will now use Google's DNS server — running at the IP address 184.108.40.206 — to query the DNS records of isc.org.
The syntax for nslookup is:
nslookup [-option ...] domain-name [dns-server]
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
nslookup -port=42 isc.org 220.127.116.11
Setting a DNS server in nslookup's interactive mode
You can run nslookup in interactive mode by typing
nslookup without a domain name. This way, you can keep an nslookup session open. To set the DNS server in interactive mode, enter
server 18.104.22.168 to switch to Google's public DNS servers.
% nslookup Default Server: UnKnown Address: fe80::21c:42ff:fe00:18 > server 22.214.171.124 Default Server: dns.google Address: 126.96.36.199 > set port=53
If you use the DNS server's hostname, then nslookup needs to resolve that to an IP address. It will try to do so with the currently set DNS server. If that server can't resolve the IP address of the new DNS server, then you can use
lserver instead. This will instruct nslookup to use your local DNS resolver instead of the one set in this nslookup session.
There is no difference between
lserver if you use the DNS server's IP address.
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.