Linux Commands

Do a Reverse DNS Lookup in Linux

DNS process is known as forwarding DNS resolution in which it resolves the domain name with an IP address. Whereas, Reverse DNS Resolution or Reverse DNS lookup, also known as rDNS, is used to determine or resolve the IP address associated with the domain name. As the name implies, it is a reverse DNS lookup process that resolves an IP address back to the domain name.

Reverse DNS lookup is used by email servers to validate and block spam email messages. If the rDNS check fails, then Email servers by default mark the incoming messages as SPAM. Most of the time, email servers automatically reject the messages from an IP address that does not contain rDNS in place. Therefore, if you need to add an rDNS, you can contact your hosting or IP provider to do it.

In this article, we will explain how you can perform the reverse DNS lookup process in Linux through the command line environment.

There are three different commands available in the Linux system that can be used to perform the rDNS lookup process:

  • dig Command: Domain Information Groper, which is known as dig, is useful for observing DNS name servers.
  • host Command: host is a command-line utility used for performing the DNS lookups. It converts the hostnames to IP addresses and vice versa.
  • nslookup Command: Nslookup is used to examine Internet domain name servers.

Perform the Reverse DNS Lookup Using the dig command

Using the dig command, you can easily perform the rDNS lookup manually through the terminal and show answers that are returned from the name server(s) that were examined. This command gives flexible and clear output, which is the main reason DNS administrators used the dig command to resolve the DNS problems. Use the following command to perform the rDNS lookup in Linux:

$ dig –x ipaddress
$ dig –x

Perform Reverse DNS Lookup Using the host command

Host utility converts the names to IP address and vice-versa, as we have discussed above. To perform a DNS lookup using the host command, type the following command:

$ host ip-address
$ host

Perform Reverse DNS (rDNS) Lookup Using the nslookup Command

The nslookup is the most commonly used network administration tool that helps check and resolve DNS-related problems. It has two different modes for displaying the output: interactive and non-interactive mode.

The interactive mode displays the information about various hosts and domains against the query. In the non-interactive mode, it only shows the name and relevant requested details for a domain. Use the following nslookup command to display the information about the given IP address:

$ nslookup


The reverse DNS lookup is a straightforward method to ensure that the IP address does belong to the specified domain. So, using the above-mentioned commands, you can easily display the rDNS lookup information of a given Ip address. Please, send your query via comments.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.