CentOS - Email - Preparing the Slice

Beginning a series of articles on many aspects of email (sending, receiving, configuring, etc), we need to start with the very basics by preparing the Slice.

This article looks at the hostname and reverse DNS (RDNS) settings on the Slice.


Assumptions

The only assumptions made for these email articles are:

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

2: You have followed the setup articles: page 1 and page 2

Beyond that, I hope to show everything that is needed from the very basics upwards.

Hostname

The first thing to look at is the Slice hostname.

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

There are a couple of ways of setting the host name.

Slicemanager

When you build a new Slice or rebuild a Slice, you are given the opportunity to set the Slice name - this can be a FQDN (Fully Qualified Domain Name). This name is then used to set the hostname when the Slice is built.

This can be a quick and easy way of setting the hostname.

However, you do not have to restrict your Slice name to match that of the hostname.

On the demo account I have a Slice named 'slice1'. As such, the hostname of the Slice was initially set as 'slice1'.

I don't want to rebuild the Slice and I am happy with the Slicemanager name of 'slice1'. As such, let's look at changing the hostname from the command line:

Command Line

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 Slice, the output is:

slice1

Well, that makes sense. When I built the Slice, I named it 'slice1' in the Slicemanager. As such, the hostname was set to 'slice1'.

mail.demoslice.com

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

We need to change the hostname to match the domain:

sudo nano /etc/sysconfig/network

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

NETWORKING=yes
HOSTNAME=mail.demoslice.com
GATEWAY=123.456.78.90

The second file to edit is:

sudo nano /etc/hosts

The default looks like this on my Slice:

127.0.0.1       localhost localhost.localdomain
127.0.0.1       slice1

Following on from what we are doing, replace 'slice1' with 'mail.demoslice.com'.

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

Reboot

Conduct a quick reboot:

sudo reboot

and check the hostname:

hostname -f

The output is now:

mail.demoslice.com

Good start!

Reverse DNS

The second main aspect we need to look at when preparing the Slice is the Reverse DNS (RDNS).

One of the main reasons for email being marked as spam and causing IP addresses to be blacklisted is a mismatch between the sending domain and the RDNS of the Slice.

We can check the RDNS of the Slice from the Slicemanager.

Log into the Slicemanager

Once done, click the DNS tab and then the 'Reverse DNS' link.

On the demo account, one of the Slices has this record as the default:

Slicemanager - Reverse DNS

All we need to do is change the default entry to match our main domain:

Slicemanager - Changing the RDNS

Done.

Check the RDNS

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 Slice into the 'dig' command.

Note that 'dig' is not installed on a base CentOS:

sudo yum install bind-utils

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.demoslice.com.

Done.

Summary

Preparing the Slice 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.

As the articles progress you will start to see where this preparation comes into play when sending and receiving emails.

Article Comments:

Email Servers commented Tue May 04 19:16:06 UTC 2010:

Excellent step by step tutorial. I hope many people must be referring your articles to setup their initial servers. ATB

nabugoma commented Mon Aug 22 13:51:56 UTC 2011:

thanks alot. its indeed a kool tutorial..

Delhi Discounts commented Fri Oct 12 08:31:21 UTC 2012:

Thanks a lot we have been using your articles for setting up our servers.

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)