Articles

How to Set 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 the PTR Record on DigitalOcean

DigitalOcean will set a PTR record for your server as long as you use a fully qualified domain name (FQDN) like pluto.example.com rather than a single-label hostname like pluto.

Oftentimes, these server names are unique and aren't associated with any sites on the server. Many companies use naming schemes, such as naming each server after fruits, planets, etc.; for example,

  • jupiter.example.com
  • pluto.example.com
  • earth.example.com

You can find examples of other naming schemes at https://namingschemes.com.

If you gave your server a single-label hostname in DigitalOcean, you can easily change it by logging in to DigitalOcean and following these steps:

  1. Select the server you need to rename from your list of Droplets.
  2. Click on your Droplet's name at the top of the screen. It will change to a fillable field.
  3. Enter your new hostname following the guidelines above and click the blue check mark.

Once you have changed your server's name on DigitalOcean, DigitalOcean will automatically update the PTR record for your server's IP address. You do not need to contact DigitalOcean to do this.

You do not need to make any additional changes to your server.