Linux – Move mail server to a new server with no downtime

domain-name-systemdovecotemaillinux

We have a server that currently acts as a web, database and mail server. We would like to move mail to its own dedicated server.

So:

  • The address for the mail server is mail.example.com. It has A and MX records pointing to server1.
  • We want to point the A and MX records to server2 while maintaining mail.example.com as the address for the new mail server.

Once we make the change, there will be a DNS propagation period where some mail will still be delivered to server1 while everyone that has updated DNS records will be correctly delivering to server2.

Is there some way of getting our old server (server1) to respond to any mail requests with something like: "I am no longer accepting mail. Send it to server2's IP address instead. Please update your DNS records and resend". That way the sender sees the new IP address and reroutes the mail to server2. This would essentially mean no downtime whatsoever.

Is that possible?

Best Answer

Yes, you can make your server send a 450 response, which will make the sending smtp server retry later, hopefully after DNS has propagated. But why not reconfigure the old server to forward incoming mail to the new one instead?

Related Topic