Setting Up Postfix As A Backup MX
1 Preliminary Note
I want to set up a backup MX for the domain example.com. In this example the primary MX for example.com is called mx1.example.com (IP address 1.2.3.4), so I call the backup MX mx2.example.com (IP address 1.2.3.5).
I have created MX records for example.com that look like this:
example.com. 86400 IN MX 10 mx1.example.com.
example.com. 86400 IN MX 20 mx2.example.com.
It's important that the primary MX has a lower number (10) and therefore a higher priority than the backup MX (20).
I'm assuming that the Postfix on mx2.example.com is already installed and working.
2 Configuring Postfix On mx2.example.com
To make mx2.example.com a backup MX for the domain example.com, all we have to do is change/add three lines to /etc/postfix/main.cf:
vi /etc/postfix/main.cf
First make sure that smtpd_recipient_restrictions contains permit_mynetworks and reject_unauth_destination, so something like this would be ok:
[...] smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination [...]
Then we must add example.com to the relay_domains paramater; if there's no relay_domains paramater yet in /etc/postfix/main.cf, the following will do:
[...] relay_domains = $mydestination, example.com [...]
And finally we add an empty relay_recipient_maps parameter to /etc/postfix/main.cf:
[...] relay_recipient_maps = [...]
(That way we don't have to specify a list of valid email addresses to back up, which might be a daunting task if you have to manage hundreds of email accounts.)
There's one important thing I have to add: You must not list example.com in the following parameters in /etc/postfix/main.cf:
- mydestination
- virtual_alias_domains
- virtual_mailbox_domains
That's it already. All we have to do now is restart Postfix:
<a href="http://a.collective-media.net/jump/idgt.howtoforge.en/article_above;sec=article;fold=above;tile=3;sz=300x250;ord=123456789?" target="_blank"><img src="http://a.collective-media.net/ad/idgt.howtoforge.en/article_above;sec=article;fold=above;tile=3;sz=300x250;ord=123456789?" width="300" height="250" border="0" alt=""></a
