Dynamic IP and MX Record

cname-recorddomain-name-systememail-servermx-recordnameserver

I have read that I "must not" use CNAMEs in MX record entries.

My in-house mail server is connected to the internet with a provider where the IP changes every two/three months. I have a subdomain mail.mydomain.com set up which I later reference in my MX entries mydomain.com IN MX 10 mail.mydomain.com. I am the only one in my organization who knows how to do this. When I was gone a couple of days ago the IP changed and obviously mails were not reaching the mail server.

I then thought I would solve my problem with something like CNAME and dyndns. My router would automatically update the dyndns-information and I would change mail.mydomain.com from an A entry to a CNAME (pointing to my dyndns address) and be done with it. The MX entries would stay the same, pointing to the subdomain.

I have implemented this solution and it works fine, except for one specific mail server (of which I know), who apparently can't resolve the domain name. It can if I use an A entry.

Is there a "correct" way of doing this? Without enlisting the services of someone like zoneedit?

Thanks

Best Answer

Presumably, mail.mydomain.com is a CNAME pointing to a dyndns.org (or similar) A record, which is the one you update dynamically.

The right way to do this is to list that dyndns.org record as your MX. It's all very well to quote "must not" as if it were some random prohibition by some passing martinet, but it's a verbatim quote from, if memory serves, RFC974, and that makes it authoritative. That means that any other mail server out there is free to ignore your MX record. Clearly, most are nice, and tolerant, and don't ignore it; but at least one does, and you are at fault when it does so.

Edit: yes, mydomain.com IN MX myip.dyndns.org. is what I mean. Why do you feel that's bad practice? Because the MX is an A record outwith your domain? That's not an issue, I have many of those, and they work fine. Even huge companies do it, he said, picking one at random:

astrazeneca.com.    86400   IN  MX  10 mail79.messagelabs.com.
astrazeneca.com.    86400   IN  MX  10 mail124.messagelabs.com.

though in their case it's done to outsource content filtering rather than because they can't afford a static address!

Related Topic