24

I've just read this question which essentially says that when I set up DNS for example.com, the root record can't be a CNAME, it has to be an A record.

My question is, why?

I'm sure the clever people who designed DNS didn't make arbitary restrictions for no reason, but I don't see what we gain by requring root domains to be A records. I would love to just point my example.com domain to someserver.somewebhost.example and forget about it, but I can't.

Please enlighten me, billpg.

1
  • 5
    Odd that my question, asked in 2010, has now been marked as a duplicate of a question asked in 2014. Maybe I should tag that one as a duplicate of this instead. :)
    – billpg
    Nov 5, 2015 at 10:41

2 Answers 2

25

Firstly, the underlying reason is not that you must use an A record, but that you cannot use a CNAME record because those cannot coexist with other normal resource record types.

The reason for that restriction is in §3.6.2 of RFC 1034:

If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different. This rule also insures that a cached CNAME can be used without checking with an authoritative server for other RR types.

As the root of a (delegated) domain must have an SOA and NS records the rule above kicks in, preventing use of CNAMEs too.

1
  • 2
    The restriction is still annoying, but at least now it makes sense. Thanks.
    – billpg
    Aug 13, 2010 at 13:51
13

Well it's not that the root of a domain can't be a CNAME - It's that a CNAME cannot coexist with other record types for the same domain.

Simply put, it would make no sense for a domain with a CNAME to have any other record type, because the CNAME would ensure that they would never be seen or read.

Let's say we did try to give example.net both a CNAME (pointing to host.example.com) and an A record (pointing to some other IP address).

  1. First, the client would request an A record from example.net from example.net's nameservers.

  2. example.net's nameservers would inform us that we need to follow a CNAME record in order to proceed. So we do. The CNAME points to host.example.com.

  3. The client would request an A record from host.example.com's nameservers.

Notice how we never got the chance to read an A record, or any other record type, from example.net? The CNAME takes precedence.

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