NSlookup commands – How to use them?

There are many commands that you can use on Linux, but just a few are that simple and yet useful as the Nslookup command. Small, fast, and handy, it is just a few lines from answering your questions about a domain. 

Nslookup, what is it?

The name of Nslookup breaks down to ns for nameserver and lookup for querying it. Nslookup is a software with a command-line interface that you can use from the Terminal and check domains, devices/IP addresses, or DNS records. You can use it on Linux, of course, but it is also available on macOS and even Windows. 

It comes pre-installed on most of the Linux distros, so you don’t need to download it yourself. Network admins like it because it is small, easy to use, and additional options can modify the query by choosing a port, timeout period, and more. The answers that the Nslookup command provides are simple and clean. 

By default, you will get IP address (if you checked domain) or domain (for reverse lookup), and it will show you if the answer came from authoritative or non-authoritative server. If you need more detailed answers and statistics, you can later use another software as an addition.  

If you need more detailed information, we suggest you to take a look at this article about Nslookup commands.

Nslookup command examples

Try it with these Nslookup command examples of common use cases:

  • The A record of a domain (shows IP address)

$ nslookup example.com

Performing this query, you will get the address of the domain. Both IPv4 and IPv6 will show. 

  • The NS records of a domain (the authoritative nameserver)

$nslookup -type=ns example.com

You will get which are the non-authoritative and which is the authoritative nameserver for the domain. Later you can check any of the nameservers that showed in the list. 

  • The SOA record of a domain (start of authority)

$nslookup -type=soa example.com

This record will show you the start of authority and general technical information about the zone. You will also see the email of the DNS administrator for the domain. 

  • The MX record, information about the email exchange

$ nslookup -query=mx example.com

See the MX records of the mail servers. 

  • See all DNS records of the domain

$ nslookup -type=any example.com

You can also perform a more general query and see all available DNS records. This could serve you to get a broad idea. Then you can check a specific DNS record. 

  • Check a specific name server

$ nslookup example.com ns1.nsexample.com

You can also make a query and see data for a particular name server. You will get the domain name, IPv4, and IPv6 addresses. 

  • Reverse DNS lookup

$ nslookup 11.22.33.44

Make sure that an IP address is really matching the domain. Do a reverse DNS lookup and verify it. 

  • Check a domain through a specific port

$ nslookup -port=51 example.com

In this example, we are doing the same nslookup as in the beginning, but the difference is that we are doing it via port 51. You can change the number to the port that you like. 

  • Check a domain with a specific reply timeout interval

$ nslookup -timeout=20 example.com

The reply timeout interval can be changed. In this case, we have set it to 20 seconds, but you can extend to more time or shorten it to less. If you increase, you are giving more time to the name servers to respond. 

  • Activate the debug mode

$ nslookup -debug example.com

The debug mode will give a lot more information. The additional data will be provided both for the question and the answer to the query. 

We recommend you take a look at our articles about Dig command, Traceroute command, and MTR command.

Conclusion

Nslookup command has its clear purpose – probe name servers. It does it well and fast. Yes, there are at least a few more network tools like Host command, Dig command, Traceroute command, and Ping command, but the Nslookup is still in use. 

You can easily integrate it into your work and use it together with some of the rest to monitor your domain and your website’s normal functionality. 

Article Writter By

Tux

Write a Comment

Your email address will not be published. Required fields are marked *