Reverse DNS for a VPS
Level 4 · The network around the server
What reverse DNS is, and why mail servers check it before they trust your email. How to set the PTR record for your VPS in the host's panel.
Course contentsLesson 7 of 7
Level 1 · Choosing the hosting
Level 2 · Plans and the shared machine
Level 3 · First boot and the way back in
Level 4 · The network around the server
After this lesson you can
- Tell forward DNS from reverse DNS
- Set a PTR record in the host's panel
- Check reverse DNS with dig -x
10 mincovers 2 glossary entries
Worth reading first: Cloud Firewall and Floating IP
Why your mail needs a name for your address
Reverse DNS turns an IP address back into a name. Normal DNS goes from a name, such as mail.jack.example, to an address, such as 203.0.113.10. Reverse DNS goes the other way. The record that holds it is called a PTR record, and only the owner of the address can set it.
On a VPS, the host owns the address and lends it to you. So the PTR record is set in the host's panel, not where you keep your other DNS records. Most hosts give each server a default name, which looks like a long string of numbers and the host's own domain.
Mail is the main reason it matters. When your server sends an email, the server that receives it looks up your address backwards. If there is no name, or the name looks like a default, it may reject the mail or file it as spam.
The check goes further than that. The receiving server takes the name from the PTR record and looks it up forward. If that name points back to the same address, the two agree. That match is a sign of a real sender.
So setting it up is two steps. Give your server a name, such as mail.jack.example, with a normal A record. Then set the PTR record for its address to that same name in the host's panel.
For a website alone, reverse DNS hardly matters. Browsers never check it. It matters for any server that sends mail, and it makes logs easier to read, because addresses show up as names.
A common mistake is to set the PTR record to a name that does not point back. The two lookups then disagree, and mail is still marked as spam. Check both ways with dig before you send the first email.
$ dig -x 203.0.113.10 +short
mail.jack.example.
$ dig mail.jack.example +short
203.0.113.10Worked example
Jack's mail lands in spam
Jack's server sends order emails, and 40 percent land in customers' spam folders. dig -x shows his address still has the host's default name.
He sets the PTR record to mail.jack.example. That name already points at the server. A day later, his test emails reach the inbox.
The words for this lesson2
Check yourself
Where do you set the PTR record for your VPS address?
Finished this lesson?
Marking it complete also marks its 2 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.