What is a [CNAME] Record?
A [CNAME] Record or a Canonical Name Record, specifies that the domain name or subdomain is an alias of another, canonical domain name.
The value of a CNAME record is always a domain name.
What does the [CNAME] Record serve for?
[CNAME] Records are useful because they allow you to set up an alias to a server without using its IP address.
For example, www.example.com
can have a [CNAME] Record pointing to example.com
.
This way when you type in your browser www.example.com
, you are actually redirected to CNAME – example.com
.
How to check a [CNAME] Record?
Use the dig
command, to check [CNAME] Record:
$ dig CNAME www.example.com +short example.com.
Adding [CNAME] Record to DNS — Examples
Use the following syntax to add a [CNAME] Record to a Zone File.
Create an Alias for [WWW] with [CNAME] Record
www.example.com. IN CNAME example.com.
Create Multiply Aliases with [CNAME] Records
example.com. IN CNAME example.tld. www.example.com. IN CNAME example.tld. test.example.com. IN CNAME example.tld.