Do CNAME records also forward MX requests?

Jpsy picture Jpsy · Aug 30, 2012 · Viewed 12.6k times · Source

My DNS has a set up for the domain base.com that consists of A and MX records. There are several other domains that are set up with CNAME records, pointing to base.com. Do I need to set up anything special (like extra MX records) for the CNAME domains, or will the CNAME records also forward any MX requests.

Example:
Will an email sent to [email protected] be delivered correctly to the MX of base.com if these (and only these) DNS records are in place:

; A and MX set up for base.com
base.com.  3600  IN  A  123.45.67.89
mail.base.com.  3600  A  123.45.67.89
base.com.  3600  IN  MX  10  mail.base.com.
; CNAME set up for otherdomain.com
otherdomain.com. CNAME  IN  A  base.com.

Answer

Celada picture Celada · Aug 31, 2012

CNAME causes queries for all RR types (excluding CNAME itself) to be directed to the target name. That includes MX. So yes, the above zone data will cause queries for otherdomain.com.'s MX to resolve to mail.base.com..

Experiment with dig or your favorite DNS client. Not only will you confirm the result for sure, but you won't have to wait 4 hours for someone to answer your SO question before you get your answer!

Unfortunately, in this particular case, if your domain is really of the form otherdomain.com., you would not be able to configure a CNAME resource records for it. This is because domains that have CNAME records cannot have any other type of resource record at the same time. Yet if otherdomain.com. is directly below com. (or another gTLD), it is necessarily at the top of a zone and so it needs at least SOA and NS records.