Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How forward and reverse DNS works

Tags:

dns

What I understand about how DNS works is like this: first let's assume mydomain.com has the IP address 12.34.56.78. Now when I put the url mydomain.com in the browser, the browser sends a dns lookup to its local dns server, asking, hey, do you know the ip address for mydomain.com. If the local dns server does not know about it, it will ask the parent dns servers, if the parent also does not know, then it keeps asking all the way up until the root dns server. The root dns server will ask some server in charge of the .com tld. The dns server in charge of the .com will have knowledge about mydomain.com because mydomain.com is the .com family. Then the answer will be returned back to the initial asker. Also the answer quite likely will be cached in the dns servers involved in the asking process. Would anyone correct my understanding if it is wrong.

So my real question is about how reverse dns lookup works. Let's say if I want to find out what domain name is for the ip 12.34.56.78. I run the command dig -x 12.34.56.78. If my local dns server does not know the answer, which server does it further ask? Is it 12.in-addr.arpa., or 34.12.in-addr.arpa.? If this is the case, are these names like 12.in-addr.arpa. valid domain names? And where should they be deployed so that the reverse lookup requests will know whom to ask?

like image 245
Qian Chen Avatar asked Jun 01 '14 14:06

Qian Chen


People also ask

How does reverse DNS work?

Reverse DNS works by looking up query DNS servers for a pointer record (PTR). A PTR record maps an IPv4 or IPv6 address to the canonical name for the host. If there is no PTR record on the server, it cannot resolve a reverse lookup. PTR records store reverse DNS entries, with their IP address reversed and .

What is the difference between forward and reverse DNS?

Forward DNS lookup is using an Internet domain name to find an IP address. Reverse DNS lookup is using an Internet IP address to find a domain name.

How do I do a forward and reverse DNS lookup?

Type in an IP address (for example 8.8. 8.8) and press enter and the tool will make a reverse DNS lookup and return the name record for that IP address. Want to see this kind of data for all of your website visitors? Leadfeeder is a reverse DNS tool that can show you every company that is visiting your website.

What is DNS and reverse DNS?

Reverse DNS (rDNS or RDNS) is a Domain Name Service (DNS) lookup of a domain name from an IP address. A regular DNS request would resolve an IP address given a domain name; hence the name “reverse.” A special PTR-record type is used to store reverse DNS entries.


1 Answers

How a reverse DNS lookup is accomplished:

  • The DNS resolver reverses the IP, and adds it to ".in-addr.arpa" (or ".ip6.arpa" for IPv6 lookups), turning 192.0.2.25 into 25.2.0.192.in-addr.arpa.
  • The DNS resolver then looks up the PTR record for 25.2.0.192.in-addr.arpa.
    • The DNS resolver asks the root servers for the PTR record for 25.2.0.192.in-addr.arpa.
    • The root servers refer the DNS resolver to the DNS servers in charge of the Class A range (192.in-addr.arpa, which covers all IPs that begin with 192).
    • In almost all cases, the root servers will refer the DNS resolver to a "RIR" ("Regional Internet Registry"). These are the organizations that allocate IPs. In general, ARIN handles North American IPs, APNIC handles Asian-Pacific IPs, and RIPE handles European IPs.
    • The DNS resolver will ask the ARIN DNS servers for the PTR record for 25.2.0.192.in-addr.arpa.
    • The ARIN DNS servers will refer the DNS resolver to the DNS servers of the organization that was originally given the IP range. These are usually the DNS servers of your ISP, or their bandwidth provider.
    • The DNS resolver will ask the ISP's DNS servers for the PTR record for 25.2.0.192.in-addr.arpa.
    • The ISP's DNS servers will refer the DNS resolver to the organization's DNS servers.
    • The DNS resolver will ask the organization's DNS servers for the PTR record for 25.2.0.192.in-addr.arpa.
    • The organization's DNS servers will respond with "host.example.com".

Source here.

like image 182
Shoikana Avatar answered Oct 04 '22 04:10

Shoikana