So here we will see about NSLOOKUP (Name Server Lookup) and some of its examples.
What is Nslookup?
Nslookup is the tool that lets you enter the hostname or domain name and see its corresponding IP address. It also lets you pass the IP address and get the corresponding hostname. (reverse DNS)
Installation, if your CentOS machine says Nslookup
command not found.
$ nslookup google.com -bash: nslookup: command not found
so here you will have to install bind-utils
. To install it, simply run yum install bind-utils
to take advantage of the nslookup command. If you have already seen my previous post on Dig Command, then you would have already installed it 🙂
$ yum install bind-utils
Nslookup command examples.
Now let’s see some of the examples to understand it better.
1. Display IP address
nslookup command followed by domain/hostname will display the IP address of the domain.
$ nslookup justgeek.io Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: Name: justgeek.io Address: 151.101.2.159
2. Get DNS details
You can use the -type
option to get various DNS details. For example to get MX records.
$ nslookup -type=mx justgeek.io Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: justgeek.io mail exchanger = 30 mx3.zoho.in. justgeek.io mail exchanger = 20 mx2.zoho.in. justgeek.io mail exchanger = 10 mx.zoho.in.
3. Get Nameservers
To get the nameserver of the domain using the command below
Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: justgeek.io nameserver = jerome.ns.cloudflare.com. justgeek.io nameserver = kia.ns.cloudflare.com.
4. Reverse DNS
You can also check out the reverse DNS records using the Nslookup command
[centos@centos7 ~]$ nslookup 45.77.77.200 200.77.77.45.in-addr.arpa name = 45.77.77.200.vultrusercontent.com.
5. Get information from a specific DNS server
If you want to get the information from the specific nameservers
[root@server /]# nslookup redhat.com ns1.redhat.com Server: ns1.redhat.com Address: 209.132.186.218#53 Name: redhat.com Address: 209.132.183.105
we have used ns1.redhat.com as the DNS server. Here you may notice that we don’t get any “Non-authoritative answer:” header since ns1.redhat.com has all the zone information of redhat.com. If you don’t know the difference between authoritative and non-authoritative DNS then you have a look at THIS article.
6. Lookup TXT records.
If you want to look up the TXT records of the domain, you can use the command below.
$ nslookup -type=txt justgeek.io Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: justgeek.io text = "google-site-verification=FCqdK9l9pjUoqW4a6I0vRqA_0AR-hLJrSv8zLAiA9EU" justgeek.io text = "v=spf1 include:zoho.in ~all" justgeek.io text = "zoho-verification=zb28932709.zmverify.zoho.in" Authoritative answers can be found from:
The nslookup command doesn’t end here there are tons of options you can use with it. You can check out the image below which will give some pointers.

As you would see the DIG command and Nslookup command have a lot of similarities. However, someday I will post the difference between them and which one to use.