DNS CNAME Record

In DNS, CNAME is short for Canonical Name. A CNAME creates an alias for other DNS names.

What is a CNAME Record?

When an admin creates a CNAME record, they are creating a record that points to another DNS record instead of an IP address (like in the case of an A record, for example). A CNAME will act as an alias. Essentially is an end users is typing in a URL that correlates with a CNAME, a DNS lookup will be performed to find that CNAME and then another lookup will be performed to find the A record which will send back an IP address to enable communication between the end user and the destination.

A CNAME record may point to an A record, but could also point to another CNAME record. In this case, though, even more lookups will be performed which may impact user experience because there will be added latency.

CNAME Record Example

Record

Type

Value

two.menandmice.com

CNAME

one.menandmice.com

one.menandmice.com

A

192.168.100.2

How does a CNAME Record work?

There are a few different use cases for CNAME records. In general, what companies do is rather than creating A records for every subdomain they might have. They’ll create an A record for their root domain, and then create several CNAME records for each of their subdomains. The end user will then be redirected to the root domain if they type in a URL that specifies a sub-domain.

blog.example.com in this case would lead the end user to example.com:

Record

Type

Value

blog.example.com

CNAME

example.com

example.com

A

192.168.100.5

An end user in the above example would type in blog.example.com. The Domain Name System would start to look that name up, but see that it’s a CNAME record and restart the query for example.com. This leads them to an IP address which begins to open the line of communication.

In the case of a CNAME leading to a CNAME, this leads to multiple queries:

Record

Type

Value

blogs.example.com

CNAME

blog.example.com

blog.example.com

CNAME

example.com

example.com

A

192.168.100.5

A better way to do the above example:

Record

Type

Value

blogs.example.com

CNAME

example.com

blog.example.com

CNAME

example.com

example.com

A

192.168.100.5

How to create a CNAME Record?

Creating a CNAME record would depend on which DNS management solution you’re using. If you’re using a DDI solution like Micetro, from Men&Mice you would do the following:

  1. Open the Micetro Web UI
  2. Click on the DNS tab
  3. Double click the DNS zone in which you’d like to create a CNAME record
  4. Click the Create button
  5. Specify a name for the CNAME record
  6. Select the CNAME type
  7. Specify a TTL
  8. Specify the target (likely the root domain in many cases or something that leads to an A record)

create-cname-record.png