Backup MX record with same public IP

email

I have two Mac Mini's – both provide redundant DNS and Open Directory services. I want to use Mail service so that everything is integrated with my user accounts.

Unfortunately I only have one public IP address. Is it possible to make my second Mac a backup MX server? I would basically have the public DNS of my domain MX record point to the public static IP. Could I then use internal DNS to setup a backup email server? If I add two IP's to the same mx.example.com then mail could potentially round-robin which I don't want. I need mail to always go to primary server first, then if down, go to the second.

This is for personal home use. I know its not best practice but I'm also not spending $30-50 a month for backup mx service. I just want something to prevent losing mail if I upgrade/replace the primary machine.

Best Answer

Your setup isn't clear: if these are home servers, isn't there a router routing all mail requests to one of your servers?

Still, to (partially) provide an answer to your question, in your situation, you shouldn't worry about losing email: according to RFC 2821, section 4.5.4.1 about Sending Strategy:

Retries continue until the message is transmitted or the sender gives up; the give-up time generally needs to be at least 4-5 days. […]

RFC 5321 adds:

It MAY be appropriate to set a shorter maximum number of retries for non- delivery notifications and equivalent error messages than for standard messages.

So you should have 4 days before losing your email. Then, if you're using a router, you could just make it route incoming traffic to email port to the backup MX server in case you need to do maintenance work on the primary one.