Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

what happens if 2 mx records are assigned the same priority levell? will the email be sent to both places? Will neither get it? What is the best pratice to have automatic redundant email servers at different locations?

share|improve this question

3 Answers 3

As for the first question, 2 MX records with the same priority will basically be handled like a round-robin. Mail will only be handled by one MX for the domain. This case is specifically discussed in RFC974

share|improve this answer
    
Note there there are plenty of broken MTA's out there. Some only mail to the first result provided by DNS. Some sequentially step through all results regardless of priority. Some consider the priority backwards. I've seen all three behaviors from legitimate sources (i.e., not spammers). –  longneck Jan 23 '13 at 17:05

The best way to resolve this. i.e. the least amount of effort is to setup the primary mail server to be of higher priority. You would then configure your secondary server to function as a store-and-forward backup server (i.e. it does not process any mail but waits for the primary to come back online and forwards to it for processing)

However... There is really very little benefit in doing this most of the time. Most, if not all MTA's will hold email that it cannot deliver for a relatively long period of time - usually several days. If you have a reasonable guarantee you you will be able to resolve any issue with the primary box and bring it back online within a few hours, don't bother with a backup mx record with a mail server.

There is a reason for this. A store and forward backup server is a target for backscatter spam i.e. mail that gets delivered to a spoofed sender because the to: address was invalid - but this was only discovered when the backup tried to deliver to the primary. The server then merrily tries to deliver the email back to the spoofed sender.

If you are concerned about hardware failure, have a backup server ready to go and on failure of the primary, just replace it with the backup.

If you are concerned about network failure and you have a secondary network, plug a second nic into the mail server and set the secondary MX record to point to that ip.

If none of the above works OR if you are looking to load balance a large amount of mail, you should really try and keep both the servers in sync with regards to configuration, user accounts and spam prevention tools. Otherwise, you could end up various different problems.

share|improve this answer

Your main server should (usually) have a unique MX priority. Otherwise you end up with mail entering at random entry points. The backup mail servers may have equal priority among each others, and this could be useful, e.g. if you want to balance the load among them in case of main server failure.

For most situations, a single backup server is fully sufficient, provided it is sufficiently independent (uplink-wise). In fact, mostly it is sufficient to rely on the mail server on the sending side to buffer mail and retry when your server is back up. But you have a lot of better control to quickly transmit the backupped mail if you have a backup mail server under your control. On the other hand, it may even be harmful in case of prolonged (say, a full day) main server failure, if the sender thinks that the mail transmission went okay and there is no need to switch to a phone call for urgent matters (as they might do after warning messages by their own mail server).

Of yourse I don't have to tell you that all backup mail servers must be configured properly to actually relay your domain.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.