Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Updated
4 min read

How does a browser know where a website lives?

DNS is a phonebook of the internet. Now, Suppose if your friends lives in Delhi you go to Delhi you will not shout Shubham , Shubham where are you. You will need a address to find his home, likewise when you enter a URL name on browser the DNS converts URL into IP and locate where that particular IP sits. It will help in finding the address.

A computer doesn't understand human language; it chats in binary, i.e., 0, 1.

Below is how DNS works

What is DNS?

DNS is Domain Name Server. It is a phone book of the internet. It basically converts users language, i.e., alphabetical to numerical which the computer understand. Basically it converts it into IP address. It made the life of the user easy because now you don't have to remember IP address, Before DNS was invented You have to remember IP address.

http://198.111.76.78

Why do we need DNS records?

DNS alone cannot work it needs records like NS , A, AAAA, MX, TXT.

We need a DNS record so that the internet knows where to send visitors when someone types your website name.

NS Record

NS record simply tells the internet which company is responsible for my domain name. It tells who is the owner of the website.

Example when you type dig. chaicode. com in powershell or linux it will show something like

ns1.godaddy.com
ns2.godaddy.com

it means godaddy.com is the owner of your domain. But, it will give only the name of the website, the information of the website is available on the server i.e AWS or Google.

A record

This is the most famous one it connects your domain name to IP address.

Like when you type the name of a website shubham.com

DNS will check it with NS record (who manages the DNS). Then DNS will check with A record to return the IP address. This is basically the old address.

AAAA record

As there is now lot of new websites. It now requires new address to accurately reach IP address.

chaicode.com → 7866:2830:220:1:248:1893:23b8:1456

Just like the A record it also tells the address of the person, but in more detailed way.

It connects the domain to IPv6, but A record was connecting it to IPv4.

The CNAME Record (The Nickname)

CNAME record is the canonical name.

It connects one domain to other domain. It doesn't connect user to IP address.

Like suppose your website name is shubham.com and you want www.shubham.com to open the same website.

Now what DNS will do it will check with the CNAME it will redirect to shubham.com. DNS will check with A record and return the IP address.

www.chaicode.com → chaicode.com

The MX Record (The Post Office)

MX is mail exchange.

When you send mail to your boss the internet wants to know which server handles the letters.

Suppose you are using the services of google mail, so all your mail will go to google mail server.

The TXT Record (The Sticky Note)

TXT = Text Record

TXT record stores text information in DNS, mainly for verification and email security. TXT record is used to store special messages that other services read to verify or secure your domain. It tells you that you are the owner of the domain.

It is also used for security to tell other mail servers, "Hey, only these servers are allowed to send mail for me. If you see mail from anyone else, it's a lie!"

How they all work together (The Big Picture)

A vs. CNAME

A name provides the address of the IP address. It has direct connection with website.

It connects the domain name to IP address.

Whereas CNAME connects domain to the domain. It is just the nickname of your website.

NS vs. MX

NS is the name server is just like the boss of the company who tells go and ask that employee about a particular thing. Like suppose your domain is managed by Godaddy.com then Godaddy will tell the IP address, mail server AAAA records.

Whereas MX is mail exchanger it tell suppose you have the service of google mail server.

Then all my mail for my domain will go to google server.