What is Hostname ?
Hostname is use as an identifier to recognize your server in a local network. Many applications will use the system hostname as a default identifier when they communicate elsewhere. For example, if you’re collecting syslog messages at a central server, the messages will all be tagged with the hostname of the originating system. That is, if you named all your systems as “localhost”, then it would result in a bunch of log messages that you wouldn’t be able to associate with a specific system.
You can issues following command to check your servers’ current hostname:
hostname

What is FQDN ?
A fully qualified domain name (FQDN) is the complete domain name for a specific computer, or host, on the internet. The FQDN consists of two parts: the hostname and the domain name. For example, the FQDN of my test server is server.torrentzu.tk. The hostname is server, and the host is located within the domain torrentzu.tk.
When connecting to a host/server (using an SSH client like PuTTY), you must specify the FQDN. The DNS server then resolves the hostname to its IP address by looking at its DNS table.
You can issue following command to check your servers’ current FQDN:
hostname --fqdn

Change Servers’ Hostname
Follow these steps orderly to change your server Hostname.
1) Issue following command to edit /etc/hostname using nano editor:
sudo nano /etc/hostname
Then replace the previous hostname with new one.
2) Next Edit the /etc/hosts file:
sudo nano /etc/hosts
Replace all the occurrence of the previous hostname with new one.
3) Finally, reboot the server to make changes take effect:
sudo reboot
What is Reverse DNS (rDNS) and PTR Record ?
Normally domain names are resolve to IP addresses by DNS, because it is easy to remember a domain name to access a web-service rather than remembering an IP Address. This resolution is known as forward resolution. It takes place every time when you visit a website with the help of DNS servers.
On the other hand, Reverse DNS (rDNS) is a method of resolving an IP Address to a domain name. The DNS records used for resolving an IP address to the domain name are known as pointer (PTR) records.
Email Servers commonly use rDNS to block incoming SPAM messages. Many mail servers are set to automatically reject messages from an IP address that does not have rDNS in place. Therefore it is essential to have a properly configured rDNS / PTR record, for your server send emails being not identified as SPAMS by other mail clients.
Note: Though the rDNS record can block spam; it is not a reliable means, but it adds an extra layer of protection.
Some other reasons that may cause for your server send emails to be treated as SPAM:
- The IP address of sending mail server is blacklisted.
You can check your server IP address for blacklist by using this tool: Click here. - The SPF record of the domain you are using to send emails is missing or not properly configured.
See my previous tutorial on “Configure SPF Record for your Domain”. - DomainKeys Identified Mail (DKIM) is not available or not properly configured for relevant domains that used to send emails.
See my tutorial on “Install and Configure DKIM for your Domains“.
rDNS Lookup
You can check the domain name to which your servers’ IP address is resolving by using Reverse Lookup Tool provided by MXToolBox.
How to Setup rDNS / PTR Record ?
For DigitalOcean Droplets:
DigitalOcean provides an easy way to setup rDNS for your Droplets. You just have to change the Droplet name via the DigitalOcean dashboard to the relevant domain/sub-domain name to which you Droplets’ IP address should resolve. Note that, it is better to use a FQDN (Fully Qualified Domain Name) as the Droplet name.

For other VPS providers:
You have to contact the Customer Support or make some searchers in forums of those VPS providers to find the procedure to change the rDNS record of your server.
After changing the rDNS / PTR record, you can use rDNS Lookup to check whether your changes have take effect.