How to Fix Postfix Reverse DNS (rDNS) Failure
In this tutorial, you'll learn about How to Fix Postfix Reverse DNS (rDNS) Failure. We cover key concepts, practical examples, and best practices.
Postfix rejects incoming connections or outgoing mail is deferred because the sending server's reverse DNS (PTR record) does not match its HELO hostname — the PTR record is missing or points to the wrong domain.
The Problem
warning: hostname mx.other.com does not resolve to address 10.0.0.1: Name or service not known
connect from mx.other.com[10.0.0.1]: EHLO mail.other.com
reject: HELO/EHLO hostname mismatch
Step-by-Step Fix
Step 1: Check current PTR record
dig -x 192.0.2.1
host 192.0.2.1
Step 2: Set the HELO hostname
# /etc/postfix/main.cf
myhostname = mail.example.com
smtp_helo_name = $myhostname
Step 3: Configure Postfix rDNS checking
# /etc/postfix/main.cf
# Reject if no PTR record
smtpd_recipient_restrictions =
permit_mynetworks
reject_unknown_reverse_client_hostname
reject_unknown_client_hostname
permit
# Reject if HELO doesn't match forward-confirmed rDNS
smtpd_helo_required = yes
smtpd_helo_restrictions =
reject_invalid_helo_hostname
reject_non_fqdn_helo_hostname
check_helo_access hash:/etc/postfix/helo_access
Step 4: Create HELO whitelist
# /etc/postfix/helo_access
mail.example.com OK
mail.trusted.com OK
sudo postmap /etc/postfix/helo_access
Step 5: Request PTR record from ISP
# Contact your ISP or hosting provider to set:
# 192.0.2.1 PTR mail.example.com
Step 6: Test rDNS
host 192.0.2.1
# Should return: 1.2.0.192.in-addr.arpa domain name pointer mail.example.com
Prevention Tips
- Always ensure PTR records match the HELO hostname
- Set up FCrDNS (Forward Confirmed rDNS) for each mail server
- Monitor rDNS compliance with email testing tools
- Use a HELO hostname that matches the PTR record exactly
Common Mistakes with rdns fail
- Mixing let bindings with <- bindings in do notation, producing type errors
- Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
- Non-exhaustive pattern matches that compile with warnings then crash at runtime
These mistakes appear frequently in real-world POSTFIX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro