It is helpful to have access to a website’s Domain Name System (DNS) records while troubleshooting DNS problems. Let’s see What is the Function of the Nslookup Utility?
All widely used operating systems provide capabilities that let users query a web server and get crucial data like IP addresses and other domain-related details.
Function of the Nslookup Utility
The nslookup command, which is used to get server records, will be introduced in this article. It will also give samples of the most common options for the command.
- Access to the command line interface
- Access to internet
Syntax for NSlookup
There are two ways to utilize the nslookup command: interactively and without interaction. Only the command name has to be entered to start the nslookup interactive mode:
The prompt that appears enables you to ask the server more than one question.
You may type in a domain name, for instance, and get information about it.
The information is output by nslookup followed by another prompt.
Before the query is in interactive mode, add an option on a separate line. Set the option before it:
Type: to end interactive mode.
You can do single queries against nslookup in a non-interactive manner. The non-interactive mode’s grammar is as follows:
options for nslookup [domain-name]
On the same line, the command and the query are written.
Find all the important nslookup options in the following table.
|Change the default DNS name.
|Show debugging information.
|Specify the port for queries. The default port number is 53.
|Specify the time allowed for the server to respond.
|View information about the DNS A address records.
|View all available records.
|View hardware-related information about the host.
|View Mail Exchange server information.
|View Name Server records.
|View Pointer records. Used in reverse DNS lookups.
|View Start of Authority records.
Setting up Nslookup
All of the main operating systems come with nslookup preinstalled. Install the dnsutils package if you need to reinstall it in Ubuntu or another Linux distribution with the APT package manager:
Install Dnsutils using sudo apt
The bind-utils package includes nslookup on CentOS, Fedora, and Red Hat. Install it by carrying out:
- install bind-utils with sudo DNF
How Should I Use nslookup?
To conduct DNS and reverse DNS searches and troubleshoot server-related issues, use the nslookup command. The command’s most frequent use is shown in the sections that follow.
1: NS Records for this Domain
Name Server (NS) records to keep track of the name servers for a domain. Type: to view a domain’s NS records.
-type=ns nslookup [domain-name]
2: View MX Records for Domains
All necessary Mail Exchange server information is kept in MX records. All email requests for the domain are forwarded to the proper mail server using this data.
To check a domain’s MX information, type:
mx [domain-name] nslookup
Names of mail servers are displayed in the output.
3: The Reverse DNS Lookup
Nslookup can be used to search for information on a domain name as well as to find the domain name linked to an IP address.
Use the following syntax to perform a reverse DNS lookup:
The domain name is output by the command.
4: Look at SOA Records
Start of Authority (SOA) records offer reliable details about the domain and server, including the administrator’s email address, serial number, refresh period, query expiration time, etc.
Type: to view a domain’s SOA records.
-type=soa nslookup [domain-name]
The relevant data is displayed in the output of the nslookup command.
5: View Records in Text
For users outside the domain, TXT records hold crucial information. For instance, TXT records are used by Google and Facebook to confirm domain ownership.
You can view a domain’s TXT information by using the nslookup command shown below:
nslookup [domain-name] -type=txt
Each TXT record is displayed in the output on a separate line.
6: View Every Record
Using any option, you can see every DNS record that a domain has available.
[Domain-Name] nslookup -type=any
The result displays data for NS, SOA, MX, and TXT.
7: View Specific Name Server Information
Use the following syntax to view the name, IPv4, and IPv6 details of a particular name server on a domain:
nslookup [domain-name] [name-server]
Now, only data from the name server you specified is output.
8: Records View Pointer
Reverse DNS lookups employ pointer records to verify that an IP address belongs to a particular domain name. Reverse the IP address when using the ptr option, so that 184.108.40.206 becomes 220.127.116.11:
-type=ptr nslookup [reverse-ip-address].in-addr. arpa
In the output, look for the domain name.
9: Inquire about a Non-Default Port
DNS servers interact on port 53. Using the port option, you can provide a different port to check:
[Port number] nslookup [domain-name]
10: Observe Debugging Data
Use the debug option to view data useful for debugging:
-debug nslookup [domain-name]
You ought to be able to install and use the nslookup command on Linux after reading this guide. The article gave illustrations of nslookup most typical use.