2

I'm currently playing around doing some development on an all-in-one box which is hosting web and mail services (among others), and I have a DNS question I can't seem to find a good answer to.

Imagine the domain here is example.com, and everything is running on a single host with a single IP (203.0.113.1)

For the website I have the following:

example.com.    IN    A        203.0.113.1
www             IN    CNAME    example.com.

I know that MX record must not be CNAMEs (RFC 1034 3.6.2), so to set up MX for mail, the usual approach is to add:

mail    IN    A    203.0.113.1
@       IN    MX   0 mail.example.com.

Now I'm wondering if I could instead just add:

@    IN    MX    0 example.com.

However I'm not sure if there are any technical or RFC reasons that this isn't allowed/possible.

Obviously using mail address is more flexible in terms of moving the mail service around later on - I'm just curious as to whether in this simple case it's necessary.

1 Answer 1

3

Yes, you can do that and many domains already do. There's nothing wrong with it, except perhaps for the lack of flexibility (but you're just one TTL away from changing it anyway).

4
  • Hi - thanks for that - do you have any examples you can point to of domains doing this (preferably ones that might be considered 'knowledgeable' companies/orgs).
    – match
    Feb 16, 2019 at 10:27
  • @match It's virtually always small orgs and individuals that do this, when they have combined hosting on a single server. Who's to say whether they are "knowledgeable"? And that doesn't really matter; it's what the specs allow you to do that matters. BTW, if a domain doesn't have an MX record, the default behavior is to contact the address of the domain to deliver mail. So your MX record just makes it explicit to anyone who's looking. Feb 16, 2019 at 15:05
  • I guess I was hoping for something explicit defining or forbidding this - but given it just comes out of the other DNS rules there's no one place to look for it. By knowledgeable I guess I really meant 'trustworthy' - there are a lot of people doing things with DNS on the internet that aren't doing it right! Knowing that the naked domain is a fallback for MX is reassuring though, since it is as close to what I'm looking for as I can get. That comment plus the answer is enough for me to accept - thanks!
    – match
    Feb 16, 2019 at 17:56
  • @MichaelHampton "BTW, if a domain doesn't have an MX record, the default behavior is to contact the address of the naked domain to deliver mail." Can you give a reference for that? Maybe it is the phrasing but the "naked" mention might be misunderstood. If corp.example.com has no MX, the MTA will try the A/AAAA addresses for this domain, but if that fails too, nothing will be used from "naked" domain example.com. Feb 19, 2019 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .