A CNAME record is a DNS record that allows you to associate one name with another name. When you create a CNAME record, you can point your domain to another record — or alias — that has the same name as itself.
The purpose of the CNAME record is to provide a way for you to leverage a domain name (to which you have the rights) for purposes that you do not own. For example, you may have the rights to build a site on http://hosting-australia.com, but you do not own the name itself. You can create a CNAME record pointing the domain name to your domain. The name used for the CNAME record (e.g. http://au.hosting-australia.com) is the alias (or target) for the domain name.
A common misunderstanding is that a CNAME record must always resolve to the same website as the domain it points to, although this isn’t true. The CNAME record merely directs the client to the root domain’s IP address. The web server will still handle the URL properly once the client reaches that IP address. For example, au.hosting-australia.com might have a CNAME that links to hosting-australia.com, pointing the client to the IP address of hosting-australia.com. When the client connects to that IP address, the webserver checks the URL and sees that it is au.hosting-australia.com, thus the blog page is delivered instead of the home page.
Example of a CNAME record:
|@||3600||CNAME||is an alias of au.hosting-australia.com|
You can see that au.hosting-australia.com points to hosting-australia.com in this case, and assuming that it is based on our example, We know that the IP address 220.127.116.11 will eventually resolve to a record.
Is it possible for a CNAME record to point to another CNAME record?
It’s impractical to point a CNAME record to another CNAME record because it needs numerous DNS lookups before the domain can be loaded, slowing down the user experience, but it’s feasible. For example, au.hosting-australia.com may have a CNAME record that linked to www.hosting-australia.com‘s CNAME record, which then pointed to the A record for hosting-australia.com.
CNAME for au.hosting-australia.com:
|@||3600||CNAME||is an alias of www.hosting-australia.com|
Which points to a CNAME for www.hosting-australia.com:
This option adds a step to the DNS lookup process that should be avoided if at all possible. Instead, both au. hosting-australia.com and www. hosting-australia.com ‘s CNAME records should link to hosting-australia.com.
What are the constraints of using CNAME records?
MX and NS records must point to an A record (for IPv4) or a AAAA record instead of a CNAME record (for IPv6). A mail exchange record (MX record) is a record that routes messages to a certain mail server. An NS record is a ‘name server’ record that specifies which DNS server for a domain is authoritative.
How to find out your domain’s CNAME record?
- Open your Command Prompt or Terminal
- Type “nslookup [domainname]” then press Enter.
- The command prompt will display your the name (CNAME) record