Did you come across the terms CNAME or DNS zone when managing your web domains? Do you know what do they mean?
In this post you’ll learn about these terms and why they are used. This way, you will be more confident when performing domain operations or maintenances.
Domain Name System or DNS
The Domain Name System (DNS) is like the phone book of the Internet: basically, it associates domain names with the numerical IP address, which are needed to locate the different computer services and devices.
You can use tools like whois to find the IP address of a web page. For example, the domain example.com translates into the IP 220.127.116.11. This means that when a user types example.com in his browser, the DNS resolver indicates the browser to go to that IP address to find the contents of that domain.
The current Wikipedia definition is that the DNS it’s a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network (learn more).
The Domain Name System is hierarchically separated into pieces in order to be managed more easily. Each of these pieces is called a DNS zone, and represents a boundary of administrative responsibilities and authority, and are managed by certain entities.
These DNS zones may consist of a single domain, or of many domains and subdomains. In some cases, even a single subdomain constitutes a DNS zone. This way, all the DNS settings or records of the domains and subdomains are ordered in the DNS zone file, inside this zone.
An A-record is an entry in your DNS zone file that maps each domain (or subdomain) name to the corresponding IP address. This way, two subdomains of the same domain can point to different IP addresses.
For example, let’s analyze a possible line of your DNS zone file:
example.com A 18.104.22.168
This record is of type A and causes that example.com resolves into the IP address 22.214.171.124.
Canonical Name or CNAME record
The canonical Name or CNAME is a type of resource record in the DNS. It’s an entry in your DNS zone file that specifies that a domain name uses the IP address of another domain (named canonical domain).
If you have two different subdomains, like blog.example.com and www.example.com, you can use CNAMEs to point to the A record example.com, which in turn points to the IP address.
In this table, the Name is an alias for the Value, and the Value is the Canonical Name (or real name). For example, www.example.com is an alias for the CNAME example.com.
This way, if you have to change the IP-address you only have to change it in one place, i.e. in the A record.
A few remarks about the CNAME:
- It’s also possible that a CNAME record points to another CNAME record (although it’s not recommended and may cause loops).
- CNAME records must always point to another domain name, never an IP-address.
- The canonical name that a CNAME records points to can be anywhere in the DNS (local or in a different DNS zone).
- When a DNS resolver finds a CNAME record while looking for a regular resource record, it will restart the query using Canonical name instead.
That’s it!! I hope you have a better understanding about the CNAME and the DNS now! 🙂
Don’t forget to share and +1, please! 🙂