Home Beginner's Guide Top 3 ways to lookup reverse DNS on Linux

Top 3 ways to lookup reverse DNS on Linux

by Hend Adel
reverse dns lookup linux

Generally speaking, the forward Domain Name Server or DNS can be used to detect the associated IP address for a particular domain name. In contrast, the reverse Domain Name Server or “rDNS” is the process of determining the hostname associated with a given IP address. In other words, we can say that the reverse DNS will perform a reverse IP lookup.

Reverse DNS lookup in Linux

The reverse DNS is used in general network troubleshooting, Email Servers, avoid spammers, and so on. In this tutorial, we will show you how to perform a reverse DNS lookup using one of the following methods:

  • Using the dig command
  • Using the host command
  • Using the nslookup command

Before starting, let’s check first how to issue a forward DNS lookup using the dig command as follows:

dig www.facebook.com

As you can notice, using the above command, you will be able to get the Facebook IP address.

Get Website IP

Get Website IP

Method 1: Check the reverse DNS using the Dig command

Typically, the dig is a shortcut for domain information groper, and it can be used to return the domain name.

Syntax:

dig [server] [name] [type]

The command lets you perform any valid DNS query such as:

  • A (the IP address)
  • TXT (text annotations)
  • MX (mail exchanges)
  • NS nameservers
dig -x 157.240.195.35
Check The Reverse DNS Using The Dig Command

The Dig Command

Moreover, you can use some additional options just to display the answer section as following:

dig -x 157.240.195.35 +noall +answer
Check The Reverse DNS Using The Dig Command With Options

The Dig Command With Options

Method 2: Check the reverse DNS using the Host command

Host checks DNS, transforms domain names to IP addresses, and vice versa. If no arguments or options are given, the host will print a summary of its command-line arguments and options.

Syntax:

host [-aCdlnrsTwv] [-c class] [-N ndots] [-R number] [-t type] [-W wait]
[-m flag] [-4] [-6] {name} [server]

In this method, the host command will be used to return the domain name as follows:

host 157.240.195.35
Check The Reverse DNS Using The Host Command

Using The Host Command

Method 3: Using the Nslookup command

Finally, the last command that can be used to return the domain name is the nslookup command. It is a simple command that is used to query the domain name servers.

Syntax

nslookup [option]

Its usage is as follows:

nslookup 157.240.195.35
Check The Reverse DNS Using The Nslookup Command

Using The Nslookup Command

Conclusion

That’s all about various ways of looking up reverse DNS from your Linux system. All the mentioned commands are Distro independent; hence you should be able to execute on any Linux system. What other method do you prefer and why? Let us know in the comments below.

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.