DNS : Because Remembering IP Addresses is Not a Personality Trait
What is DNS
Have you ever thought how the mechanism behind internet looks like? What happens behind when you type youtube.com in your browser?how all these data routing is done? answer to all these question is DNS(Domain Name Service) which peoples often refer as phonebook or contact list of internet. When we type youtube.com in browser it it doesnt understand we need to refer the IP address something like 216.198.79.1 . Now so that we dont have to remember IP of youtube.com or any sites we visit thats why dns exists and thats the function of dns .Simply it saves the contact name as youtube.com with phone number as its IP address making internet browsing simple among us.

Why DNS records are needed
Now you must be wondering what the heck is “DNS record”. Well, DNS records are some sort of instructions stored on the DNS server that tells how to handle the domain.There are many type of DNS records be we will understand the mostly used ones
NS record : NS record or Name Server record tells the internet which DNS server is responsible for answerable for questions related to this domain.Simply, if your Domain is a company then NS record is headquarter of the company.

A record : its the most important DNS record as it maps a domain (or subdomain) to an IPv4 address of a server.

AAAA record : AAAA record is modern version of A record only difference it holds ipv6 address instead of ipv4
CNAME record : unlike other DNS records pointing towards an IP address, CNAME record points towards another domain and that that domain eventually resolves to an IP. Basically, CNAME record makes one domain name an alias of another domain name.

But the million dollar question is why do we need CNAME record when we have A record as shortcut?
The answer is to avoid hard coding IP addresses. Suppose you have hosted your site on vercel and your A record points to vercel’s IP address .But, if due to some cicumstances vercel’s IP gets changed and your site has active traffic it’d be a disaster for you. CNAME fixes this thing (refer to below image)

- MX record : MX record is resposible for emailing services it tells the internet which mail servers should receive emails for a domain.

- TXT Record : TXT record are like sticky notes on your domain, it stores arbitrary text in DNS mainly used for verification,security and policy instructions.
DNS architecture
Now that we have knowledge about DNS and DNS records you must be curious how all the records work together under the same hood.
Together this records answers the internet a set of questions .When you search for a domain(example.com) following things happens behind the scene:
NS records are being asked for the source of truth.
now browser asks for IP of example.com this get resolved by either A record or CNAME record.
Before loading site content TXT records gets checked .SSL certificate validation , email trust etc gets done .
MX records gets pulled for email routing.
TXT records gets back to game for email security checks.
««««««THANKS FOR GIVING IT A READ ….LETS CONNECT ON TWITTER/X»»»»»»