Not to lose mails when main mail server is down, best solution is – mx backup server.
This is configuration to have backup mx server set up and running.
myhostname = mx2.loginroot.com
mynetworks = 127.0.0.0/8
maximal_queue_lifetime = 120d
smtpd_banner = $myhostname ESMTP
relay_domains = hash:/etc/postfix/relaydomains
transport_maps = hash:/etc/postfix/transportmaps
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination
create /etc/postfix/relaydomains with contents:
loginroot.com OK
otherdomain.tld OK
then to create map for postfix – run:
postmap /etc/postfix/relaydomains
create /etc/postfix/transportmaps with contents:
loginroot.com smtp:mx1.loginroot.com:25
otherdomain.tld smtp:primary_mx_server:port
and run:
postmap /etc/postfix/transportmaps
Backup MX should be added in DNS zone in order to receive mails.
In my case I have such records:
% dig mx loginroot.com +short
10 mx1.loginroot.com.
20 mx2.loginroot.com.
First digit means priority. The bigger value, the smaller priority.
So my MX backup server is mx2. It receives mail only if higher priority server is down.
That’s it.
Leave a Reply