How to setup a backup mail server

Contributed by:

based on contribution by Martin Elhøj

Created/Updated: februar 09, 2004

 


This Howto describes how you can setup a backup mail server that can spool your email when/if your server is down.

 

Configuration related to main mail server

 

First you need to change your DNS configuration for the main mail server. Please be aware that this is not on the SME box but on your DNS provider such as DynDNS or, GratisDNS.

 

Add a new MX record with a higher preference number that you main mail server with the name of your backup mail server.

 

MX (@host -> A record mailserver)
Host Mail Exchange Preference TTL
swerts-knudsen.com swerts-knudsen.com 10 43200
swerts-knudsen.com backup-mail-server.com 15 43200

 

 

Configuration related to backup mail server

 

First you need to inform allow SMTP request from the main domain to be relayed/spooled on the backup server. This is done by adding domain entries on the rcpthosts file. You need to add the portion of the mail address with comes after the "@". In my case this is "swerts-knudsen.dk" and "swerts-knudsen.com". This naturally has to done by use of templates.

 

 

[root@e-smith]# mkdir -p /etc/e-smith/templates-custom/var/qmail/control/rcpthosts

[root@e-smith]# cd /etc/e-smith/templates-custom/var/qmail/control/rcpthosts

[root@e-smith]# echo "domain_name.com" > domain_name

[root@e-smith]# /sbin/e-smith/expand-template /var/qmail/control/rcpthosts

 

Please be careful with this file - it controls the relay functions. If it is mis-configurred your SMTP server could be used for spamming.

Now as the last thing you need to restart qmail.

[root@e-smith]# /etc/rc.d/init.d/smtpfront-qmail restart

 

Then you should be done. If you want to check whether it actually works you can temporarily close down qmail and monitor the qmail log file on the backup-mail-server. 

 

Issue this command on the main mail server.

[root@e-smith]# /etc/rc.d/init.d/smtpfront-qmail stop

 

Send an email to an existing address in your domain and then check the following log file for new entries on both servers:

 

[root@e-smith]# tail -f /var/log/qmail/current

 

When you see everything is being queued on the backup-mai-server then restart qmail on the main mail server again by doing:

[root@e-smith]# /etc/rc.d/init.d/smtpfront-qmail start