Expanding the knowledge about DNS records, we can’t skip another of the essential DNS CNAME record.
DNS CNAME record explained
The full name of the CNAME record is Canonical name record. The Canonical Name is demonstrating which exactly is the real name of a domain. In that direction of thought, the DNS CNAME record serves the purpose to point which is the true canonical domain name of one domain name.
Find out the most common uses of the CNAME record!
You will use DNS CNAME record if you want to connect one subdomain like “www.ExamplePage.com” to its true domain “ExamplePage.com”.
This is, probably, the most common use for it. To show that a subdomain is just another way to name the canonical one.
We must pay attention to the fact that if you create a DNS CNAME record for a host (domain), you can’t add any other type of DNS records.
And you can see it the other way around too. If there are other DNS records already, you can’t add a CNAME record.
If, for some reason, you need to have both CNAME records and other types of DNS records, you will need to use another resource called ALIAS record. It will answer a query with the IP address instead of the canonical name, and that way, it will save time.
They have similar functionality, but not all DNS service providers offer them.
Another reason to have DNS CNAME records is to redirect services like mail or FTP to the true host. That way, you don’t need to add DNS records for their subdomains. All records will be updated on a level of the domain.
People use CNAME to redirect multiple websites like ExamplePage.de, ExamplePage.it, ExampePage.fr to a single one like ExamplePage.com. You can technically do that, but it is not the best option to redirect the traffic.
DNS CNAME records can serve to balance the load when you have a Content Delivery Network (CDN). A DNS request for a domain can lead to a DNS CNAME record that is working in a CDN and return an answer that best suits the user.
What can we see inside a DNS CNAME record?
It is a simple text file with a few line:
- Host – The current hostname. The service or subdomain that you will direct to the true host.
- Type – CNAME. It shows the type of DNS record that you are going to use.
- Points to – Set the true canonical name here. You can point multiple CNAME records (from the multiple subdomains) to the true one.
- TTL – Time period that indicates how long the cache data will be cached on the recursive DNS server
Why does the DNS CNAME record exist?
The CNAME record exists, so you can easily point many different hosts (subdomains) to one domain name (canonical). You can control the DNS records from the canonical host, and all of the rest that are pointing there will get the latest update.
It is easy and fast!
Imagine if the IP address of the host changes. You don’t want to manually fix each subdomain. If there are CNAME records, they will point to the host, you will get a result for the host, which will be an updated A or AAAA record, and you can continue without any slow down or a problem.
Suggested article: DNS SOA record explained