PDA

View Full Version : redirect all e-mail to a new server


S2S-Robert
01-07-2004, 10:33 AM
We are going to migrate to a new server and I was thinking about the e-mail. Is it possible to reroute the e-mail coming in to the old box to go automatically to the new box?

I believe Exim checks if the domain actually exists on localhost and if not it sends to another server. What do I have to change in order to reroute all e-mail to the new server?

And what do I have to do in order to let Exim (or whichever software) know that the domain is running on another IP adres? Is just changing the ip adresses of the name server (through the registrar), enough? This would mean that the ip address of ns1.hostname.com & ns2.hostname.com would be changed.

DirectAdmin Support
01-07-2004, 01:57 PM
Hello,

To forward all emails to another box just clear out all the domains from the /etc/virtual/domains file. Then just change all of the MX records to point to the new server. That will forward the email there. Just make sure that the other server is setup to receive all the email accounts.

John

S2S-Robert
01-07-2004, 06:37 PM
I'm running 160 domains, so manually changing all the mx records of all domains will be quite undoable. Is there no other way then to change the mx records? Or batch change the mx records? Or change some exim configuration that forwards by default all mails to a specific ip?

DirectAdmin Support
01-08-2004, 10:04 AM
Hello,

You could try:
perl -pi -e 's/MX.*/MX \t 0 \t otherserver.com./' /var/named/*.db
service named reload

John

S2S-Robert
01-08-2004, 10:23 AM
And otherserver.com can also be an ip adress?

And secondly you're sure this won't f*ck up every DNS setting for the domains right? :D

DirectAdmin Support
01-08-2004, 10:49 AM
Hello,

I think an IP might work, but it may be against the rules for what an MX record is supposed to be. I'd just enter any domain on that server.. just as long as it resolves (hostname or something).

You cant test it out on one file at a time if you want:

perl -pi -e 's/MX.*/MX \t 0 \t otherserver.com./' /var/named/domain.com.db
Just to get comfortable :) I tested it on one domain here.. but you may want to test it for yourself to be sure ;)

John