logo
Loading...

What is an CNAME Record?

CNAME, also known as a canonical name, is a type of DNS record used to alias one domain name to another. It allows you to map an alias name to the canonical (true) domain name. This is useful when you want multiple domain names to point to the same IP address or resource but want them to have different names.

How Canonical Names Work?

  • You create a CNAME record for an alias domain name, for example, blog.example.com, and point it to the canonical domain name, which is example.com.
  • When a DNS query is made for the alias blog.example.com, the DNS resolver looks up the CNAME record and retrieves the canonical name example.com.
  • TypeHostCNAMETTL
    CNAMEexample.comblog.example.com.24 hours
  • After that, the resolver performs an additional query to resolve the canonical domain name to its corresponding IP address. The IP address is returned in response to the original query.

Example

Suppose you have:

  • example.com pointing to 192.0.2.1
  • You create a CNAME record for blog.example.com pointing to example.com
  • When someone accesses blog.example.com, the DNS resolution process will follow these steps:
  • blog.example.com → CNAME points to example.com
  • example.com → Resolves to 192.0.2.1
  • Thus, blog.example.com effectively resolves to 192.0.2.1.