How does reverse DNS lookup work?
You have an IP address like
and you want to know which domains point to it.
I always used to Google “reverse IP”,
then use a web service like this one.
I assumed these services must have some giant database of all public DNS records
in order to invert the query.
That’s not how it works!
You can do the same “reverse IP” query yourself
using a tool like
$ dig +short PTR 22.214.171.124.in-addr.arpa google-public-dns-b.google.com.
And sure enough,
if we ask for the IP for
$ dig +short A google-public-dns-b.google.com 126.96.36.199
This works because DNS has a
PTR record type,
which is like the inverse of the
A record type.
Where there is a record
google-public-dns-b.google.com. IN A 188.8.131.52,
there is an equivalent inverse record
184.108.40.206.in-addr.arpa. IN PTR google-public-dns-b.google.com..
Notice the weird notation
All IP addresses
A.B.C.D are assigned a “domain”
This hack seems to be necessary because
the “left-hand side” of DNS record types are supposed to be domains,
not IP addresses.
PTR query is on a separate set of
and not on the canonical set of
there is no guarantee that it will give you an inverse.
PTR records can be inconsistent with the
dig look up the “domain”
The same as for any other domain name!
Traverse the domain name from the root,
beginning by asking the root nameservers.
We get results like these:
arpa. IN NS a.root-servers.net. in-addr.arpa. IN NS a.in-addr-servers.arpa. 8.in-addr.arpa. IN NS ns1.Level3.net. 8.8.in-addr.arpa. IN NS ns1.Level3.net. 4.8.8.in-addr.arpa. IN NS ns1.google.com.
The IP address space is hierarchical,
just like the domain name space.
But the most-significant digit is on the left of the IP address,
unlike the most-significant part of the domain name,
which is on the right.
This is the reason that the IP address
is reversed when placed into its “domain”
The owner of the IP address space
is in control of the domain
Apparently Google is the owner of
We can explore these ownerships with other tools,
but that’s another blog post.
More by Jim
- Your syntax highlighter is wrong
- Granddad died today
- The Three Ts of Time, Thought and Typing: measuring cost on the web
- I hate telephones
- The sorry state of OpenSSL usability
- The dots do matter: how to scam a Gmail user
- My parents are Flat-Earthers
- How Hacker News stays interesting
- Project C-43: the lost origins of asymmetric crypto
- The hacker hype cycle
- The inception bar: a new phishing method
- Time is running out to catch COVID-19
- A probabilistic pub quiz for nerds
- Smear phishing: a new Android vulnerability