What are CNAME (Canonical Name) Records?
CNAME records, also known as Alias records, point a hostname to another hostname or FQDN. They are called Alias records because they point to other records that have the mapping for that domain. When a name server looks up a domain and finds it is a CNAME record, it replaces the name with the canonical name (the target of the CNAME) and looks up the new name. In a sense, a CNAME lookup performs two queries to reach the final resolution.
CNAME records are commonly used to point multiple hostnames to a single location. This is useful when you have multiple records pointing to the same location (usually a web server at the root of a domain). If that location changes, all you have to do is change the endpoint in the record you’re pointing all those CNAME’s to. Check out some use cases here.
CNAME records can also be used to point a host name to a location that is external to the domain.
CNAME Record Fields
|A) Name||This is the host name for the record, typically a computer or server within your domain. Your domain name is automatically appended to the end of the “Name” field. For example, if you create a record with the name “www” the record would be defined as “www.example.com”. A CNAME record can not be defined for the root record of the domain as this is a violation of an RFC.|
|B) TTL||The TTL (Time to Live) in seconds is the length of time the record will cache in resolving name servers and web browsers. The longer the TTL, then remote systems will lookup the DNS record less frequently. Your nameservers will also receive less query traffic since most queries are answered by resolving name servers. Conversely, the shorter the TTL the faster any changes you make to your DNS will propagate in servers that have cached data. However, your domain will receive more query traffic.
Records that are static and don’t change often should have TTL’s set between 1800 (being on the low end) to 86400 seconds (30 minutes to 1 day cache).
Records configured with Failover or that change often should have TTL’s set anywhere from 180 to 600 (3 to 10 minutes cache).
If a change is needed for a record with a high TTL, then the TTL can be lowered prior to making the change and then raised back up again after the changes were made.
|C) Record Mode||The Record Mode is how you enable settings like Failover, Record Pools, or Round Robin with Failover. You can read more about these settings here.|
|D) Alias to||This is the location that the host (defined in the Name field) will point to. This can point to another existing CNAME record in the domain, or another location external to the domain. It is important to note, the domain name is automatically appended to the end of this field (if it does not end in a dot). If you are pointing to an external hostname, you will need to end it with a dot.|
|E) Notes||Add a helpful note with keywords so you can search for your records later.|
|F) Save||Save your record changes and don’t forget to commit your changes after you’re done making record changes for this domain!|
Video Tutorial: How to Add, Edit, and Delete Records
ADD A CNAME RECORD
4. In this screen, you will add the record information. Follow the steps below:
A) Name: This will be the hostname for your record. It is important to note, the domain name is automatically appended to the “Name” field of the record. Note the name field is required, because a CNAME record can not be defined for the root record of the domain.
B) TTL: Edit the TTL. Time to Live is measured in seconds and is the amount of time the record will cache in resolving name servers and web browsers.
C) Record Mode: The Record Mode will be left at Standard for this tutorial. Please note, the other Record Mode options are covered in different tutorials.
D) Host: Enter the destination host you would like this CNAME record to resolve to.
E) Note: Add a helpful note with keywords so you can search for your records later.
F) Save and Close: Save your changes. Don’t forget to commit your changes.
Information on the NX Domain feature can be found in the Disabling a Record tutorial.
5. There are two different ways you can point your CNAME to. First, you can point to an A Record within the same domain: www.example.com resolves to example.com. The tool tip at the top of the record configuration screen displays how the host will resolve.
6. Second way is to point the CNAME record to a value external to the domain: www.example.com resolves to constellix.com. Please note, the value field must end in a dot (.) to keep the example.com domain from being appended to the end of the value. The tool tip at the top of the record configuration screen displays how the host will resolve.
EDIT AN A RECORD
3. Under the CNAME Records section, select a record by clicking the check mark next to it, then click the icon to edit a record.
Please note, you can not edit a record that has not been committed following its creation.
DELETE A CNAME RECORD
3. Under the CNAME Records section select a record by clicking the check mark next to it, click the icon to delete a record.
Please note, you can not delete a record that has not been committed following its creation.
4. The record will now show as strike through text, and is now in the queue of changes to be committed.