Build a Backup MX
The primary goal of a backup machine for Postfix is that if the first one fails, mail will be collected by the secondary mail server until the primary mail server is back online. When you build the Backup MX be sure to install all of the necessary applications to scan for viruses and check for SPAM as you do not want to overload the primary machine once it comes online.
DNS Records for example.com would look like this:
IN MX 10 mail.example.com.
IN MX 20 mail2.example.com.
In the illustration you can see that when the primary mail server is unavailable, automatically the mail will be sent to secondary machine which will hold all mail in the queue until the primary server is online.
Before you get too excited about building a secondary mail server as a backup think about how you want to implement the process. A Live Postfix Class can also be helpful in building the skills it takes to configure a mail server.
Spammers Love Secondary Mail Servers
In the research for this project, viewing many experiences with mail servers, one of the typical problems that many mail administrators have had is that when they created a secondary as a backup they did not prepare it as well to deal with Spam and Malware. Spammers have discovered this and will send the Spam to the backup as it usually does not have the restrictions that the primary server does. So, if you are going to prepare a secondary mail server, be sure to set it up completely to scan for Spam and Anti-Virus so that it is not abused.
Create a Relay
The secondary backup can be created a lot of different ways, but the one that makes the most sense is to have the backup hold the incoming mail in a queue until the primary server is back online. There are several reasons for this. First, most companies do not have the financial resources to put into service two hardware devices of equal value. You can save money by using the secondary machine on lower quality hardware. Second, if you allow the secondary machine to function fully like the primary you have the problem of syncing the mail and configuration constantly. The other factor is that most organizations will have the primary backup quickly as it is a very important part of the company.
Here is the /etc/postfix/main.cf
myhostname = mail2.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = mail2.example.com
mynetworks = 127.0.0.1 192.168.3.5
relay_domains = example.com, $mydestination
relay_recipient_maps =
queue_run_delay = 200s
content_filter = smtp-amavis:[127.0.0.1]:10026
One modification that you see here is that the queue_run_delay is dropped down to 200 seconds so that you will have Postfix check the queue more often to get the mail on the way.
The is a simple set up that has a lot of advantages.
{ 3 comments }
Dear, Can I creat three mx server for receive messages? After this servers send to main server.
I’d like to creater a cluster of mx server just to receive mail (filter virus, spam ) after that send to primary where exist useres. It is possible?
Mateus,
Sure you can; just create 3 MX’s. List them in your DNS with equal priorities like so:
example.com IN MX 10 mail1.example.com
example.com IN MX 10 mail2.example.com
example.com IN MX 10 mail3.example.com
Then configure one server holding all the mailboxes and the two others as backup, receiving mail and relaying them to the first mailserver. Remember to implement spam/viruschecks on all three servers.
Good luck!
Works great. Thanks for all the help. And have anice weekend!