Thursday, April 5, 2012

HOWTO qmail Store and Forward Backup Mailserver (backup MX)


 


This quick guide will explain how to setup qmail as a backup (store & forward) mailserver for a specific domain. 

In the instance of the primary mailserver going down, the source mailserver should failover to your next MX record, depending on it's priority. 

In this case, the next MX record will be this mailserver that we are configuring.
The backup mailserver will then store the mail received and will attempt to forward it on to the primary mailserver until it is accepting mail again..

First, we need to tell the backup mailserver to accept mail for the domain we are adding. We add this domain to /var/qmail/control/rcpthosts:
# vim /var/qmail/control/rcpthosts

Next, we need to tell qMail who the primary MX record is for this domain that we're storing & forwarding mail for. We add this information to /var/qmail/control/smtproutes:
# vim /var/qmail/control/smtproutes

And this information is added in the following format:
domainName.com:primarymailserver.domainName.com

Once your configuration is complete, you need to reload qMail's configuration:
# /etc/init.d/qmail reload

Don't forget to add your new backup server's MX record to your DNS, with a higher number (lower priority) than your primary mailserver, for example:
domainName.com MX 10 primarymailserver.domainName.com

domainName.com MX 50 backupmailserver.domainName.com

No comments:

Post a Comment