• {{ item.label }}
{{ Errors.RunSearchMessage }}

CNAME record explained

March 11, 2022 (Fri)  |  By Liche Chishaka  |  In DNS Hosting

What is a 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 “www.example.com” are referred to the root domain (or DNS zone apex) “example.com”.

A few common uses of CNAME records are:

  • 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. company.hostname.com), and use CNAME to point to the customer’s domain (www.company.com).
  • 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 Records

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

CNAME from subdomain to parent domain

NAME TYPE VALUE

--------------------------------------------------

www.example.com. CNAME example.com.

example.com. A 192.162.100.100

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

DNS Resolution Process for CNAME Records

  • A DNS client (such as a browser or network device) requests the address www.example.com, 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 “example.com” domain.
  • The DNS request is resolved and the CNAME record is returned to the client
  • The client understands www.example.com is only an alias for the real address, “example.com”, and issues a new DNS query for “example.com”
  • The process is repeated and the resolver returns the A record for “example.com”, containing the IP address.
  • The DNS client now connects to “example.com” using its IP address.

What is a 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 “www.example.com” are referred to the root domain (or DNS zone apex) “example.com”.

A few common uses of CNAME records are:

  • 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. company.hostname.com), and use CNAME to point to the customer’s domain (www.company.com).
  • 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 Records

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

CNAME from subdomain to parent domain

NAME TYPE VALUE

--------------------------------------------------

www.example.com. CNAME example.com.

example.com. A 192.162.100.100

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

DNS Resolution Process for CNAME Records

  • A DNS client (such as a browser or network device) requests the address www.example.com, 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 “example.com” domain.
  • The DNS request is resolved and the CNAME record is returned to the client
  • The client understands www.example.com is only an alias for the real address, “example.com”, and issues a new DNS query for “example.com”
  • The process is repeated and the resolver returns the A record for “example.com”, containing the IP address.
  • The DNS client now connects to “example.com” using its IP address.