NewHalo Edge 3 is here: HTTP/3 everywhere and 42 edge locations.Learn more
Docs / Domains and DNS

Configure reverse DNS (PTR)

Domains and DNS5 min readUbuntu 24.04 LTS

Reverse DNS, also called a PTR record, maps your server's IP address back to a hostname. Mail servers and many other services check this record, so setting it correctly makes your server easier to identify and trust.

Before you begin

  • A LightServe VPS with a static IPv4 address. This guide uses 203.0.113.10 as an example.
  • A hostname you control, such as mail.example.com, that you can point at the server.
  • SSH access as a sudo user, such as deploy.

Step 1: Choose a hostname

The reverse record must point to a name that resolves forward to the same IP address. Pick a name that describes the server, such as mail.example.com or vps1.example.com. Avoid generic names like server.

Step 2: Create a forward A record first

In the Lantern DNS editor, add an A record that points your chosen name at the server. This is the forward record. Many services ignore a reverse record that does not match a forward record.

mail.example.com.   300   IN   A   203.0.113.10

Step 3: Confirm the forward record resolves

Ask DNS for the A record. dig is a DNS query tool. The +short option prints only the answer. If dig is missing, install it with sudo apt install -y dnsutils.

dig +short A mail.example.com
203.0.113.10

Step 4: Set the server's own hostname

Set the operating system hostname so it matches. hostnamectl manages the system name. The second command adds a line to /etc/hosts, a local lookup file, so the server can resolve its own name without DNS.

sudo hostnamectl set-hostname mail.example.com
sudo nano /etc/hosts

Make sure /etc/hosts contains a line like this one, then save with Ctrl+O and exit with Ctrl+X:

203.0.113.10   mail.example.com mail

Check the result with hostnamectl status. The "Static hostname" line should show your new name.

Step 5: Ask LightServe to set the PTR record

Reverse DNS for an IP address is controlled by the network that owns that address, not by your own DNS zone. Contact LightServe support via chat or email and ask them to set the reverse DNS for your IP. Include both the IP address and the exact hostname, for example: "Please set the reverse DNS for 203.0.113.10 to mail.example.com."

Step 6: Verify the reverse record

Once support confirms the change, ask DNS for the name behind your IP. The -x option performs a reverse lookup.

dig -x 203.0.113.10 +short
mail.example.com.

You can also run host 203.0.113.10 for a similar answer. The trailing dot after the name is normal in DNS output.

Tip: Reverse records can take some time to appear because resolvers cache answers. If the answer is still old after an hour, query again before contacting support.

Troubleshooting

  • The lookup returns nothing or the old name. Wait and query again. If it still fails after a few hours, send support the IP and the requested name.
  • The names do not match. The PTR name and the forward A record must agree. Fix whichever one is wrong, then test both again.
  • dig: command not found. Install the tools with sudo apt update and sudo apt install -y dnsutils.
  • Mail is still flagged after the change. A reverse record is one signal among several. Mail services also check other DNS records, such as SPF and DKIM, so review those too.

Next steps

Learn how to read DNS answers in detail in Troubleshoot DNS with dig. If you plan to move your site or mail to this server, Lower your TTL before a migration explains how to make DNS changes take effect quickly.

Something not working? Chat or email our support team and we will help you get unstuck.

Contact support