Back to tutorials
Tutorial

rDNS setup guide tutorial (2026): Configure PTR records for VPS email, cPanel, and mail server reputation

rDNS setup guide tutorial for 2026: set PTR correctly, match HELO, and pass common email checks on a VPS.

By Anurag Singh
Updated on Jul 25, 2026
Category: Tutorial
Share article
rDNS setup guide tutorial (2026): Configure PTR records for VPS email, cPanel, and mail server reputation

Email deliverability often fails for unglamorous reasons. A missing or incorrect reverse DNS (PTR) sits near the top of the list. This rDNS setup guide tutorial shows how to set a PTR record on a VPS, match it to your hostname and SMTP banner, and verify it from the shell.

This is day-to-day hosting work. It applies to VPS mail stacks (Postfix/Exim), cPanel/WHM, Plesk, and “website-only” servers that send password resets or receipts.

If you’re moving mail to a new IP, treat PTR as part of the cutover checklist. Don’t treat it as an optional tweak.

What you’ll set up (and why PTR breaks mail)

Reverse DNS maps an IP address back to a hostname using a PTR record. Many receiving servers treat that mapping as a trust signal.

Some won’t hard-reject you for missing PTR. Many will still lower your score or route mail to spam.

  • Forward DNS (A record): mail.example.com203.0.113.10
  • Reverse DNS (PTR record): 203.0.113.10mail.example.com

PTR is controlled by whoever owns the IP block. That’s almost always your hosting provider.

Because of that, you set PTR in a VPS dashboard or via a support request. You do not set it by editing your domain’s DNS zone file.

rDNS setup guide tutorial prerequisites

Gather these values before you change anything. You’ll reuse them throughout, and they must stay consistent.

  • Your server public IPv4 (or IPv6) address
  • The intended mail hostname (recommended: mail.example.com)
  • A forward DNS A/AAAA record for that hostname pointing to the same IP
  • Your mail server’s HELO/EHLO name (should also be mail.example.com)

If this is a production mail server, don’t stop at PTR. Receivers also expect SPF, DKIM, and DMARC.

Relevant reading you can use alongside this tutorial: email authentication setup guide.

Step 1: Choose the right hostname (mail vs server hostname)

Two hostnames matter. They’re not always the same.

  • System hostname (your OS): often something like vps-123.hosting.example or server1.example.com
  • Mail identity hostname (SMTP): ideally mail.example.com

For most hosting setups, use a clean, predictable pattern:

  • Set PTR to mail.example.com
  • Point mail.example.com (A/AAAA) to the same IP
  • Configure your MTA to announce itself as mail.example.com

If you host multiple domains on one server, don’t try to “match PTR per domain.” One IP typically gets one PTR.

If you need separate outbound identities, use separate outbound IPs or send through a relay.

Step 2: Create the forward DNS record first (A/AAAA)

Create an A record for IPv4. If you send over IPv6, also create an AAAA record.

Example zone entries:

; example.com zone
mail    3600    IN  A       203.0.113.10
; optional IPv6
mail    3600    IN  AAAA    2001:db8:abcd::10

If your DNS is hosted elsewhere, add the record there. If you host DNS on the server (BIND/cPanel), add it in the panel.

Afterwards, confirm it’s publishing correctly.

Need a reliable delegation setup for hosting? This pairs well with cPanel nameserver setup.

Step 3: Set the PTR (reverse DNS) with your VPS provider

Since the IP owner controls PTR, you’ll usually set it in your hosting dashboard. On managed services, support can set it for you.

If you’re on a self-managed server and want predictable control, run mail and web workloads on a HostMyCode VPS where PTR updates are handled as standard admin work.

What to enter

  • IP address: 203.0.113.10
  • PTR target (hostname): mail.example.com

Rules that prevent most mistakes:

  • Use a fully-qualified domain name (FQDN). No trailing spaces, no odd punctuation.
  • Don’t point PTR to a hostname that doesn’t resolve forward to the same IP.
  • Skip bare domains like example.com. Use a specific host such as mail. or smtp.

Step 4: Set the server’s hostname to match (Ubuntu/Debian/Rocky)

You don’t have to match the system hostname to your mail identity. Matching often reduces confusing mismatches.

On cPanel/WHM, the hostname should be a stable FQDN you control.

Ubuntu/Debian

sudo hostnamectl set-hostname mail.example.com

Confirm:

hostnamectl
hostname -f

AlmaLinux/Rocky/CentOS Stream (systemd)

sudo hostnamectl set-hostname mail.example.com

Also make sure your hostname resolves locally. In many VPS builds, you’ll want an entry in /etc/hosts:

127.0.0.1   localhost
203.0.113.10 mail.example.com mail

Pitfall: don’t map the hostname to 127.0.1.1 and then chase “mystery” HELO values in logs. For mail servers, obvious beats clever.

Step 5: Align HELO/EHLO and SMTP banner (Postfix and Exim)

Receivers commonly compare these three items:

  • PTR hostname
  • HELO/EHLO hostname
  • Forward DNS for that hostname

Your goal is the same identity everywhere. In most cases, that’s mail.example.com.

Postfix (common on Ubuntu)

Edit /etc/postfix/main.cf:

myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain

Reload:

sudo postfix check
sudo systemctl reload postfix

Exim (common with cPanel)

On cPanel/WHM, Exim’s identity typically follows WHM settings and the system hostname. Set the hostname correctly in WHM, then let Exim inherit it.

If you’re tightening a WHM mail server, pair identity work with basic access controls. That includes 2FA, firewall rules, and locked-down admin entry points.

A good starting point is cPanel two-factor authentication setup.

