The CNAME (Canonical Name Record) is a type of DNS record that maps one domain name (an alias) to another domain name (the canonical name). Essentially, it redirects queries from the alias to the target canonical domain, where it can find the appropriate records.
Characteristics of a CNAME Record:
- Purpose: To provide an alias for another domain name, which then handles the queries.
- Format: The record consists of an alias name and the target canonical domain name.
- Example:
www.example.com. IN CNAME example.com.
In this example, when someone accesses www.example.com, the DNS system uses the CNAME record to redirect the query to example.com. Any subsequent lookups (e.g., for an A or AAAA record) are then done using example.com.
Key Points:
- UsageCNAME records are often used for subdomains. For example, you might want
blog.example.comto point to the same place asexample.com, so you’d set up a CNAME record to make that happen. - LimitationsYou cannot have any other records for a domain that has a CNAME record. That means if
www.example.comis a CNAME toexample.com,www.example.comcannot have its own MX or TXT records. - DNS ResolutionWhen a resolver encounters a CNAME record, it will resolve the CNAME alias to its canonical name, and then make an additional request to get the actual IP address associated with that canonical name.
- No CNAME ChainingIt’s a bad practice to point a CNAME record to another CNAME record (known as chaining). It can lead to increased DNS lookup times and potential resolution failures.
- Apex of a DomainDue to the restrictions of CNAME records, you can’t use them at the apex (root) of a domain. Some providers offer “ANAME” or “ALIAS” records to get around this limitation.
CNAME records provide flexibility in DNS management, allowing administrators to alias one domain to another and making it easier to manage and reconfigure infrastructure as needs change.
Key terms in plain language
Open a term for a concise explanation of language used on this page.
Colocation
Placing customer-owned servers and network equipment in a professionally operated data center that provides power, cooling, physical security, and connectivity.
Content Delivery Network (CDN)
A distributed system that serves website or application content from locations closer to users, improving speed, resilience, and capacity.
Cloud Computing
Computing resources—such as applications, servers, storage, or databases—delivered from remote infrastructure and scaled as requirements change.
Infrastructure as a Service (IaaS)
Cloud-based servers, storage, and networking that customers configure and manage without owning the underlying data-center hardware.
Bandwidth
The amount of data a connection can carry in a given time, usually measured in Mbps or Gbps. More bandwidth supports more users, devices, and simultaneous applications.
Disaster Recovery (DRaaS)
A plan and service for restoring applications, data, and operations after an outage or disruption. DRaaS provides recovery infrastructure through a managed cloud service.