Canonical Name (CNAME) records are DNS records used to create an alias for a domain name. CNAME records allow you to associate a domain name with another domain name, which is referred to as the canonical name. When a DNS query is made for the alias domain, the CNAME record points the query to the canonical domain, where the actual resource records are stored.

Key points about CNAME records:

  1. Alias Creation: CNAME records are used to create aliases for domain names. Instead of using an IP address, you can create an alias that points to another domain name.
  2. Canonical Name: The canonical name is the fully qualified domain name (FQDN) that the CNAME record points to. This canonical name should have its own DNS records (such as A, AAAA, MX, etc.).
  3. Resource Record Separation: The primary purpose of CNAME records is to separate the resource records associated with a canonical domain from the alias domain. This allows you to change the IP addresses or other settings for the canonical domain without affecting the alias.
  4. Redirection: When a DNS query is made for a domain with a CNAME record, the DNS resolver follows the CNAME record and queries the canonical domain for its associated resource records.
  5. No IP Addresses: CNAME records cannot point directly to IP addresses. They only point to domain names.
  6. TTL (Time-to-Live): Like other DNS records, CNAME records have a TTL value that determines how long the DNS resolver caches the information.
  7. Chain of CNAMEs: It’s generally not recommended to create long chains of CNAME records, as it can lead to performance issues and complicate DNS resolution.
  8. Subdomains: CNAME records can be used for subdomains as well. For example, you can create a CNAME record for “www.example.com” that points to the canonical domain “example.com.”
  9. Root Domain Limitation: CNAME records cannot be created for the root domain (e.g., example.com). To create an alias for the root domain, consider using URL forwarding or other methods.
  10. MX Records: CNAME records cannot be used for MX (Mail Exchanger) records, which determine the mail server for a domain.

CNAME records are commonly used when you want to create an alias for a specific purpose, such as redirecting subdomains to a different domain or pointing a subdomain to a content delivery network (CDN). However, due to their behavior and potential implications, it’s important to understand when and how to use CNAME records effectively.