0

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?

3 Answers 3

2

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?

2
  • Dennis' idea is the right one, in my opinion - have the old server accept the email, and send it onto the new one.
    – MadHatter
    Commented May 15, 2014 at 11:53
  • I didn't know it was possible to have a mail server forward all incoming mail elsewhere. This seems like the best solution. Thanks! :)
    – Phil
    Commented May 15, 2014 at 13:20
1

you could enter both entries with different priorities. Once you want to switch to server2, just disable the mailserver on server1 (f.e. stop service) Just make sure every DNS has the additional 2nd entry.

Qoute from google postini An MX record consists of three parts: the domain name, a priority, and an email host. The priority indicates which record gets looked at first when determining where to route a message sent to the domain. Normally, the primary server named in the record with the highest priority, is used. But if that server is not available, the next highest priority’s record is evaluated, which is typically a backup server. And so on.

1
  • Some mailers don't respect MX priority...
    – EEAA
    Commented May 15, 2014 at 10:39
0
  1. Configure your NEW server for your domain. It should accept for local delivery all the mail for your domain.

  2. Configure your OLD server to relay all incoming messages for your domain to the NEW server instead of local delivery.

  3. If you have used SPF, add NEW server's IP-address to the list. If SPF is not used - forget about it.

  4. Just wait.

Until new DNS settings become populated, other servers will send messages to the OLD IP-address of MX for your domain. And OLD server immediately retransmit that messages to the NEW server by explicitly manually defined IP-address. When some server obtain new DNS data, it will send messages directly to the NEW server. After some time there is no messages will arrive to the OLD server and then you can easily shutdown it.

2
  • How exactly do you get the old server to forward mail to the IP of the new server?
    – inspirednz
    Commented Mar 29, 2019 at 21:08
  • The easiest way is to establish ssh tunnel with ports forwarded inside. Something like this: ssh -i rsa_key -4fN -L :25:pp.qq.rr.ss:25 -L :587:pp.qq.rr.ss:587 [email protected] where pp.qq.rr.ss is an IP-address of the new server. Old server's MTA should be stopped indeed.
    – Kondybas
    Commented Mar 30, 2019 at 18:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .