Reverse DNS lets a site look up your crawler's IP address and get back a host name on your own domain, such as crawl-7.bot.example.com. To pass the check, that host name must also resolve forward to the same IP address. This two-way match is called forward-confirmed reverse DNS, and it's one of the ways Cloudflare, Vercel and others identify bots (Cloudflare, Vercel).
Why one direction isn't enough
Whoever controls an IP address controls its reverse DNS record (its PTR record). A bad actor can set their PTR to say googlebot.com. As one analysis puts it, "a PTR record alone says whatever the IP's owner wants it to say" (ipregistry).
The forward lookup closes the gap. Only the owner of bot.example.com can make crawl-7.bot.example.com point back to that IP. When both directions agree, the address really belongs to that domain's owner.
How Cloudflare uses it
For the reverse DNS method, you give Cloudflare a list of domain suffixes and a user-agent pattern. Cloudflare collects the IPs it sees sending your user agent, runs reverse DNS on them, and keeps the ones that resolve to your domains (Cloudflare). Your addresses need correctly set PTR records.
One caution: Cloudflare's policy lists reverse DNS as a way to identify yourself, but names only Web Bot Auth and IP validation as validation methods for a submission (overview). Confirm during review which one it will use for your bot.
Setting it up
You need two records for every address your crawler uses.
- The PTR record (reverse). This is set by whoever controls the IP block, usually your hosting provider or network. Most cloud and VPS providers let you set it in their control panel. Set it to a host name on your domain, such as
crawl-7.bot.example.com. - The A or AAAA record (forward). In your own DNS, point
crawl-7.bot.example.comto the same IP address. Use an A record for IPv4 and an AAAA record for IPv6.
Then check both:
dig -x 203.0.113.7 +short
# crawl-7.bot.example.com.
dig crawl-7.bot.example.com A +short
# 203.0.113.7Good habits
- Use a subdomain just for crawlers, such as
bot.example.com. Then a check can match one suffix without trusting your whole company domain. - Give each address its own host name. It makes logs and abuse reports easier to trace.
- Set records for IPv6 too, if your crawler sends over IPv6.
- Never share these addresses with other services. Cloudflare removes verified bots whose addresses are used by anything else (policy).
How a site checks your crawler
This Python function does the same check a site would run.
import ipaddress
import socket
def verify_crawler_ip(ip: str, allowed_suffixes: tuple) -> bool:
"""Forward-confirmed reverse DNS: PTR must end in an allowed domain,
and that hostname must resolve back to the same IP."""
try:
hostname = socket.gethostbyaddr(ip)[0].rstrip(".").lower()
except (socket.herror, socket.gaierror):
return False
if not any(hostname == s or hostname.endswith("." + s) for s in allowed_suffixes):
return False
try:
infos = socket.getaddrinfo(hostname, None)
except socket.gaierror:
return False
target = ipaddress.ip_address(ip)
return any(ipaddress.ip_address(info[4][0]) == target for info in infos)
print(verify_crawler_ip("203.0.113.7", ("bot.example.com",)))Two details matter. The suffix check matches on a dot boundary, so notbot.example.com does not pass as bot.example.com. And IP addresses are compared as addresses, not text, so IPv6 written two different ways still matches.
How we tested it: we ran it against mocked DNS answers covering a valid address, an IPv6 address, the wrong domain, a missing PTR, a PTR that lies about its forward record, and two suffix tricks. All passed.
Reverse DNS or an IP list?
| Reverse DNS | Published IP list | |
|---|---|---|
| You maintain | PTR and forward records per address | One file listing your ranges |
| Adding an address | Set two records | Update the file |
| Who must cooperate | Your IP provider, for PTR | Nobody |
| Works when addresses are shared | No | No |
Both need addresses used only by your bot. Many operators do both, and add a Web Bot Auth signature on top.
PacketPaper's planned Bot Home plan includes dedicated addresses with reverse DNS under your domain, set up for you. It's planned, not live yet. Join the waitlist.