Normal DNS answers the question "what is the IP address of example.com?". Reverse DNS (rDNS) answers the opposite: "what name belongs to the IP address 203.0.113.10?". It is a small detail that most servers never need, until you send email. Then it can decide whether your messages arrive or land in spam. This guide explains how rDNS works, who controls it, and how to check it.
Before you start
- Your server's IP address from your VPS provider's control panel.
- A terminal on your computer: PowerShell on Windows, Terminal on macOS or Linux.
- Optional: a domain name you control, if you want to set up matching forward and reverse records.
Forward DNS vs reverse DNS
- Forward DNS uses A records (IPv4) and AAAA records (IPv6) to map a name to an address:
mail.example.com → 203.0.113.10. - Reverse DNS uses a PTR (pointer) record to map an address back to a name:
203.0.113.10 → mail.example.com.
The two are stored in different places:
- Forward records live in your domain's DNS zone, which you manage at your domain registrar or DNS provider.
- Reverse records live in a special zone for the IP address, which is controlled by whoever owns that block of addresses. For a server, that is the hosting provider.
That is why you cannot add a PTR record in your domain's DNS panel. You ask the owner of the IP address to set it.
How a PTR lookup works
For an IPv4 address, the numbers are reversed and placed under the special domain in-addr.arpa. A lookup for 203.0.113.10 becomes a query for:
10.113.0.203.in-addr.arpaThe answer is the PTR record, a hostname such as mail.example.com. IPv6 uses the same idea under ip6.arpa, with each hex digit reversed. You do not need to build these names yourself; the tools below do it for you.
Why mail servers check it
Receiving mail servers use rDNS as one signal of whether a sender is legitimate:
- A server with no PTR record looks like a home connection or a compromised machine, which are common sources of spam.
- A PTR record that does not match the name the server uses to introduce itself (its
HELOorEHLOname) also looks suspicious. - Many providers check forward-confirmed reverse DNS: the PTR record points to a name, and that name's A record points back to the same IP.
Missing or mismatched rDNS does not guarantee rejection, but it raises the spam score or causes outright refusal at strict providers. For mail, you also need SPF, DKIM and DMARC records.
Outside of email, rDNS makes logs and traceroute output easier to read, and some services use it for basic checks.
Check rDNS from your computer
On macOS or Linux, use dig with -x for a reverse lookup:
dig -x 203.0.113.10 +shortThe output is the hostname, for example mail.example.com., with a trailing dot. No output means there is no PTR record.
On any system, nslookup works too:
nslookup 203.0.113.10On Windows, PowerShell offers:
Resolve-DnsName 203.0.113.10Then check the forward direction to confirm they match:
dig mail.example.com +shortIt should return 203.0.113.10.
Getting a PTR record set
- Choose the hostname. It should be a name you control, such as
mail.example.comorserver1.example.com. - Create the A record for that name, pointing at your server's IP, at your DNS provider.
- Ask the owner of the IP address to set the PTR record. For a server, open a ticket, select the related service, give the IP address and the hostname you want, and ask whether a PTR record can be set for it.
- Set the server's own hostname to the same name.
Tip: Set the A record first. Some providers check that the name resolves to the IP before they set the PTR record.
Check it works
dig -x 203.0.113.10 +shortreturns your chosen hostname.dig mail.example.com +shortreturns the same IP.- On the server,
hostname -f(Linux) shows the same name.
Troubleshooting
- The lookup still shows an old or generic name: DNS caches answers for the record's TTL. Wait, then try again.
- The PTR and A records do not match: fix whichever is wrong so both point at each other.
- Mail still goes to spam: rDNS is only one part. Check SPF, DKIM, DMARC and whether the IP is on a blocklist.
- No output from
dig -x: there is no PTR record yet. Ask the IP owner to set one.
Next steps
- Learn how hostnames fit in: What is a server hostname?
- Set hostname and rDNS on Linux: Hostname and reverse DNS on Linux.
- Planning to run mail? Read Running email on a VPS: what to know first.
