In the process of gaining knowledge about Domain Name System, it is essential to clarify the meaning of the DNS CNAME record. We just can’t skip it. So, let’s explain a little bit more about it.
What is a DNS CNAME record?
The complete name of the DNS CNAME record is a canonical name record. The Canonical Name is showing which specifically is the actual name of a domain. It has its main goal. It is to point the true canonical domain name of one domain name.
The purpose of CNAME is to make the management of DNS much easier.
With it, you don’t have to add for every subdomain an A or AAAA record.
A simple example is a case with a subdomain www (www.example.com).
It leads to the root domain – domain.com.
It is important to know that it works only for subdomains. Another essential thing to mention is that it can’t coexist with other DNS records in the same zone. Also, it is not possible to lead to another domain name.
When you perform a CNAME query, the answer you will receive is the FQDN (Fully Qualified Domain Name). The next step should be performing another DNS query for the FQDN and receiving the A or AAAA record.
What is the meaning of it?
The DNS CNAME record has a simple and clear purpose. It is to indicate a subdomain is simply a part of a domain name. Also, to direct to the domain name and its Master zone. So that means for your subdomains, you only need a DNS CNAME record. If somebody needs more information, it can be taken from the domain name’s zone.
That allows you to have fewer DNS records and to make the management of the DNS more simple. You can arrange everything you want from the zone of the domain when you once point the subdomain to the domain.
How does a DNS CNAME record look inside?
It is a structured, simple text file. Inside it is with a few line:
- Host – It is simply the current hostname. The subdomain or service that you want to direct to the actual host.
- Type – In this case is CNAME. It shows which is the type of DNS record that you are going to use.
- Points to – Here is set the actual canonical name. If you want, you can point to several CNAME records from the multiple subdomains. All of them pointing to the true one.
- TTL – It shows the time period. Whit it, you can indicate how long will be cached the cache data on the recursive DNS server.
CNAME record vs. ALIAS record
It is possible for the ALIAS record to serve the same purpose as the DNS CNAME record. It just performs it in another way.
The ALIAS has an advantage. It is based on the fact that it can coexist with other DNS records. As we mentioned, the DNS CNAME record cannot function when there are other Domain Name System records.
Another thing about ALIAS is that it is a bit faster. The reason is that it directly returns an IP address. The DNS CNAME record will first show the true hostname, and after performing a second query, you will get the IP address.