What is a DNS CNAME? Print

  • 6055

Understanding DNS CNAMES
CNAME records are "canonical name" records. DNS allows machines to have a true (canonical name), as well as an unlimited number of aliases. The CNAME record takes care of aliases. These should only be used when absolutely necessary, unless you are very familiar with DNS, since they can cause lots of problems if not used properly.

One of the times where CNAME records can be useful is when you want a subdomain to point to a computer outside of your domain. For example, you might want "news.example.com" to go to your ISP's newsserver. Instead of putting in the IP address, you could put in "news.example.com CNAME news.myisp.com", so that if the IP address of the news server changed, you wouldn't have to make any changes.

It is also said that CNAMEs may be useful when you are renaming a host, and will later get rid of the current name [RFC1912 2.4].

Finally, [RFC1912 2.4] suggests that CNAMES are good for generic names, for example, having "www.example.com CNAME funky.example.com", so the machine can have its own official name, but users can still find it without knowing its real name. Be careful with this though! In this case, you can have an A record for www.example.com pointing to the IP address that funky.example.com has (however, a reverse DNS lookup for the IP address can only return one of the names).

Was this answer helpful?

« Back