Usability and limitations of a CNAME record

By | September 7, 2016

Cname, a short abbreviated form for canonical name, is a record in DNS database which indicates the domain name and its aliases that it is associated with, such as IP addresses, sub domains etc. We all know that every website requires an IP address and sometimes we need more than one domain to point to the same IP address. This is where Cname comes in handy, in which a record is being created in the DNS database for each alias. There can be any number of Cname aliases associated with the host name of a computer, but there should be a specific Cname record for each alias. This means if we change the IP address of this specific record within the network, then all the Cname records pointing to it will automatically follow the new IP.
How Cname record exactly works?
When people try to access websites they may not type the domain name exactly the way it is, and sometime get it wrong by mistake. For instance if www.example.com is the website, then people may try it as example.com or ww.example.com or even wwww.example.com etc. The most popular way to resolve this issue is to create a cname record with different names pointing it to the same domain, so that even if the user gets the name wrong, it would still redirect the access to the original domain by referring the Cname record. Similarly, if you want to point all your sub-domains or any particular domain to your main domain, all you need to do is create a Cname record and redirect it to the original domain.
What are the possible restrictions while creating cname records?
There are some limitations that partly restrict the creation and usability of a canonical name record. Some of them are:

  • Cname record must always be pointed to the domain name, but not to an IP address. While activating the record, there should be no other DNS entry for that domain name, otherwise the server gets confused in interpreting the actual name and its alias.
  • Multiple resource records with the same Cname is technically not allowed. When alias is created as Cname record, they should never map to other resource records with the same name even in other file types like NS and MX, which means there should not be duplicate entries even in other file forms.
  • To combat the technical difficulties, sometimes people keep multiple web servers and try to automate the process by pointing the host name to the standby server in case if the first one goes down. For this they create a Cname chain or loop instead of doing it manually. There is nothing wrong in pointing one Cname record to another, however it is not considered as good practice because multiple look-ups use more resources and it may impose an over load on the servers.