Step 6: Verify rDNS from the command line

Run these checks from a machine that isn’t the mail server when you can. Use your laptop, a jump box, or another VPS.

This helps you avoid local caching and split-horizon DNS surprises.

Check the PTR record

dig -x 203.0.113.10 +short

Expected output:

mail.example.com.

Check forward DNS matches the IP

dig mail.example.com A +short

Expected:

203.0.113.10

Do a quick “forward-confirmed reverse DNS” check

PTR=$(dig -x 203.0.113.10 +short | sed 's/\.$//')
dig "$PTR" A +short

If the final command returns the same IP, you’ve met the basic FCrDNS expectation used by many filters.

Confirm the SMTP banner and EHLO

openssl s_client -starttls smtp -crlf -connect mail.example.com:587 -servername mail.example.com </dev/null 2>/dev/null | head -n 5

Then test an EHLO:

printf 'EHLO test.example\r\nQUIT\r\n' | nc -w 5 mail.example.com 25

You should see the server identify itself as mail.example.com.

Step 7: Add TLS so receiving servers trust the connection

PTR helps you pass the first reputation checks. TLS keeps SMTP sessions clean and reduces downgrade-related issues.

Even if you run Nginx/Apache on the same box, you can still issue a certificate for mail.example.com alongside your web hostnames.

Use the HostMyCode guide for a current 2026 workflow: TLS certificate deployment tutorial.

Step 8: Checklist for cPanel/WHM servers (common gotchas)

cPanel adds a few hosting-specific wrinkles. Catch them early.

  • Hostname must be an FQDN you control (and it must resolve). Example: server1.example.com or mail.example.com.
  • PTR should match the chosen hostname, and the hostname must resolve back to the server IP.
  • AutoSSL is separate from mail TLS. Ensure Exim/Dovecot also have valid certs, not only your website vhosts.
  • One PTR per IP. If you run multiple outbound IPs, set PTR per IP and bind mail sending properly.

If you’re planning a cPanel move, lock in PTR/hostname early. That avoids the deliverability wobble you often see right after cutover.

This pairs well with a structured migration plan such as web hosting migration tutorial.

Troubleshooting: common PTR failures and fixes

These issues show up often in real VPS mail stacks and hosting panels.

PTR exists, but forward DNS doesn’t match

  • Symptom: dig -x returns mail.example.com, but dig mail.example.com A returns a different IP.
  • Fix: update the A record to the correct IP, or update PTR to match the existing A record. Don’t leave them inconsistent.

PTR points to a hostname without an A record

  • Symptom: Some receivers reject with “reverse DNS missing” even though you set it.
  • Fix: create the A record for the PTR target. Reverse-only doesn’t satisfy most checks.

HELO is still the provider default

  • Symptom: logs show EHLO like localhost or vps-123.provider.tld.
  • Fix: set myhostname in Postfix, or fix the system hostname for cPanel/Exim. Restart/reload the MTA.

Multiple IPs and the “wrong PTR” problem

  • Symptom: outbound mail sometimes uses a secondary IP with no PTR.
  • Fix: either set PTR on every sending IP, or force your MTA to send from the intended interface/IP.

IPv6 surprises

  • Symptom: mail uses IPv6, but your IPv6 address has no PTR or points elsewhere.
  • Fix: set IPv6 PTR too, or disable IPv6 for SMTP until you can configure it properly.

Operational checklist: what to confirm before you declare “deliverability fixed”

  • PTR set to mail.example.com
  • mail.example.com A/AAAA resolves to the same IP
  • SMTP banner and EHLO show mail.example.com
  • TLS certificate valid on SMTP submission (587) and/or SMTPS (465) where used
  • SPF includes the sending IP, DKIM signs, DMARC policy publishes

If you send customer email (reseller hosting, WooCommerce receipts, password resets), put this into a runbook. Treat it like backups: documented, tested, and repeatable.

If you want PTR control and a predictable mail identity from day one, run your mail and sites on managed VPS hosting or a standard HostMyCode VPS. HostMyCode keeps the workflow straightforward: stable networking, clean reverse DNS requests, and hosting-friendly Linux builds.

FAQ

How long does a PTR change take to propagate?

It depends on the IP owner’s DNS and caching. Most PTR updates show up within minutes to a few hours. Confirm with dig -x from an external network.

Can I set PTR in Cloudflare or my domain DNS provider?

No. PTR records live in the IP owner’s reverse DNS zone. You control A/AAAA in your domain DNS; your hosting provider controls PTR for the IP.

Should PTR match my website domain or a mail subdomain?

Use a dedicated host like mail.example.com. It keeps SMTP identity obvious and prevents headaches if you move the website later.

Do I need a PTR record if I only send a small amount of email?

Yes. Low volume won’t bypass basic reputation checks. PTR plus SPF/DKIM/DMARC is the baseline for transactional email from a VPS in 2026.

What if I’m on shared hosting?

Shared hosting providers manage PTR for their mail IPs. If you need a dedicated sending identity (and dedicated PTR), move outbound email to a VPS or use an SMTP relay service. If you’re migrating, HostMyCode can help via migrations.

Summary: a clean PTR setup you can defend in audits and support tickets

Pick one stable mail hostname. Publish forward DNS. Then set PTR to match that same name and IP.

Align HELO and the SMTP banner, verify with dig, and add TLS plus authentication records. That removes the easy reasons receivers distrust your mail.

If you’re building on a new server, start with a HostMyCode VPS. It lets you control reverse DNS and mail identity without workarounds.

If your team prefers fewer moving parts, managed VPS hosting gets you to a correctly configured production setup faster.