What is the Function of the Nslookup Utility?

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.

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.

  1. Access to the command line interface
  2. 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:

  • nslookup

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.

  • google.com

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:

  • place [option]
  • Type: to end interactive mode.
  • exit

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.

Nslookup Options

Find all the important nslookup options in the following table.

nslookup Option Description
-domain=[domain-name] Change the default DNS name.
-debug Show debugging information.
-port=[port-number] Specify the port for queries. The default port number is 53.
-timeout=[seconds] Specify the time allowed for the server to respond.
-type=a View information about the DNS A address records.
-type=any View all available records.
-type=hinfo View hardware-related information about the host.
-type=mx View Mail Exchange server information.
-type=ns View Name Server records.
-type=ptr View Pointer records. Used in reverse DNS lookups.
-type=soa 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:

  • IP-address nslookup

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 becomes

  • -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.




Flash Sale

Hurry Up! Offer ends in
02 days
06 hrs
44 mins
33 secs
Buy Now