CNAME record

From WikiMD's Wellness Encyclopedia

CNAME Record[edit | edit source]

A CNAME record (Canonical Name record) is a type of DNS record used in the Domain Name System (DNS) to map one domain name to another. It is commonly used when a website or service needs to be accessed using multiple domain names.

Syntax[edit | edit source]

The syntax for creating a CNAME record is as follows:

``` example.com. IN CNAME targetdomain.com. ```

In this syntax, example.com is the domain name for which the CNAME record is being created, and targetdomain.com is the domain name to which it is being mapped. The IN keyword indicates the Internet class.

Purpose[edit | edit source]

The main purpose of a CNAME record is to create an alias for a domain name. It allows a domain name to be associated with another domain name, which can be useful in various scenarios. For example, if a website needs to be accessible using both www.example.com and example.com, a CNAME record can be used to map www.example.com to example.com.

Usage[edit | edit source]

CNAME records are commonly used in the following scenarios:

1. Subdomains: CNAME records can be used to create subdomains that point to another domain or hostname. For example, a CNAME record can be created to map blog.example.com to www.example.com.

2. Load Balancing: CNAME records can be used to distribute traffic across multiple servers or load balancers. By creating multiple CNAME records pointing to different IP addresses, traffic can be evenly distributed among the servers.

3. Domain Name Changes: CNAME records can be used during domain name changes or migrations. Instead of updating all the references to the old domain name, a CNAME record can be created to point the old domain name to the new one.

Limitations[edit | edit source]

There are a few limitations to keep in mind when using CNAME records:

1. Apex Domain: CNAME records cannot be used for the apex domain (root domain) itself. For example, you cannot create a CNAME record for example.com, but you can create it for www.example.com.

2. Other Record Types: CNAME records cannot coexist with other record types for the same domain name. For example, you cannot have a CNAME record and an A record for the same domain name.

3. TTL: The Time-to-Live (TTL) value for a CNAME record affects the caching behavior of DNS resolvers. It is important to set an appropriate TTL value to ensure timely updates.

See Also[edit | edit source]

References[edit | edit source]

Contributors: Prab R. Tumpati, MD