• Sales: 1-800-961-2888
  • Support: 1-800-961-4454

Preparing the Cloud Server to be a Mail Server


It is vital the Cloud Server has the basics such as the hostname and Reverse DNS correctly set before we configure any sort of mail service. This article looks at the hostname and reverse DNS (RDNS) settings on the Cloud Server.

Contents

//

Assumptions

The only assumptions made for these email articles are:

1: You are running Ubuntu Hardy (The instructions may work on other distros but it has not been tested and is not guaranteed)

2: You have followed the setup article: Ubuntu Hardy - Setup

Hostname

The first thing to look at is the Cloud Server hostname.

This is simply the 'name' of the Cloud Server and is used in the headers of the email (the headers can be thought of as the address and sender label on the email).

Setting the hostname via the command line involves the very simple adjustment of a couple of files.

We can start by checking what the current hostname is:

hostname -f

On my Cloud Server, the output is:

cloudserver1

For these basic articles I am going to use the domain 'mail.democloud.com' - I am setting up a mail server so that makes sense.

I need to change the hostname to match the domain:

sudo nano /etc/hostname

Replace the current hostname (cloudserver1) with the one you need (in this case mail.democloud.com).

The second file to edit is:

sudo nano /etc/hosts

The default looks like this on my Cloudserver:

127.0.0.1       localhost localhost.localdomain
127.0.0.1       cloudserver1

Following on from what we are doing, replace 'cloudserver1' with 'mail.democloud.com'.

Of course, replace mail.democloud.com with your domain.

Reboot

Conduct a quick reboot:

sudo shutdown -r now

and check the hostname:

hostname -f

The output is now:

mail.democloud.com

Good start!

Reverse DNS

Now, we need to properly set the reverse DNS for the server.

Change Reverse DNS in the Control Panel

Navigate to your Server's DNS tab and scroll down to the Reverse DNS section. Change the relevant field to the domain name which you'd like in the rDNS record. (See DNS - Creating a Reverse DNS Record)

Check the Reverse DNS

The RDNS may take a while to propagate and you really need to wait until it has done so before you can fully configure and test any mail setup.

To check the RDNS, you need to input the IP address if the Cloud Server into the 'dig' command.

Note that 'dig' is not installed on a base Ubuntu Hardy Cloud Server:

sudo aptitude install dnsutils

So, to check the RDNS:

dig -x 208.75.84.20

In this case, the output includes the correct answer:

dig -x 208.75.84.20
...
...
;; QUESTION SECTION:
;20.84.75.208.in-addr.arpa.     IN      PTR

;; ANSWER SECTION:
20.84.75.208.in-addr.arpa. 3477 IN      PTR     mail.democloud.com.

Done.

Summary

Preparing the Cloud Server is a vital step in any mail setup - even if 'only' sending mail from your application to an administrator, it is very important to get the basics right.

To continue your setup, please go to Setting a Sender Policy Framework (SPF) record.



© 2011-2013 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


See license specifics and DISCLAIMER

5 Comments

If you check the man page for Ubuntu, You only enter the domain name in the /etc/hosts and /etc/hostname. It says specifically not to enter the FQDN in those files.


FILES
/etc/hosts /etc/hostname This file should only contain domain name and
not the full FQDN.

That's actually been my experience too, at least for the hostname, then setting the domain name in /etc/resolv.conf. I'll have a look at this article and update it with a more standard practice. Thanks for bringing this to our attention.

"Of course, replace mail.demoslice.com with your domain." should read "Of course, replace mail.democloud.com with your domain."

Thanks for that. Bit of a remnant there. Corrected the example name.

you may also need to change: /etc/sysconfig/network

Add new comment