How to configure a backup MX email server with postfix

You have a main server, which could be set down for maintenance, or any reason, you want a backup MX email server to take the relay and send back all email arrive when the main server is ready. Here a quick solution :

First install postfix, and edit the "main.cf" :

#set your hostname, the same domain from the MX setting
myhostname=mx2.celogeek.fr
#mydestination is the local setting, it will take all my from this domain for him, don't put your main server there
mydestination = $myhostname, localhost
#here all accepted domain the server will relay if the main fail
relay_domains = $mydestination, celogeek.fr, celogeek.com
#clean up this field
relay_recipient_maps =
#you need to accept external connexion, add $myhostname there
inet_interfaces = $myhostname, localhost

Now in your domain name server configure your backup :

1 - mx1.celogeek.fr - IP_OF_MAIN_SERVER
2 - mx2.celogeek.fr - IP_OF_YOUR_BACKUP_MX_SERVER

You will set number for each mx, smaller has the higher priority. So the first one will be try by email server, if fail, try the second ...

Have fun !

Short URL

Comments