DNS and its core components like CNAME Record, A Record, MX Record are very Commonly used while setting up DNS services.
DNS Record types -:
- A Record (Host address)
- CNAME Record (Canonical name for an alias)
- MX Record (Mail exchange)
- TXT Record (Descriptive text)
- AAAA Record (IPv6 host address)
- ALIAS Record (Auto resolved alias)
- NS Record (Name Server)
- SOA (Start of Authority)
- SRV Record (location of service)
- PTR Record (Pointer)
DNS “CNAME” Record-
CNAME (Canonical Name) is a type of DNS record in the DNS (domain name system) system which used for pointing or mapping sub-domains to parent domain or another domain.
For Example – www.abc.com, photo.abc.com, shop.abc.com are sub domains in your organization and you need to manage them to under main domain name abc.com. Just create CNAME record in DNS for all of subdomain and point them to abc.com, There is no need of creating a different new A records for each sub-domain and binding it to the IP address.
So, All CNAME records must point to a domain name as you see above, never to an IP address. The main advantage of using CNAME (alias name) is that if we change the IP address of one “A RECORD” in that case any CNAME record pointing to that domain-name will also change.
Likewise, other DNS records, CNAME records must need to add in your DNS server that is being managed by your company. If you are using hosting company Nameservers, in that case you can add CNAME records using your DNS panel Manager.
A Record V/S CNAME
“A” Record maps a domain name to an IP addresses.
“CNAME” record maps to another domain name.www.techmusa.com CNAME techmusa.com
techmusa.com A 94.23.164.129
CNAME Example –
Let’s presume if you have multiple services are running under one server and domain like www, shop , photo and FTP etc. and you want these sub-domains to point to your parent domain name abc.com. Instead of creating A records for each sub-domain and binding them all to the IP address.
“A” Record (Address Record) points a domain or subdomain to an IP address.
“CNAME” Records must point to a domain or subdomain, never to an IP address.
A Record and CNAME Example –
Your parent Domain – abc.com (Example)
“A” Record = abc.com – 168.58.35.10
Domain | Record Type | Map Record |
abc.com | A | 168.58.35.10 |
www.abc.com | CNAME | abc.com |
photo.abc.com | CNAME | abc.com |
shop.abc.com | CNAME | abc.com |
ftp.abc.com | CNAME | abc.com |
Benefits of “CNAME” Records –
- CNAME Record distinguish network services under a same server and help to pointing them to the root domain.
- CNAME Record help to bind different subdomain owned by the same organization to a primary domain-name.
- CNAME Record does not need to change while when IP address of the server changed. Only need to update one “A” record and all the sub-domains follow it.
- Registering the same domain in several countries and pointing the country versions to the main “.com” domain
DNS Q&A
Q. What is DNS?
DNS (Domain Name System) is an Internet server that converting domain name to IP address. Example, when we type in a Web address (URL) in browser, DNS servers resolve the IP address of the Web site. In short DNS resolve Domain name to IP address.
Q. What is CNAME
The Canonical Name (CNAME) record is used to define an alias hostname.
Q. What is A Record
An A Record maps a domain name to an IP addresses.
Q. What is MX Record
MX – Mail Exchange, record is used by Email servers to manage where to deliver email.MX record is used to tell the internet system that which Email servers accept incoming mail for your domain and where Emails sent to your domain should be routed to.
Q. What is DNS Port?
DNS primarily uses the UDP (User Datagram Protocol) on port number 53 to serve requests.
Q. What is Dynamic DNS (DDNS)
Dynamic DNS (DDNS) service automatically keep updating a name server record in DNS system when the IP address of your device is changed dynamically by the internet provider.
Home user’s connection mostly have dynamic IP address assignment by ISP, then the IP address keep changing of the Internet. To avoid manual update of your records every time the IP changes, you can set up Dynamic DNS for your domain.