linuxemailpostfix-mtaemailrelay

Configure Backup Mail Relay in Postfix


Diagram

As in the diagram I attached, I have 2 mail relay servers (ap03.net and ap04.net) configured pointed to same smtp server.

ap03.net and ap04.net have identical configurations both are running postfix and all hosts are pointed to primary mail relay server ap03.net

MX record on DNS only pointed to smtp.net mail server

How do I configure ap04.net relay server as backup when ap03.net primary relay got down?


Solution

  • In your DNS zone file you need to specify multiple MXs - the one with the lowest number should be your ap03.net server...

    MX      10  ap03.net
    MX      15  ap04.net      
    

    Then you need to configure postfix on ap04.net to transport the mail to the next MX. Unfortunately how to do this depends on your exact configuration - are you using text files for mapping users/domains, is it coming from a set of mysql db tables, etc.

    Flat files, act as MX for all addresses on your domain - https://www.howtoforge.com/postfix_backup_mx#-configuring-postfix-on-mxexamplecom . Note that this means that anything undeliverable (address doesn't exist on ap03.net) will bounce from ap04.net IF ap03.net is unavailable.

    With mysql backend and virtual users, only acting as backup mx for addresses that exist... http://www.somerandomstuff.com/2010/04/26/backup-mx-with-postfix-mysql/ - be sure to read the note at the bottom of this page regarding recipient lists on a backup MX ....