Nslookup known as “Name Server Lookup” is a utility that is utilized for querying DNS to obtain information regarding the domain. It retrieves domain name, IP address, mail server, and other DNS records. It also assists users in troubleshooting issues associated with DNS, test DNS server response, and many more.
“nslookup” comes pre-installed on Windows systems as well as some Linux distributions including Debian 12. In case you don’t have it on your Debian system, you can easily install it via your system’s package manager.
This guide will explain the methods for “nslookup” installation and usage on Debian 12.
Overview
- How to Install Nslookup on Debian 12
- How to Use Nslookup on Debian 12
- How to Uninstall/Remove Nslookup on Debian 12
- Bonus Tip: Nslookup Command’s Alternatives on Debian 12
- Wrap Up
How to Install Nslookup on Debian 12
To install the “nslookup” utility on Debian 12, install the “dnsutils” package from the default Debian repository. It contains the essential DNS tools along with all the dependencies for your system. You can install “nslookup” on Debian 12 by following the given steps:
Step 1: Update System Packages
First, refresh your Debian system’s packages list by utilizing the below-listed commands:
sudo apt upgrade
Step 2: Install “nslookup” on Debian 12
Next, install the “dnsutils” package for “nslookup” installation on the Debian 12 system as:
Step 3: Ensure “nslookup” Installation
Lastly, check the “nslookup” version to verify its installation on the Debian system:
The output shows the installed version of “nslookup” on the system:
How to Use Nslookup on Debian 12
The “nslookup” command is utilized to perform various tasks, such as checking DNS records, obtaining information about the domain name, and IP address, resolving DNS issues, and many more. To utilize the “nslookup” command on your Debian 12 system, go through the following sections.
Basic Syntax of “nslookup” Command
The “nslookup” command has the following syntax:
Here:
- “options” are optional flags/parameters that can be used to modify the “nslookup” command’s behavior.
- “name” is the domain name or IP address.
Common Option of “nslookup” Command
There are various options available for the “nslookup” command to modify/adjust its behavior. Some of the commonly used “nslookup” options are listed in the below table:
Options | Descriptions |
---|---|
-type | Sets the DNS record type |
-debug | Displays the debugging information |
-timeout | Sets the time in seconds for the DNS server to respond |
-port | Specifies the query port |
-vc | Use TCP for queries |
DNS Record Type for “nslookup” Command
The DNS record type defines the type of information related to the particular domain name. You can also specify the DNS record type in the “nslookup” command to get the desired records in the output. The commonly used DNS record types for the “nslookup” command are listed in the below table:
Record Type | Description |
---|---|
ANY | Display all available records |
A (IPv4 IP address) | Show information about the IPv4 address records |
NS (Name Server) | List name server records |
MX (Mail Exchange) | Look up mail exchange records |
SOA (Start of Authority) | Show authoritative information about the DNS zone |
PTR (Pointer Record) | Gets the pointer records that map IP addresses to domain names and is used in reverse DNS lookups. |
HINFO (Host Info) | Displays the host’s hardware-related information |
Using the “nslookup” Command in Debian 12
To use the “nslookup” command with various options and DNS record types, try out the following use cases:
- Use Case 1: Query DNS Record For a Domain
- Use Case 2: Query For a Certain DNS Record Type
- Use Case 3: Query With a Particular DNS Server
- Use Case 4: Query With a Specific Timeout Interval
- Use Case 5: Reverse DNS Lookup
- Use Case 6: Query in Debugging Mode
Use Case 1: Query DNS Record For a Domain
To query DNS records for a particular domain to get its information, use the “nslookup” command along with the specific domain name. For instance, we are querying the “linuxways.net” domain as seen below:
Use Case 2: Query For a Certain DNS Record Type
You can also query for a particular record type by specifying your desired record type using the “-type” option in the “nslookup” command. For example, we are displaying the “mx” DNS record for the domain:
If you want to query for the “ns” record type of a domain, specify it as:
To obtain the “soa” type record of the desired domain, type out the following command:
Similarly, you can specify the other desired record type, such as “A”, “HINFO”, or “PTR” to query the particular domain.
Use Case 3: Query With a Particular DNS Server
If you want to perform a query for a domain with a specific DNS server, use the following syntax. Here, we are querying with Google’s public DNS server i.e. “8.8.8.8”:
Use Case 4: Query With a Specific Timeout Interval
To set a specific timeout for the server to respond to queries, the “-timeout” option is used with the “nslookup” command. You can increase or decrease the timeout interval to provide more or less time respectively for the server to react/respond:
Use Case 5: Reverse DNS Lookup
If you want to find the domain name of the specific IP address, you can perform a reverse DNS lookup. To do so, use the “nslookup” command along with the particular IP address:
Use Case 6: Query in Debugging Mode
You can also perform a query for the desired domain in the debugging mode using the “-debug” option to get comprehensive information regarding the question and the received answer:
Manual of “nslookup” Command
You can also access the manual of the “nslookup” command using the given command. This command provides detailed information about the “nslookup” including its syntax, available options, and its usage:
How to Uninstall/Remove Nslookup on Debian 12
To remove or uninstall the “nslookup” utility from your Debian 12 system, you only need to remove the “dnsutils” package through the below-listed command:
Bonus Tip: Nslookup Command’s Alternatives on Debian 12
In Debian 12, some other tools are also available that offer similar functionality for DNS-related tasks. The popular alternatives of “nslookup” tools are “dig”, and “host”.
Dig
The “dig” is a more advanced and the best alternative tool for “nslookup”. It provides additional features and displays output in detail. Here, you can see how the “dig” command works and show the output in detail:
Note: You can also check out our Post about the “dig” command for more information about it.
Host
The “host” is another command-line tool commonly utilized for the quick DNS lookup. It provides the simple output of the query as seen below:
That was all about the “nslookup” installation and usage on Debian 12.
Wrap Up
To install the “nslookup” utility on Debian 12, install the “dnsutils” package from the default Debian repository via the “sudo apt install dnsutils” command. You can use the “nslookup” command with different options and record types to get desired information about DNS records, troubleshoot DNS, and many more. This guide has explained the method to install, use, and remove “nslookup” on the Debian 12 system.
I am a technical writer with a knack for learning and exploring new technologies. As a Computer Science Graduate, my expertise lies in the fundamentals of Programming languages and Linux OS. I strive to provide users with in-depth and informative articles that can help them understand the core concepts of modern technologies.