PowerDMARC

What is a DNS CNAME Record?

What is a DNS CNAME Record

What is a DNS CNAME Record

The CNAME record is one of the first things you will encounter as you begin to learn more about DNS. Whether you are a novice just delving into the intricacies of DNS or a seasoned professional looking to better understand a specific type of DNS record, this article will bring you up to speed on what a CNAME record is, why it matters, and how to create one for your domain name.

What is a CNAME Record?

A DNS CNAME record is a record type available in the DNS zone that specifies the canonical name for a domain, which can either be an alias for another domain or a subdomain of the main domain.

A DNS CNAME record maps one hostname to another. This means that you can have multiple hosts with the same IP address, but each with a different name.

For example, www.mydomain.com might be mapped to www1.mydomain.com and www2.mydomain.com so that they all resolve to the same IP address.

Subdomains such as mail and www may have their own DNS records, called CNAMEs, which link them to the content-hosting parent domains.

For example, a CNAME record can map the alias address www.mydomain.com to the canonical address mydomain.com — where nothing has changed about where visitors go: they are still directed towards whatever destination is specified by the actual A records for mydomain.com (which must be kept up-to-date).

The canonical name (CNAME) records are also referred to as “true names” or “canonical names.” It’s because a CNAME record maps an alias name to its true, canonical counterpart.

How to Create a CNAME Record Step-by-Step?

To create a CNAME record for your domain, follow these steps:

  1. Go to the DNS management console.
  2. Click “A Record,” then select “CNAME” from the list of records that appears.
  3. Enter the domain name for which you want to create a CNAME record.
  4. Enter the hostname that will be treated as a subdomain.
  5. Enter TTL (Time to Live) which is the amount of time your record will stay in the cache on systems requesting it.
  6. For systems with a static IP address, the recommended TTL is 1800 or higher. For dynamic IP addresses, use a TTL of 1800 or less.
  7. Select “Create” from the bottom right corner of your screen after filling out all fields to save changes and create your new record.

If you already have a CNAME record published on your DNS, you can check it now using our free CNAME checker tool. 

How do DNS CNAME Records work?

A CNAME record points to its canonical name (the true name of the domain). So when you set a CNAME record for your blog, it will return the IP address for your blog (mydomain.com) via its A record.

When you create a subdomain like www.blog.mydomain.com and set it as an alias to the root domain name, then a subdomain like www.blog.mydomain.com will have a CNAME record that points to the root domain mydomain.com

When a DNS server looks up for www.blog.mydomain.com using its A record, it will trigger another lookup using CNAME since this is a subdomain of mydomain.com. This will restart the query using the canonical name and return the IP address for mydomain.com via its A record.

*Note: If a host’s IP address changes, it is only necessary to update the DNS A record for the root domain. All CNAME records, including those of the alias or subdomains, will automatically change when changes are made to the root. Refer to the table below for a better understanding:

(sub)Domain / Hostname Record Type Target / Destination
mydomain.com A 333.444.555.111
www.blog.mydomain.com CNAME mydomain.com
ftp.mydomain.com CNAME mydomain.com
mail.mydomain.com CNAME mydomain.com

Main Uses of DNS CNAME Records

A CNAME record is a type of DNS record that has two fields, the canonical name, and the aliases. It is used to:

DNS Handling Process of CNAME Records

Consider the example domain PowerDMARC.com: if that is our root, www.powerdmarc.com would map to a CNAME record called “PowerDMARC.com. Here’s how the DNS handling process will work:

Name Type Value
www.powerdmarc.com CNAME powerdmarc.com
powerdmarc.com A 172.66.43.156
  1. A DNS client requests www.powerdmarc.com, creating a DNS request in the process
  2. When this request is made, the DNS resolver looks up which Authoritative Name Server holds the zone file for powerdmarc.com and retrieves any matching records from that file.
  3. The DNS client is returned with a CNAME record.
  4. The DNS client realizes that www.powerdmarc.com is an alias, and it issues a new DNS query for the root domain powerdmarc.com
  5. The DNS resolver returns the A record for powerdmarc.com, which contains its IP address.
  6. The DNS client successfully connects to powerdmarc.com via its IP address.

CNAME Record vs A Record vs Alias Record

A record, CNAME record, and Alias record are three DNS records that are used in a DNS infrastructure. Each of these records has its function and purpose. It is important to understand the differences between these three records so you can use them effectively. Let’s look at how each one works.

➜ CNAME Record maps a hostname to another hostname but does not allow other DNS records on the same hostname (such as MX Records).

➜ Alias Record is similar to a CNAME record in that it maps one hostname name to another hostname—but it does allow other DNS records on the same hostname. Because of this addition, it is not possible to apply ALIASES at the apex DNS zone level.

➜ A Record is a single-label mapping between a hostname and one or more IP addresses. The A record maps a single hostname (the label) to one or more IP addresses (the values).

DKIM CNAME Records

Some email vendors may require you to publish a DKIM CNAME record on your DNS for source alignment purposes. 

An example of this is when you want to enable office 365 DKIM record. 

CNAME Record and 301/302 Redirects: Are They The Same?

Both CNAME records and 301 redirects are used by web browsers to direct users from one domain to another via an intermediary domain. However, there’s a big difference between the two:

A CNAME record maps an existing hostname to another hostname within the same FQDN, while a 301 redirect sends the request to the server that hosts your website.

In other words, the CNAME record points the domain name or subdomain of your site to the IP address of the destination hostname, which means it’s not redirecting; it’s just pointing.

Exit mobile version