PTR Records and Reverse DNS
See how PTR records map an IP address back to a name, who controls them, why mail servers care and how to check yours.
Key takeaways
- A PTR record maps an IP address to a hostname, using special zones under
in-addr.arpafor IPv4 andip6.arpafor IPv6. - Whoever controls the address block controls reverse DNS, so you often set it in a provider's control panel or request it.
- Mail receivers commonly expect a sending server to have a PTR record whose name resolves back to the same address.
- A PTR record is a hint written by the address holder, so it should not be treated as proof of identity on its own.
A PTR record answers the opposite question from an ordinary address lookup. Instead of "what is the address of this name?", it answers "what name belongs to this address?" That process is called reverse DNS, and you meet it in mail delivery, server logs, network diagnostics and security tools.
The part that surprises most people is ownership. You can control the forward records for your domain and still have no say over the reverse record for your server's address, because reverse DNS belongs to whoever holds the address block. If you need a PTR record changed, you usually ask your hosting company or internet provider.
How an address becomes a name to look up
DNS is a tree of names read from right to left, with the most general part at the end. IP addresses are written the other way around, with the most general part first. To fit addresses into the tree, reverse DNS flips them.
For IPv4, you reverse the order of the four numbers and append in-addr.arpa. The address 192.0.2.25 becomes the name 25.2.0.192.in-addr.arpa. A PTR record stored at that name points to a hostname:
25.2.0.192.in-addr.arpa. 3600 IN PTR mail.example.com. For IPv6, the same idea applies at a finer grain. You write out all 32 hexadecimal digits of the full address, reverse them one digit at a time, separate them with dots and append ip6.arpa. The address 2001:db8::1 expands to a long string of zeros, so its reverse name begins 1.0.0.0 and ends 8.b.d.0.1.0.0.2.ip6.arpa. Nobody types these by hand. Tools build them for you. If the long and short forms of IPv6 addresses are unfamiliar, see how to read and shorten an IPv6 address.
Who controls the reverse zone
Authority over reverse DNS follows address allocation. Address blocks flow from the global pool to regional internet registries, then to providers and large organizations, and the reverse zones are delegated along the same path.
In practice, this gives you a few situations:
- Cloud or hosting server: the provider often gives you a field in its dashboard labeled something like "reverse DNS" or "PTR". Some require that the forward record already points at the address.
- Business internet line with static addresses: you typically ask the provider's support team to set the name.
- Home broadband: the provider assigns a generic name that often encodes the address, and you usually can't change it.
- Your own address block: the registry delegates the reverse zone to your name servers, and you manage PTR records yourself.
Reverse zones are delegated with NS records like any other zone. If you want the background on that mechanism, read about NS and SOA records.
Blocks smaller than 256 addresses
IPv4 reverse delegation falls naturally on the dots, which correspond to blocks of 256 addresses or larger. A provider that hands a customer only 8 or 32 addresses can't delegate on a dot boundary. RFC 2317 describes the usual workaround: the provider creates CNAME records for each address in the small block that point into a zone the customer controls. If you see a CNAME in the middle of a reverse lookup, this is probably why.
Why mail servers care
Reverse DNS matters most for email. Receiving servers see the IP address of whoever connects to them, and many check whether that address has a sensible name. Large mail providers commonly require a valid PTR record from senders, and servers that lack one are often rejected or scored as suspicious.
The stronger version of the check is called forward-confirmed reverse DNS. It goes in a loop: look up the PTR record for the connecting address, then look up the address records for the name you got back, and confirm that the original address is among them. Passing this shows that the person who controls the address block and the person who controls the domain are cooperating.
A related convention is that the name your mail server announces in its greeting should be a real hostname that resolves, ideally consistent with the PTR. Reverse DNS is only one signal among several. SPF, DKIM and DMARC do the heavier work of showing that a message is authorized by the domain it claims to come from.
Other places reverse DNS shows up
Traceroute output. The router names you see along a path come from PTR records. Network operators often put hints in them, such as an interface type or a city abbreviation. These can be useful, but they can also be stale after equipment is moved. The guide to using traceroute covers how to read them.
Logs and monitoring. Tools can translate addresses in logs into names. This makes reports easier to scan, but each lookup takes time, so busy servers usually log raw addresses and resolve them later.
Remote access services. Some server software performs a reverse lookup on incoming connections. When reverse DNS is broken or slow, you may see a long pause before a login prompt appears.
Internal networks. Private ranges such as 192.168.0.0/16 have reverse names too. If your office runs its own DNS, adding PTR records for printers and servers makes diagnostics far more readable. Without a local zone, those queries shouldn't be sent out to the public internet, and well-behaved resolvers answer them locally.
How to check a PTR record
The commands differ by system, but the idea is the same.
On Windows, in PowerShell or Command Prompt:
nslookup 192.0.2.25
Resolve-DnsName 192.0.2.25 On macOS or Linux with dig installed:
dig -x 192.0.2.25 +short
dig -x 2001:db8::1 The -x option builds the reversed name for you. Documentation addresses like the ones above won't return real names, so substitute your server's public address.
To run the forward-confirmed check yourself, take the name that comes back and query it:
dig mail.example.com A +short
dig mail.example.com AAAA +short The original address should appear in the results. If your server sends mail over both IPv4 and IPv6, check both, because a missing IPv6 PTR record is a common and easily overlooked cause of delivery trouble. For more options, see using nslookup and dig.
What can go wrong
No record at all. The lookup returns NXDOMAIN, meaning the name does not exist. Ask the address holder to create one.
A generic provider name. Something that looks like a string of numbers followed by a provider domain suggests a dynamic or consumer address. Many mail receivers treat these with suspicion. Sending mail through your provider's relay or a mail service is often easier than trying to change it.
A mismatch. The PTR names a host that resolves to a different address, usually after a server migration. Update both directions together.
Several PTR records on one address. DNS permits it, but software often reads only one, and the order isn't guaranteed. Choose one canonical name per address. A server hosting many websites doesn't need a PTR for each of them.
Caching. After a change, old answers linger until their time to live expires, as described in DNS caching and TTL.
How much to trust a reverse name
The holder of an address block can write any name into a PTR record, including a name in a domain they don't control. A lookup that returns a well-known company's hostname proves nothing until the forward lookup confirms it. Even a confirmed pair only tells you that the two sets of records agree. It says nothing about whether the machine is behaving well or who is using it right now.
Treat reverse DNS as a useful label. It helps you read logs, supports mail reputation and exposes sloppy configuration. Access decisions should rest on authentication, such as keys, certificates or passwords with a second factor.
Asking your provider for a change
When you can't edit the record yourself, a clear request saves a round of back-and-forth. Include the address, the hostname you want, and confirmation that the forward record already exists. A short message such as "Please set the PTR for 203.0.113.40 to mail.example.com, which already has an A record pointing to that address" gives the support team everything they need.
Create the forward record first and wait until it resolves from outside your network. After the provider confirms the change, query the reverse name yourself, then send a test message to a mailbox elsewhere and read the received headers. The first Received line added by the other side usually shows the name and address it saw.
Common questions
Do I need a PTR record for a website?
Usually not. Browsers connect by name and verify the site with its certificate. PTR records matter mainly for servers that send mail or run services whose peers check reverse DNS.
Can one address serve many domains and still send mail?
Yes. Give the address one PTR name that identifies the server, and make sure that name resolves back. Each hosted domain then uses its own SPF, DKIM and DMARC records to authorize the mail.