Skip to main content

CNAME

Stands For: Canonical Name Record

Definition: A CNAME record is a type of resource record in the Domain Name System (DNS) that maps an alias domain name to a “canonical” or “true” domain name. It acts as a redirect at the DNS level, allowing multiple hostnames to point to a single target hostname.

Key Characteristics:

  • Mapping: Associates an alias hostname (e.g., www.example.com) with a canonical hostname (e.g., server1.example.net).
  • Function: When a DNS resolver looks up a hostname with a CNAME record, it replaces that name with the canonical name and re-initiates the DNS lookup process for the new name. This process continues until a record like an A or AAAA record is found.
  • Key Restriction: If a hostname is defined as a CNAME alias, it cannot have any other DNS records associated with it (such as A, AAAA, MX, TXT, etc.). This is a critical rule defined in DNS standards. Because the root (or apex) of a domain (e.g., example.com itself) must have SOA and NS records, a CNAME cannot be placed at the root domain.
  • Structure: A typical CNAME record includes:
    • Name: The alias hostname.
    • TTL (Time to Live): The caching duration in seconds.
    • Class: IN (for Internet).
    • Type: CNAME.
    • Canonical Name: The target hostname that the alias points to.

Common Use Cases:

  • Pointing subdomains (like www, ftp, mail) to a single server hostname that has an A record.
  • Directing traffic for a service (e.g., a blog, shop, or helpdesk)