Understanding DNS Record Types
Understanding common DNS record types

How do you think the browser knows what website you are trying to reach, where it is located or what is the IP on which it is located?
All these questions are answered by the Domain Name System.
Introduction:
Humans are not good at remembering numbers, especially IP addresses - set of four numbers separated by period. With millions of websites present on the internet, remembering each one's IP address is next to impossible. That's why humans use domain names. Domain names are nothing but human-readable names given to websites that are easy to read and remember.
Contrary to this, computers and browsers don’t understand domain names; all they understand is numbers(IP addresses in this case). To bridge this gap we have Domain Name systems which act as an intermediary allowing humans to access websites without remembering the IP addresses
Domain Name system or DNS, also known as the phonebook of the internet, is a system that translates domain names(like google.com) to IP addresses (like 12.52.45.7).
Why DNS records are needed
DNS records are instructions written in an authoritative DNS server. You can think of DNS records as all the information (concerned to networks and hosting) associated with a specific website. Not all websites have all types of DNS records associated with them. The main three DNS records all functional websites should have are : A/AAAA record, NS record and SOA record.
What an NS Record is (who is responsible for a domain)
NS in NS records stands for Name Server, this record gives information about the authoritative server that has the DNs records of the website. A single website can have multiple name servers.
What an A Record is (domain → IPv4 address)
‘A’ in the A records stands for address , this record directly provides the IP address of the server on which the website is hosted.
Example: The flat number(IP address) of a person is the exact location where he/she stays.
In this case when the user types the website name and hits enter the DNs will directly return the IP address where the website is located.
What an AAAA Record is (domain → IPv6 address)
The AAAA record maps the domain name to its IPv6 address. It is similar to the A record and is used when either a website has both IPv4 and IPv6 or has only IPv6.
Example: Using both a normal phone number (IPv4 address) and a whatsapp number (IPv6 address) or just using the whatsapp number (IPv6).
In this case when the user requests a website with only IPv6 the AAAA record will be used to give the information about the server that has hosted the website.
What a CNAME Record is (one name pointing to another name)
The CNAME stands for canonical name, this record points to another hostname. It is commonly used when websites have sub-domains, the sub-domain when hit with DNS lookup gives the domain name of the main parent website and then another DNS lookup is triggered to get the IP.
What an MX Record is (how emails find your mail server)
MX stands for Mail Exchanger, this record directs emails to mail servers. The Mail Exchanger uses SMTP (simple mail transfer protocol) after DNS lookup to send the emails. One website can have multiple MX records and which server will receive the mail depends on the priority. For load balancing the priority number is the same. If a website wants to have a fall back mail it keeps the priority number higher than that of the primary email.
What a TXT Record is (extra information and verification)
The TXT record lets the administrator place human readable text in the DNS. This record allows notes to be placed inside the DNS. The information in this record is stored inside quotation marks. The TXT records are used for owner verification and email spam detection.
A vs CNAME:
‘A’ record directly provides the IP address where the website is located while the CNAME provides another hostname querying which we get the IP address
MX vs NS :
The NS record tells users which authoritative server has the DNS records of the website while the MX record dictates how the mails to the website will be handled and where they will go.
How all DNS records work together for one website
This is how all records work together for one website:
NS : Tells exactly who to ask for the website IP address
A : Directly gives IP address of the website
AAAA : Gives IPv6 address of the website
MX : How will mails to the server work
CNAME : Points to another domain
TXT : Additional notes for this website



