What is a CNAME Record and How to Create It?

DNS records contain various instructions and information that DNS servers use to find domains on the internet. There are different types of DNS records, each serving a specific function. This article focuses on the fundamentals of the CNAME record. We’ll also walk you through how to create a CNAME record.

What is a CNAME Record?

What is a CNAME record, you ask? It’s also known as the Canonical name record, allowing you to create an alias that points to your domain name. In other words, it maps one hostname to another host or Fully Qualified Domain Name (FQDN). Below are a few CNAME record use cases:

  • A CNAME record is helpful when you have multiple subdomains pointing to the same DNS location and don’t want to assign an A or AAAA record to each subdomain. The benefit here is that when the IP address of the host changes, only the root domain’s DNS A record needs to be changed. 
  • You can use a CNAME record when you want a separate hostname for networking services like File Transfer Protocol (FTP), pointing to your website. 
  • A CNAME record is also used when registering the same domain in different countries,, and you want to point each country’s version to the main “.com” domain.
  • You can use a CNAME record in DNS to point different websites from the same organization to the primary website. 

A typical example is when you have both myserver.com and blog.myserver.com pointing to the exact location. You can use the C NAME record to avoid having two different records. Thus, you set your configuration as follows:

  • Create an A record for the myserver.com domain pointing to the server’s domain.
  • Create a CNAME record for blog.myserver.com pointing to myserver.com.

Performing a DNS record lookup on blog.myserver.com triggers another lookup to myserver.com, which returns the IP address of myserver.com through its A record. There’s a concept you need to understand here. 

People often think a CNAME record must resolve to the same page as the domain it’s pointing to, but this isn’t the case. The CNAME only directs the web browser to the same IP address as the root domain. So when the browser reaches this IP address, the DNS server handles the URL appropriately. While blog.myserver.com has a CNAME pointing to myserver.com, the server will still deliver the blog page instead of the home page.

How the DNS Handles CNAME Records

As a DNS professional, you should understand how DNS handles CNAME records. Below is what the DNS record of the above example will look like:

CNAME from subdomain to parent domain:

Name DNS Record Type  Value
blog.myserver.com CNAME myserver.com
myserver.com A 192.`68.`72.10

CNAME Records Resolution Process

  • When you type the URL blog.myserver.com in your web browser, it looks up the address to create a DNS request. 
  • A DNS resolver receives the query and searches for the authoritative server with the DNS zone file containing the DNS records for the myserver.com domain. 
  • The DNS client (being your device or PC browser) gets the CNAME record after resolving the DNS request. 
  • The browser now knows that blog.myserver.com is only an alias for myserver.com, so it creates another new DNS query for myserver.com.
  • The above process is repeated, and the DNS resolver returns the A record for myserver.com containing the IP address. 
  • The DNS client now connects to blog.myserver.com using the returned IP address.
  • CNAME Record Format

Every DNS record has a format, and a CNAME record is no different. Below is a CNAME www record format.

blog.myserver.com Record type: value: TTL
@ CNAME Alias of myserver.com 32600

How to Create a CNAME Record in Your DNS?

You can create a CNAME record in your DNS via your provider’s control panel. Whether you’re using One.com, Bluehost, HostGator, or GoDaddy, the process is the same. Below is a step-by-step guide on how to create a CNAME record in DNS

  • Login to the DNS provider’s control panel.
  • Go to the DNS settings and locate the DNS records.
  • Then click “create” or “add” a new record, and select CNAME.
  • Input the below details:
  • The subdomain representing the alias for your primary domain.
  • The domain name you create the alias must not be an IP address.
  • Enter a “time to live” or TTL (optional), or you can leave it blank. 
  • Hit the “Create Record” button to save your information.

CNAME Record Restrictions

Though a CNAME record has its benefits, it also has some downsides. Below are a few restrictions on using a CNAME record:

  • Never use a CNAME record for the root domain because the root level is the Start Of Authority (SOA record in DNS), and must point to an IP address.
  • A CNAME record can’t point to an IP address, only host names. 
  • NS records or DNS MX records should never point to a CNAME record.
  • Never place another type of DNS record (A, MX, etc.) in the same hostname defined in the CNAME record, except for DNSSEC records like NSEC and RRSIG. 
  • Domains for emails should not include a CNAME record, as you might get undesirable results. 
  • A CNAME record can point to another Canonical name record, but it’s not advisable.

CNAME vs. Alias

The Alias record is similar to the CNAME but has distinct properties. While the Alias record also connects a hostname to another hostname, it allows you to have other DNS records on the same hostname. This is not possible with a CNAME record. 

Additionally, you can include an Alias record in the root domain, but not a CNAME record.. Using Alias records offers better performance than CNAME records as the DNS resolver doesn’t need to resolve another hostname to get the IP address. Nevertheless, Alias records still require a recursive lookup.

What are Linked Records?

Linked records can be any type of DNS records (CNAME, A, MX, etc.). However, they should be of a similar record type or they won’t resolve. Unlike CNAME records, linked records require one less DNS lookup—reducing the response time for the DNS resolver or the client to receive a reply. Using linked records prevents errors of manually creating and monitoring similar configuration settings across multiple records.

Summary

CNAME records are essential when using multiple domains, and you don’t want to make an A record for each domain. This article has discussed the basics of CNAME records and how to create them. Remember that you can’t point a CNAME record to the root domain or IP address.

Email Security as a Service

Email Security as a Service

Email security is one of the most important aspects of any business. Why? Because email...

Read More
What’s the Difference Between SPF DKIM and DMARC?

What’s the Difference Between SPF DKIM and DMARC?

SPF, DKIM, and DMARC are the three most important email authentication protocols to prove...

Read More
How to Stop Spam Emails and Save Your Inbox [Corporate Email Edition]

How to Stop Spam Emails and Save Your Inbox [Corporate Email Edition]

Everyone agrees that email is fast becoming the preferred communication channel for businesses and...

Read More