DNS records guides the web server to an IP address when a user requests a domain. In other words, they tell the DNS server which domain name is mapped to which value or (IP address). Various record types are used to perform different actions on DNS servers which are A, AAAA, CNAME, MX, PTR, NS, SOA, SRV, TXT, and NAPTR. In this blog, we will discuss the widely used records A and CNAME.
A Record: It stand’s for ‘address’ in DNS records. It is the most basic address as it map’s the domain name to a specific IP address a.k.a. Value. For example, I want to map youvcode.com to map to 22.214.171.124 address. The entry will look like below:
CNAME Record: It stand’s for ‘canonical name’. It is used to point one name to other name instead of an IP address. CNAME is mostly used to redirect to the main domain or associate new sub domains with an existing domain’s DNS record. For example, people commonly use the alias http://www.youvcode.com and can be transferred to https://youvcode.com using the CNAME record as shown below:
Now when http://www.youvcode.com is searched by a user the DNS server will point to youvcode.com which in return will point to the address 126.96.36.199. CNAME records can also be used to register a domain in several different countries and then redirect all of them to the main domain.