0

I'm migrating a website from Host A to Host B, but keeping email on Host A. One complication is that Host A doesn't provide a conventional MX record; they just use the naked domain (which I understand is less than ideal but it's what I'm working with). Below is what the DNS settings look like now:

somedomain.com             60      IN      NS              ns-01.dns.etc.com
somedomain.com             60      IN      NS              ns-02.dns.etc.com
somedomain.com             60      IN      NS              ns-03.dns.etc.com
somedomain.com             3600    IN      TXT             "v=spf1 a include:_spf.qwerty.com ~all"
somedomain.com             3600    IN      MX      10      somedomain.com          // not good
somedomain.com             3600    IN      A               192.0.2.10
ftp.somedomain.com         3600    IN      CNAME           somedomain.com
localhost.somedomain.com   3600    IN      A               127.0.0.1
www.somedomain.com         3600    IN      CNAME           somedomain.com
news.somedomain.com        3600    IN      CNAME           somedomain.com
imap.somedomain.com        3600    IN      CNAME           somedomain.com
mail.somedomain.com        3600    IN      CNAME           somedomain.com
pop.somedomain.com         3600    IN      CNAME           somedomain.com
smtp.somedomain.com        3600    IN      CNAME           somedomain.com

In principle, will the following direct email and web traffic to their respective destinations?

somedomain.com             60      IN      NS              ns-01.dns.etc.com
somedomain.com             60      IN      NS              ns-02.dns.etc.com
somedomain.com             60      IN      NS              ns-03.dns.etc.com
somedomain.com             3600    IN      TXT             "v=spf1 a include:_spf.qwerty.com ~all"
somedomain.com             3600    IN      MX      10      mx-01.somedomain.com    // in lieu of a proper MX record
somedomain.com             3600    IN      A               192.0.2.20           // points site traffic to new hosting
mx-01.somedomain.com       3600    IN      A               192.0.2.10           // points email to old hosting
ftp.somedomain.com         3600    IN      CNAME           somedomain.com
localhost.somedomain.com   3600    IN      A               127.0.0.1
www.somedomain.com         3600    IN      CNAME           somedomain.com
news.somedomain.com        3600    IN      CNAME           somedomain.com
imap.somedomain.com        3600    IN      CNAME           mx-01.somedomain.com
mail.somedomain.com        3600    IN      CNAME           mx-01.somedomain.com
pop.somedomain.com         3600    IN      CNAME           mx-01.somedomain.com
smtp.somedomain.com        3600    IN      CNAME           mx-01.somedomain.com
2

The following:

somedomain.com             3600    IN      MX      10      somedomain.com 

Indicates to a Mail Transfer Agent (MTA) that mail going to somedomain.com (example: nobody@somedomain.com) should look for a running mail server at somedomian.com. That will lead to a lookup for the A record, which will return the IP.

In your second statement:

somedomain.com             3600    IN      MX      10      mx-01.somedomain.com    // in lieu of a proper MX record
somedomain.com             3600    IN      A               192.0.2.20           // points site traffic to new hosting
mx-01.somedomain.com       3600    IN      A               192.0.2.10

You are indicating to an MTA to look at mx-01.somedomain.com for the mail server that handles whatever@somedomian.com, which will then look up that A record and then the corresponding IP. So yes, this should work as you expected. You could even put in the IP address instead of the name, but using a name to an A record is a good idea and best practice.

If you're unsure, you should test this. Purchase development domains and set up your DNS records for them first with the same server setup and ensure e-mails route correctly on your testing environment before adjusting production. Also remember that most MTAs will retry for a set amount of time (typically 4 hours) before they will report a failure and bounce an e-mail. This gives you a window when migrating mail servers.

  • Thanks for confirming that I have this correct - at least in principle. You're right, I should test this out first before the actual migration. – friendofdog Nov 16 '17 at 7:10
  • 1
    If your mx sends email, update your reverse DNS when you add the A record!!! – Jacob Evans Nov 16 '17 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.