0

I have multiple domains that should point to the same server. I would prefer to use CNAME settings for the root domain.

Now I read that this is not a good idea, because MX records cannot be handled via CNAME, and the provider admin doesn't accept it. However, if I delete all other records for the CNAME domain, will that mean that all requests are properly processed?

If this are the original records for abcdomain:

# NON ROOT RECORDS
*.abc-domain.test           AAAA        1c00:1234:17:0:4::16
admin.abc-domain.test       CNAME       admin.testserver.test
*.abc-domain.test           A           12.34.56.78
localhost.abc-domain.test   A           127.0.0.1

# ROOT RECORDS
abc-domain.test             A           12.34.56.78
abc-domain.test             AAAA        1c00:1234:17:0:4::16
abc-domain.test             NS          ns1.hostingxyz.test
abc-domain.test             NS          ns2.hostingxyz2.test
abc-domain.test             NS          ns3.hostingxyz3.test
abc-domain.test             MX  100     mx15.testhoster.test
abc-domain.test             MX  100     mx14.testhoster.test
abc-domain.test             MX  200     fallback1.testserver.test
abc-domain.test             MX  300     fallback2.testserver.test
abc-domain.test             MX  100     mx1.testhoster.test

If I want to use a CNAME for the root record, that means I have to delete the complete list of root records (A ,AAA, NS, MX) and replace it with a single CNAME:

# NON ROOT RECORDS
*.abc-domain.test           AAAA        1c00:1234:17:0:4::16
admin.abc-domain.test       CNAME       admin.testserver.test
*.abc-domain.test           CNAME       abc-domain.test
localhost.abc-domain.test   A           127.0.0.1

# ROOT CNAME RECORD
abc-domain.test             CNAME       xyz-domain.test

Is this the way to use CNAME root records?

Are there downsides to this?

0

No, that is not allowed. You cannot use a CNAME along with other records, it has to be the ONLY record at that name (or at a wildcard name as you've shown).

The problem here is there are other records for any apex root that you "buy" and those records may just be hidden to you, e.g., for google.com, there are SOA and NS records at the apex root indicating the hand-off from the ".com" DNS servers to Google's DNS servers. You almost certainly have the same thing for your real domain, NS records and an SOA record, indicating an administrative hand-off to your hosting company's DNS servers. That's why you can't put a CNAME at your apex root, the SOA & NS records there prohibit it.

Try one of these commands to see what I mean (not everyone has dig):

dig ns abc-domain.test

or

nslookup -q=ns abc-domain.test

Far as MX records go, you just shouldn't put in a reference to a name that is a CNAME when you have multiple MX records with different priorities. That can short-circuit the delivery process and cause mail to be delivered "further" away and thus cause a loop (name matching fails when culling lowering priority MX records by MTAs). If you only have one MX record, you can get away with it but it's still discouraged.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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