Introduction to Linux nslookup
In the Linux operating system, we are having the functionality to use the nslookup utility. It is known as the name server lookup. The nslookup utility or the tool is used to do the DNS lookups in the Linux environment. While doing the nslookup on the respective DNS servers. It will give the details information in terms of IP address, MX records information, NS server details, etc. There are two different modes to work with nslookup. As per the requirement, we can use the below two different nslookup modes.
- Interactive Mode
- Non Interactive Mode
The author of the nslookup is Internet Systems Consortium, Inc.
nslookup [ OPTION ] [ SERVER ]
- nslookup: We can use the “nslookup” keyword in the syntax or command. It will take different arguments like options and name server name. As per the provided arguments, it will print the detailed information provided name server with associated IP address, MX records information, NS server details, etc.
- OPTION: We can provide the different flags as the option that is compatible with the “nslookup” command.
- SERVER: As per the requirement, we can provide the different name servers with the nslookup command.
How Linux nslookup Works?
While we are browsing any website or anything on the Linux platform, generally we are using the URL. When we are accessing any URL, the URL is associated with the specific IP address. The information of the IP address and URL is present in the DNS server. The DNS server stands for Domain Name System. If we are facing any issues while accessing the URL, we need to check the DNS records. If any issues come with the DNS server. To fix these issues or troubleshoot the DNS issues, we need to use the nslookup functionality.
The nslookup will accept the different types of arguments like options and the server name. As per the command inputs, the nslookup will give the detailed information of the name server like IP address, MX records information, NS server details, etc.
Below are the lists of options that are compatible with the nslookup command.
|1||[no]debug||While searching it will turn on or off the display of the full response and any intermediate response packets. The default value is no debug and the abbreviation value is no-deb|
|2||[no]d2||It will turn the debugging mode on or off. This displays more about what nslookup is doing. The default value is nod2|
|3||domain=name||With the help of this option, we can set the search list by name.|
|4||[no]search||Unless and until we will not receive the answer. It will append the domain names in the domain search list. The default value is search|
|5||port=value||It will help to change the default TCP or UDP name server port to value output. The default value is 53 and the abbreviation value is po.|
|It will help to change the type of information query. The default value is A and the abbreviations value is q, ty|
|7||[no]recurse||It will help to tell the name server to query to the other servers. If it does not aware about the information. The default is recursive and the abbreviation value is no recursive|
|8||ndots=number||It will help to set the number of label separators (i.e. the dots) in the domain. It will be the reverse order of searching. If it will be the absolute names then it will always stop searching.|
|9||retry=number||It will help to set the number of retries in terms of number.|
|10||timeout=number||It will change the initial timeout interval. It will be waiting time for a reply (in number seconds).|
|11||[no]vc||It will always use the virtual circuit when it will be sending the request to the server. The default value would be novc|
|12||[no]fail||If a name server responds with SERVFAIL or the terminate query or fail. In such cases, it will try the next name server. The default value is no fail.|
Lets us discuss Examples to implement Linux Nslookup.
Example #1 – Find A Record of the Domain
In the Linux environment, we can run able to find the A Record of any domain. To find the record, we need to use the nslookup utility.
As per the above command, we are running the simple nslookup command. It will give the basic information of the goole.com domain like server IP address name, etc.
Example #2 – Get Start of Authority Record
In the nslookup command, we are having the functionality to get the Start of Authority record of any domain.
nslookup -type=soa www.google.com
We are using the nslookup command to find the SOA record of www.google.com domain. The SOA record will give the administrative information about the zone (mainly as zone transfers).
Example #3 – Get all Available DNS Records.
With the help of nslookup command, we are able to get all the available DNS associated with the domain.
nslookup -query=any www.google.com
As per the above command, we are able to get all the DNS records available with the www.google.com domain.
Example #4 – Enable Debug Mode
In nslookup command, we are having the functionality to enable the debug mode. It will help to get the information in terms of verbose mode.
nslookup -debug www.google.com
In the above command, we are able to enable the debug mode. It will give the detail information of www.google.com domain with the type (A), class (IN), AAAA Address, etc.
We have seen the uncut concept of “Linux nslookup” with the proper example, explanation, and command with different outputs. The nslookup command or tool is an administrative tool for debugging or troubleshooting the DNS server issues. We are able to get information like DNS servers IP address, MX records information, NS server details, etc.
This is a guide to Linux nslookup. Here we also discuss the introduction and How Linux nslookup works along with different examples and its code implementation. You may also have a look at the following articles to learn more –