skip to content

Why does RFC 7208 say the SPF ptr mechanism SHOULD NOT be published, and what replaces it in an existing record?

level: middleimportance: should knowfreq 22%

answer

  1. reverse name, then forward check
  2. slow and fragile on DNS errors
  3. load on the .arpa servers
  4. someone else's reverse zone
  5. list the addresses instead

basics

~20 s

RFC 7208 says SPF's ptr SHOULD NOT be published: it is slow, less reliable under DNS errors and burdens the reverse-DNS servers, though checkers must still support it. Replace it with ip4, ip6 or a terms for the hosts it covered.

solid answer

~50 s

`ptr` looks up the client address's reverse name, confirms each name by resolving it forward to the same address, and matches if a confirmed name equals the target domain or sits under it. RFC 7208 (2014) marks it 'do not use': it SHOULD NOT be published because it is slow, less reliable than other mechanisms when DNS errors occur, and places a large burden on the `.arpa` name servers. The reverse records also belong to whoever holds the address space, not necessarily the domain owner, and a failed PTR lookup quietly makes the mechanism not match. Receivers MUST still support it, because old records use it. To retire it, find the hosts it was really covering and list them with `ip4`/`ip6`, or with `a` when their addresses change, then remove `ptr` and the `%{p}` macro.

go deeper

for a junior

Recall that ptr checks the client's reverse DNS name and that RFC 7208 says it should not be published.

for a middle

Explain the reverse-then-forward procedure, the subdomain match, and the three reasons the RFC gives against publishing it.

for a senior

Plan the removal from a live record: inventory what ptr was matching, list those hosts explicitly, and watch results before tightening.

for a principal

Make retiring ptr part of a standing record review, and avoid any design whose correctness depends on reverse zones your organisation does not run.

## What ptr tests `ptr` asks whether the client's **reverse DNS name** lies within a domain (by default the domain being checked, or `ptr:example.org`). RFC 7208 section 5.5 defines the procedure: 1. Look up the PTR records for the client address, in `in-addr.arpa.` for IPv4 or `ip6.arpa.` for IPv6. 2. For each name returned, look up that name's addresses. A name is **validated** only if the client address is among them; this forward confirmation means a reverse record on its own proves nothing. 3. The mechanism matches if a validated name **is** the target domain or is a **subdomain** of it. `mail.example.com` is within `example.com`; `mail.bad-example.com` is not. Error handling is unusual. If the PTR lookup itself fails with a DNS error, the mechanism simply **does not match**. If a forward lookup for one of the names fails, that name is skipped. Most other mechanisms instead stop the whole evaluation with `temperror` on a server error. A worked case: a printer sends from 198.51.100.41, whose PTR record names `printer-41.office.example.com`. That name resolves forward to 198.51.100.41, so it is validated, and as a subdomain of `example.com` it matches `ptr`. If the carrier holding the office's address block later replaces its reverse names with its own generic naming, nothing in `example.com`'s zone changes, yet the printer stops matching and its mail falls through to the record's ending. ## Why RFC 7208 says SHOULD NOT publish The section heading reads `"ptr" (do not use)`, and the text says the mechanism **SHOULD NOT be published**. The note that closes the section gives three reasons: - it is **slow**: each check needs a reverse query plus a forward query per returned name; - it is **not as reliable** as other mechanisms when DNS errors occur; - it places a **large burden on the `.arpa` name servers**, which every receiver's check would hit. It adds that, after many years of deployment experience, the mechanism was judged **unnecessary**, and that more reliable alternatives should be used. Appendix B, which lists what changed from RFC 4408, says use of `ptr` and the `%{p}` macro has been strongly discouraged and that records ought to be updated to avoid them. One structural point sits behind the reliability concern. Section 4.6.4 notes that PTR records are controlled by the **owner of the connecting IP address**, not by the publishing domain. A hosting provider or carrier holds the reverse zone for most addresses, so the domain owner cannot always make the reverse names say what the record expects. ## What the deprecation is not about A frequent misreading is that `ptr` is deprecated because "anyone can publish a PTR claiming your domain". The forward confirmation in step 2 already defeats a reverse record whose name does not resolve back to the client address; RFC 7208's appendix example shows such a rogue PTR failing. The stated reasons are cost, reliability and load, not that the check accepts unverified claims. Equally, `ptr` was **not removed**. Section 5.5 says compliant checkers MUST still support it, so an old record using it keeps working, slowly and with the failure behaviour above. ## Replacing it in an existing record Suppose the company's old record authorised its printers and relay with `ptr`, relying on reverse names under `example.com`: ```dns ; before: depends on reverse names under example.com example.com. TXT "v=spf1 ptr ip4:192.0.2.25 ~all" ; after: the hosts ptr was standing in for, listed directly example.com. TXT "v=spf1 ip4:192.0.2.25 ip4:198.51.100.40/30 a:relay.example.com ~all" ``` A practical sequence: 1. **Find what `ptr` was matching.** Use the outbound gateway's logs and the inventory of hosts whose reverse names sit under the domain. 2. **Prefer literal addresses.** Fixed hosts become `ip4:` and `ip6:` terms; a host that is renumbered often becomes `a:` its name. 3. **Check whether a term is needed at all.** Devices that relay through the gateway are covered by the gateway's address. 4. **Publish, watch, then tighten.** Confirm nothing that should pass now falls to the record's ending before treating the change as finished. 5. **Remove `%{p}` too.** The macro that expands to the validated reverse name carries the same SHOULD NOT. Each `ptr` also spends the record's DNS lookup budget; that accounting belongs with the lookup limit.

  • If a PTR record names mail.example.com for an address that example.com does not use, does ptr:example.com match?
    Only if `mail.example.com` resolves forward to that same address. RFC 7208 section 5.5 validates each reverse name by looking up its addresses; a name that does not lead back to the client is discarded, so a reverse record on its own does not satisfy `ptr`.
  • What happens to an SPF check using ptr when the reverse zone's servers are failing?
    The PTR lookup error makes `ptr` not match, and evaluation continues to the next term, so hosts that relied on it fall through to the record's ending. Unlike most mechanisms, a DNS error here does not stop the check with `temperror`, which is one reason the RFC calls `ptr` less reliable.

  • ptr is deprecated because SPF accepts any PTR record without checking it.
  • RFC 7208 removed ptr, so receivers return permerror when they meet it.
  • ptr cannot match IPv6 clients.
  • Replacing ptr with mx is the like-for-like fix.
  • A DNS error during the PTR lookup stops the check with temperror.