Reverse DNS
A reverse DNS query can be used to resolve a given IP address into a hostname. We can use the following commands:
$ host <ip>
$ dig -x <ip>The DNS pointer (PTR) record provides the domain name associated with an IP addresss, and is exactly the opposite of the A record.
IPv4
While DNS A records are stored under the given domain name, DNS PTR records are stored under the IP address — reversed, and with ".in-addr.arpa" added. For example, the PTR record for the IP address 192.0.2.255 would be stored under "255.2.0.192.in-addr.arpa".
"in-addr.arpa" has to be added because PTR records are stored within the .arpa top-level domain in the DNS. .arpa is a domain used mostly for managing network infrastructure, and it was the first top-level domain name defined for the Internet. (The name "arpa" dates back to the earliest days of the Internet: it takes its name from the Advanced Research Projects Agency (ARPA), which created ARPANET, an important precursor to the Internet.)
Thus, we use this fact to perform the reverse DNS query:
$ dig <reverse-ip>.in-addr.arpa PTR
# eg. for 1.2.3.4
$ dig 4.3.2.1.in-addr.arpa PTR Last updated