NSLOOKUP is a very powerful tool for troubleshooting and querying DNS servers and clients. There are a multitude of useful commands that will tell you everything you need to know about a DNS setup. Here are some useful commands and examples.
In its simplest form you can use the command:
nslookup <enter domain name here>
You can see in the below example I queried google’s DNS servers google-public-dns-a.google.com and nslookup returned 8.8.8.8
I can also do a reverse lookup querying the IP address and I get the FQDN returned:
You can also query specific types of DNS records – using the command below I queried Google’s DNS servers for the MX records:
nslookup -querytype=mx google.com
The below was returned:
You can also specify the name server you want to use by adding it to the end of the command. Below I am asking for the IP address of Google’s DNS servers using Cloudflare’s DNS servers (1.1.1.1).
nslookup google-public-dns-a.google.com 1.1.1.1
Here are some more common commands that are extremely useful:
nslookup -querytype=any google.com (Get all DNS records)
nslookup -querytype=mx google.com (Get mx DNS records)
nslookup -querytype=ns google.com (Get name server DNS records)
nslookup -querytype=soa google.com (Get Start of Authority DNS records)
nslookup -debug google.com (This gives additional information such as TTL)