PTR records and reverse DNS
DNS is normally used to point a domain name to an IP address. For
example, you would use an A record to say the domain example.com
points to the address 1.2.3.4
. However, DNS can also work the opposite
way: to say an IP address points to a specific domain name. This is
known as reverse DNS and uses a special DNS called a PTR record.
There is one primary use for reverse DNS: when receiving mail, some mail servers verify the sending mail server has a PTR record configured for its address. This is a very simple check and is only used to ensure a PTR record exists and that the PTR record doesn’t specify the name of a consumer internet service provider (ISP). Years ago, this check was a popular way to prevent spam from being sent from people’s homes. Though most home ISPs now block outgoing SMTP so home computers can’t send spam, a few mail servers still perform this reverse DNS check.
The PTR record for your server’s IP address is controlled by the server provider, and you should contact your server provider to set the PTR record. The name used in the PTR doesn’t need to be and generally isn’t associated with any domains on the server. You do not need to change your server’s hostname to match the PTR record. When you change your PTR record, there are no changes you should make to your server.
Setting a PTR record on DigitalOcean
DigitalOcean will set a PTR record for your server as long as you use a
fully qualified domain name (FQDN) such as prod.example.com
rather than
a single-label hostname such as prod
.
If you gave your server a single-label hostname in DigitalOcean, you can change it by logging in to DigitalOcean and following these steps:
- In the DigitalOcean dashboard, go to the Droplets page.
- Click on the name of the server.
- Click on your server’s name at the top of the screen. It will change to an editable field.
- Enter your new hostname.
- Click the blue check mark or press the Enter key.
DigitalOcean will automatically update the PTR record for your server’s IP address.