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.

Is it allowed in DNS to have a CNAME record that points to another CNAME record?

The reason we need this is that we have a hostname that we want to be looked up to the IP address of our web server computer. We also have another web server computer stand by that could be activated in case the first one would die. In such a case we would quickly need to point the hostname to the IP address of the stand by web server computer.

Unfortunately the hostname resides in a DNS domain where any change would take long time due to manual operation dependent on other sysadmins. But we have another DNS domain where we can perform the changes ourselves quickly. Having CNAME to CNAME chain seems like a possible solution. But is it allowed? Will web browsers understand it?

share|improve this question

3 Answers 3

up vote 21 down vote accepted

From RFC 1034 - Domain names - concepts and facilities:

Of course, by the robustness principle, domain software should not fail 
when presented with CNAME chains or loops; CNAME chains should be followed 
and CNAME loops signalled as an error.

So yes, it is allowed and properly written software will handle it just OK. CNAME chains aren't however considered good practice and impose an overhead on the infrastructure.

share|improve this answer
1  
+1 for the RFC reference –  Alnitak Sep 9 '11 at 9:56
2  
Although I do this all the time, the quote above is out of context. Just above this paragraph it reads.. Domain names in RRs which point at another name should always point at the primary name and not the alias. This avoids extra indirections in accessing information. –  Molomby Apr 30 at 5:28

Sure, it is possible.

It is generally discouraged though, for the obvious reason that it uses more DNS resources. For example:

foo   IN      CNAME  someserver.somehost.com.
bar   IN      CNAME  foo

Querying 'bar' would result in CNAME foo being queried, then someserver.somehost.com. being queried, resulting in one extra query.

For every element in the chain you will add, another query will be required.

Another reason this is discouraged is that, by creating chains like these, the chances you will somehow create CNAME loops are increased; these should be detected automatically by current DNS servers, but would still impose a large load on the servers.

share|improve this answer

Yes, it's allowed and will work, but it's not considered good practice. The multiple lookups use more resources, and there's a risk of accidentally creating a loop.

share|improve this answer

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.