The canonical name record or CNAME is a type of resource record in the domain name system (DNS) that maps one domain name to another domain name. It’s used when a domain or subdomain is an alias of another domain. Accordingly, all CNAME records must point to a domain, never to an IP address.
How Do CNAME records work?
The easiest way to understand how CNAME records work is to think of it as a map where every location on the map points to another location until the final location is reached.
For example, suppose the URL of the domain blog.example.com has a CNAME record with a value of example.com. This means when a DNS server hits the DNS records for blog.example.com, it triggers another DNS lookup to example.com, which, in turn, returns example.com’s IP address via its A record and displays the site to the user. Here, it’s important to remember that the server won’t display the site at example.com, but rather the site at blog.example.com because the server will still look at the URL to see which site needs to be displayed.
It is also commonly used when a user, for instance, hosts a site on the server of a hosting provider, while the domain name is provided by a different provider. Here, the user will set up the CNAME records to point to the IP Address of the domain name provider.
Also, many sites that have more than one domain will have CNAME records that point to a root domain. In this way, if the IP address of the host changes, only the DNS record for the domain needs to be updated and all the CNAME records will follow along with whatever changes were made to the root by the user.
Why Are CNAME Name Records Important?
In the first place, CNAME records are important because, as stated, they are used to map one domain to another domain. In other words, without CNAME records, users won’t be able to access sites on different domains or different servers.
They’re also important because they promote simplicity. This is because they enable DKIM on domains and users don’t have to manage the complexity of generating public and private key pairs, sending private keys for signing, and adding DKIM.TXT records to DNS.
CNAME records can also be important when emails are used for marketing, where the CNAME records in URLs sent with email can be used to track email deliverability.