I have a subdomain of a site, lets say foo.example.com which has an A record to the IP of another server, lets say example2.com. Ideally, I would like to have the example2's server also take care of the MX record for the foo.example subdomain, but I'm not sure how this would work.

I'm wondering what the options are for doing this, whether this will work:

example.com DNS:
    foo   A    xx.xx.xx.xx
    foo   MX   mx.example2.com

example2.com DNS:
    mx    MX   mx.thirdserver.com

Or could I set up a new dns zone on the example2 server which would just handle the MX record for the foo.example.com domain, where any mail sent to foo.example.com would be handled by these mx records.

Or, alternately, should I solve this with a cname or dname record

  • I'm curious as to why you don't have both MX records poing to mx.thirdserver.com. – mdpc Jun 20 '11 at 19:58
  • because I wouldn't have continued access to the example.com DNS, and would like to just set one record and have the ability to change the MX on the second server, without requiring a change on the first. – tgriesser Jun 20 '11 at 20:00

Delegating the DNS zone for the subdomain is probably more effort than it's worth in this case.

Your first example is fine, with the exception that your MX record is badly formatted. You'll need a priority for the MX server, eg

    foo    A    10 mx.example2.com


  • If you have an A record for a host (foo.example.com), and you address mail to someone@foo.example,com, in the absence of any MX records delivery will be attempted to the A record. So, you don't technically need an MX record for this use case, assuming that the IP address of foo.example.com is the same as the intended MX.

  • I'm not sure that chaining the MX as you have will work (eg, as your example suggests). It may do, I've never tried it. I'd strongly suggest skipping the chaining that you have, and just have the MX record for foo.example.com point strait to mx.thirdserver.com instead.

EG, if you do want the MX to ultimately be mx.thirdserver.com, just do this instead:

example.com DNS:
    foo    A    xx.xx.xx.xx
    foo    A    10 mx.thirdserver.com
| improve this answer | |

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.