Nslookup command: definition and examples

Nslookup command- definition

Nslookup command is a commonly used network administration tool with a simple command-line interface (CLI). When we take a look at its name, “ns” stands for the nameserver, and “lookup” is for querying it. It is mainly used for searching the corresponding IP address to a specific host. Moreover, it is a great tool for Reverse DNS Lookup, which is the process of finding the domain name behind an IP address.

You are able to utilize it from the Terminal and check domains, DNS records, or devices/IP addresses. Furthermore, you can access it on different operating systems (OS) such as Linux, macOS, and Windows. It is pre-installed for most Linux distros, and you are not required to download it yourself.

Nslookup command is very appreciated by network administrators because it has additional options for adjusting the query by selecting a port, timeout period, and more. Also, it provides a simple and clean answer.

You are going to receive the IP address when you check a domain. 

You are going to receive a domain when you check an IP address. (Reverse DNS lookup)

It provides information if the answer arrives from an authoritative or non-authoritative server. 

Examples

Here are some examples of the Nslookup command that you can easily implement. Just make sure to change the domain and the IP address with the one you want to check.

Find an IP address of a domain name

nslookup domain.net

It is going to give you the data from the A and AAAA records of the domain name, and you can easily view the IPv4 and IPv6 addresses.

Check a specific DNS record

nslookup -type=TYPE domain.net 

You can replace TYPE with the type of DNS record you desire to query, such as A, AAAA, MX, SOA, NS, ANY (any type available). 

nslookup -type=a domain.net – It will return the IPv4 addresses of the domain.

nslookup -type=aaaa domain.net – It will return the IPv6 addresses of the domain. 

nslookup -type=mx domain.net – It will return the MX records. Also, you can view the accountable email servers for receiving messages. 

nslookup -type=soa domain.net – It will return the start of authority. 

nslookup -type=ns domain.net – It will show the available name servers. 

nslookup -type=any domain.net – It will return all of the available DNS records. 

Check a particular name server.

Once you have examined all of them with the NS query, you could probe each of them separately. 

nslookup domain.net ns1.domain.net

Replace ns1.domain.net with one of the name servers for your domain. 

Check an IP address (Reverse DNS lookup)

You can also examine an IP address (IPv4 or IPv6) and notice if a PTR record is placed in a Reverse DNS zone

nslookup 123.45.67.89

Replace the 123.45.67.89 IP address with the one you want to test. 

Check a specific port.

With the Nslookup command, you can query a server by a selected port. In this example, we utilize port 53. Replace it with a different one if you want. 

nslookup -port=53 domain.net

Set a time limit to wait for a response.

You can establish the waiting time, in seconds, for the queries. In this example, we set it to 35 seconds. You can choose a different period. 

Nslookup -timeout=35 domain.net

Leave a Reply

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