CNAME record explained

The CNAME record is one of the first DNS records that you will read about when you are starting with DNS management. It has a very important task to do, showing the true domain name for the subdomains, making it really an essential DNS record. It saves time and makes it easier to manage the DNS.

CNAME explained completely

There are two parts in the CNAME’s name. C stands for canonical, and it wants to show which is the true domain name for the one that you are trying to resolve. The NAME is obvious. It stands for name, as in hostname.

What is the difference between DNAME record and CNAME record?

The purpose of the CNAME record is to point one hostname to another. You can point different subdomains to the domain name. That way, you don’t need to add any other records for the subdomain because it will automatically redirect to the domain name.

If you have just a single DNS record for each subdomain, you will have far fewer DNS records, and the administration of your domain will be a lot easier.

CNAME records can be used to point:

www.domain.com to domain.com

blog.domain.com to domain.com

mail.domain.com to domain.com

newyork.domain.com to domain.com

Because of the way the CNAME record works, if the host (subdomain) already has other DNS records like A, MX, etc., you can’t create a CNAME record. And if you first create a CNAME record in the zone, you can’t create any other type of record in that zone.

Inside a CNAME record, you will see:

Host – the name of the subdomain that you want to point to the main domain name.

Type – CNAME.

Points to – the domain name. All of the CNAME records will point to this one.

TTL – time to live for that DNS record.

How to lookup a CNAME record?

If you are on Windows, the easiest and the safest way to check a CNAME record is to use the nslookup command. Go to the cmd (Command Prompt). Type “nslookup”, and press Enter. Now type “set type=cname”, and press Enter. The last pass is to write down the hostname, which you want to check. See this example, “mail.bing.com” and you will see the canonical name “star-bing-com.a-0001.a-msedge.net”.

If you are using Linux, go for the dig command. Open the Terminal and type “dig cname mail.bing.com,” and you will see the same “star-bing-com.a-0001.a-msedge.net” plus additional information. Dig command has very rich answers.

CNAME vs ALIAS

There is a newer type of DNS record called ALIAS that also points one hostname to another. It can do almost all that the CNAME can, but it can coexist with other records and can be added to the apex zone.

CNAME vs A record

The CNAME and the A records are very different. CNAME point one hostname to another while the A record points the domain name to an IP address. Also, if you want to resolve a domain, and first you get a CNAME, then you will need the A record too. So, the CNAME will take 2 queries instead of 1.

If you are interested in DNS records, check our article about the DNS CAA record!

Leave a Reply

Your email address will not be published. Required fields are marked *

Navigation