NR Hosting Ltd

What is a CNAME Record?

What is a CNAME Record?

CNAME Record – A Canonical Name (CNAME) Record is used in the Domain Name System (DNS) to create an alias from one domain name to another domain name. A common example is the www subdomain which is provided as an alias to the root domain name – users accessing “” are referred to the root domain (or DNS zone apex) “”.

CNAME Record – How it Works, Alternatives & Advanced Use Cases

Providing a separate hostname for specific network services, such as email or FTP, and pointing that hostname to the root domain

Many hosted services provide a subdomain for each customer on the service provider’s domain (e.g., and use CNAME to point to the customer’s domain (

Registering the same domain in several countries and pointing the country versions to the main “.com” domain

Pointing from several websites owned by the same organization to a primary website

How the DNS System Handles CNAME Record

The DNS records in the above example would look like this:

CNAME from subdomain to parent domain


The second record is an A record which translates the human-readable domain name “” to an IP address.

DNS Resolution Process for CNAME Records

A DNS client (such as a browser or network device) requests the address, and a DNS request is created.

A DNS resolver receives the request and finds the Authoritative Name Server that holds the DNS Zone file with DNS records for the “” domain.

The DNS request is resolved and the CNAME record is returned to the client.

The client understands is only an alias for the real address, “”, and issues a new DNS query for “”

The process is repeated and the resolver returns the A record for “”, containing the IP address.

The DNS client now connects to “” using its IP address.

CNAME examples

CNAME from subdomain to subdomain


CNAME from subdomain to other root domain


In this example the A name for “” is provided in another DNS Zone file.

Restrictions on CNAME Records

A CNAME cannot be placed at the root domain level, because the root domain is the DNS Start of Authority (SOA) which must point to an IP address.

CNAME records must point to another domain name, never to an IP address.

A hostname defined in a CNAME record must have no other resource records of other types (MX, A, etc.), except for DNSSEC records like RRSIG and NSEC.

CNAME records can point to other CNAME records, but this is not considered a good practice as it is inefficient.

MX and NS records must never point to a CNAME alias.

Domains that are used for e-mail may not have a CNAME record – this can have undesirable results with different mail servers.

CNAMEs and Alternative Record Types

The CNAME Record is typically used alongside other types of DNS Records – A Records and ALIAS Records.

Difference Between A and CNAME

An A Record maps a hostname to one or more IP addresses, while the CNAME record maps a hostname to another hostname.

Difference between ALIAS and CNAME

The ALIAS Record, like CNAME, also maps a hostname to another hostname. However, the ALIAS Record makes it possible to have other DNS records on the same hostname, while CNAME does not. This makes it possible to apply ALIAS at the root domain (DNS zone apex), which is not allowed for CNAME.

In addition, ALIAS has better performance than CNAME because it does not require the DNS client to resolve another hostname – it directly returns an IP. However ALIAS records too need to do recursive lookups behind the scenes which can affect performance.

Leave a Reply

Your email address will not be published.