View DNS resolution using the NSLOOKUP command in Linux

Home > Search > Linux commands
  by

The nslookup command without any options will start an interactive prompt.

[root@server1 ~]# nslookup
>

 

The prompt expects a hostname to lookup. In this example, www.example.com is looked up.

[root@server1 ~]# nslookup
> www.example.com
Server:		192.168.0.6
Address:	192.168.0.6#53

Non-authoritative answer:
Name:	www.example.com
Address: 93.184.216.34
>

 

This can also be accomplished by typing nslookup followed by www.example.com.

[root@server1 ~]# nslookup www.example.com
Server:		192.168.0.6
Address:	192.168.0.6#53

Non-authoritative answer:
Name:	www.example.com
Address: 93.184.216.34

 

The first and second lines of the output list the IP address of the nameserver that is being used to resolve the hostname to an IP address. The IP address of the nameserver is retrieved from the /etc/resolv.conf file.

The following lines list the hostname and IP address of the target host.

 


server can't find NXDOMAIN

If server can't find NXDOMAIN is displayed, this means the nameserver cannot resolve the hostname to an IP address.

[root@server1 ~]# nslookup www.bogus.com
Server:		192.168.0.6
Address:	192.168.0.6#53

** server can't find www.bogus.com: NXDOMAIN

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments