reversedns
Compare the server's hostname with the reverse DNS (PTR) record of its public IPv4 address and report whether they match
- Command:
/go/reversedns - Category: DNS
- Required option: None
- Output: Plain text
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
Reverse DNS (rDNS) is the opposite of a normal DNS lookup: it finds the name that belongs to an IP address, using a PTR record. Mail servers check it. If the PTR record of the IP that sends your mail doesn't match your server's hostname, many providers treat the mail as spam or reject it.
/go/reversedns checks this for you. It:
- reads the server's hostname from
/etc/hostname - finds the server's public IPv4 address from the internet
- looks up the PTR record of that address
- tells you whether the two names are the same
The command only reports. It changes nothing. The PTR record is set by whoever owns the IP address (usually your hosting provider), not on this server. See Fixing a mismatch.
Quick start
/go/reversedns
Syntax
/go/reversedns
| Form | Behavior |
|---|---|
/go/reversedns |
Compares the hostname with the PTR record and prints the result. |
Options
This command has no options. Arguments are only written to the log file.
Output
| Outcome | What you get |
|---|---|
| Match | One line: Reverse DNS: <name> |
| Mismatch | Three lines: Hostname: <hostname>, Reverse DNS: <name>, and Reverse DNS Mismatch. |
Example of a match:
Reverse DNS: server.example.com
Example of a mismatch:
Hostname: server.example.com
Reverse DNS: static.203-0-113-10.provider.net
Reverse DNS Mismatch.
If the IP address has no PTR record at all, the name is replaced by an odd value, 3(NXDOMAIN, which means "not found":
Hostname: server.example.com
Reverse DNS: 3(NXDOMAIN
Reverse DNS Mismatch.
[!NOTE] The command ends with exit status
0whether the names match or not. In scripts, read the output (look forReverse DNS Mismatch.) instead of relying on the exit status.
Every run is also recorded in /var/log/go/reversedns.log.
Examples
# Check the reverse DNS of this server
/go/reversedns
# Check by hand: the PTR record of an IP address
host 203.0.113.10
# Check by hand: the address that a name points to
host server.example.com
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Reverse DNS: 3(NXDOMAIN |
The IP address has no PTR record. | Ask your hosting provider to set one (see Fixing a mismatch). |
| The reverse name is a generic provider name | The provider's default PTR record is still in place. | Set the PTR record to your server's hostname. |
| Mismatch right after you changed the record | The old answer is cached until its TTL expires. | Wait, then run the command again. |
| The two names look the same but a mismatch is reported | The comparison is exact and case-sensitive, or there are several PTR records and all of them are compared as one text. | Compare the output of host <ip> with the hostname exactly. Keep one PTR record, in lowercase. |
| The IP address is not the one you expect | The address comes from an internet lookup, so a server behind NAT or a proxy shows the public address, not the server's own. | Check the correct address with host, or fix the network setup. |
| Strange text instead of a name, or usage messages | The internet lookup of the IP address failed, or the host tool is missing. |
Check the server's internet access, and install host (from the bind-utils or dnsutils package). |
| The command is slow | The lookups have no time limit. | Check the server's internet access and DNS resolver. See resolver. |
| Names match, but mail is still rejected | Other checks fail: the hostname's own DNS record, SPF, DKIM, or DMARC. | See troubleshoot and checkdkim. |
Details
How it works
- Writes the command and its arguments to
/var/log/go/reversedns.log. - Reads the hostname from
/etc/hostname. - Asks
checkip.amazonaws.comfor the server's public IPv4 address. - Runs
host <ip>, and takes the name afterdomain name pointer, without its trailing dot. - Compares that name with the hostname, exactly. If they are equal, it prints one line. Otherwise it prints both names and the mismatch message.
Fixing a mismatch
The PTR record belongs to the owner of the IP address, so you set it outside the server:
- Choose the name that mail should come from, normally the server's hostname (for example
server.example.com). - In your hosting provider's control panel (or by asking their support), set the reverse DNS of the server's IP address to that name.
- Wait for the change to spread, then run
/go/reversednsagain.
If the hostname itself is wrong, change it with hostname instead.
What it does not check
- That the hostname's own DNS record (A record) points back to the same IP address. This is the other half of a correct setup.
- IPv6. Only the public IPv4 address is checked.
- Any other IP address of the server. Only the one the internet lookup reports is checked.
See also
| Command | Description |
|---|---|
hostname |
Change the server hostname and set up GoAdmio, mail, and SSL for it |
checkimap |
Check the IMAP hostname, its DNS record, and the SSL certificate on port 993, repair the mail SSL setup when the certificate is missing, and alert the administrator about hostname and DNS problems |
checkmail |
Test whether outbound mail port 25 works from this server, and whether the SMTP (465) and IMAP (993) SSL certificates are installed. This command also opens the local firewall. |
troubleshoot |
Troubleshoot email problems in GoAdmio |
checkdkim |
Check whether each domain's DKIM DNS record exists and matches the DKIM key on this server |
resolver |
Change the DNS resolver in GoAdmio |