Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 11 down vote accepted

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 domain must have an SOA and NS records the rule above kicks in, preventing use of CNAMEs too.

share|improve this answer
2  
The restriction is still annoying, but at least now it makes sense. Thanks. –  billpg Aug 13 '10 at 13:51
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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