There is a new version of this document.
Virtualmin Professional on the primary server, with a working mail and name server configuration
Virtualmin Professional or GPL on the secondary server, with a working mail server configuration
All three supported mail servers can be used for this process, and the mail servers do not have to be the same on the primary and secondary servers. But Virtualmin on both servers must be properly configured for the active mail server.
There is a new version of this document.
Configuring a secondary MX server to provide hold and forward mail service in the event your primary mail server is offline. Virtualmin Professional is required on the primary server, and either Virtualmin Professional or Virtualmin GPL is required on the secondary server.
Mail service is, for many users, the most important internet service. While always-on reliability on virtual hosting systems is impossible (kernel upgrades for security updates, at the very least, require system reboots), the DNS and mail standards provide mechanisms to allow mail to flow successfully even if the primary mail server is temporarily off-line.
Configuration of a secondary mail server is relatively simple, but can be made completely automatic with Virtualmin Professional. To use this automatic backup mail server configuration feature, you must have Virtualmin Professional on the primary server. On the backup server, either Virtualmin Professional or Virtualmin GPL will work.
For this process to work, the following components are needed:
The first step in this process is to add your secondary server to the list of available Webmin servers. To do this, click on the Webmin link in the upper right corner of the left menu pane to activate the Webmin menu. Then, open the Webmin menu category and click on
Webmin Servers Index.
Register a new server link, and then fill in the form, providing the hostname of the secondary and the port on which Webmin is running. In the *Link Type* section, select
Login via Webmin with username ... password ... and enter an administrative level username and password.
Once the form is filled out, click
Save. Assuming there are no errors, you should now see an icon representing your secondary server in the Webmin Servers Index page.
Once the server has been added as a Webmin server, you just need to enable it as a secondary server in Virtualmin. In the left-hand menu, re-activate the Virtualmin menu by clicking on the Virtualmin link in the upper left corner. Now open the
Addresses and Networking menu item, and click on
Secondary Mail Servers.
The server you've just configured in the Webmin Servers Index should appear in the list with an empty checkbox beside it. Click the checkbox to activate it. If you already have domains on your server that you want to setup with secondary mail service, also check the
Add all existing mail domains to secondary MX servers?. Finally, click
That's it, you're done!
Note: If you just want it to work and don't care how, you can stop reading at this point. This is merely for those folks who like to understand what's happening behind the scenes.
This Virtualmin Professional feature makes use of a couple of features of the mail RFCs. First up, it creates an additional MX record, with a lower priority (higher number, but lower priority in the sense that it won't be contacted unless the primary isn't responding) than the primary. Second, it adds an entry on the secondary server to the list of domains that the server will relay for. This causes the secondary to accept mail for the domain, despite not having a local mailbox to place it in.
Since the mail RFCs have well-defined rules about what to do in the event a server is down, this has the effect of causing the secondary to simply accept the mail and hold it in its queue until the primary comes back online. It will automatically attempt to resend the mail periodically, and will only bounce the mail back to the sender if the primary stays off-line for an extended period of time.