Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
6 min readView as Markdown
D
CS student focused on backend & OS fundamentals. Building real projects and sharing practical learning.

i asked you , where do you live , probably you gave me address of your house now i ask u agian where do u live now you will give me adress of your room . for a computer house adress is IP adress and room adress is port adress . how much do u expect a port a computer have , its more than 65000 port , yes you heard right. now how does a browser know what website exist . eveytime it open without error to tell u that at sane tine may person are also fetchonh the same browser

DNS ( Domain Name System )

in simple term , DNS is phonebook of internet. human access information through domain names and eb browser interact through ip adress , dns translate domain name into ip adress so broswer can fetch information .

we do seriously need dns beacuse human are bad at remembering number and computer dont understand names , DNs exist ti solve this mismatch

for one liner we an say DNS telll us whom to talk next

DNS Hierarchy

think it as asking for direction you start from root ( main guide ) , it points you to TLD ( like a city ) , tld direct you to exact domain ( street ) and finally the domain takes you to specific host ( house )

DNS Record type

DNS record type are labeled that decide whether a domain shold point to an ip adress , an email server , another domain or somethinh else

types of dns record →

  1. NS record

  2. A record

  3. AAAA reocrd

  4. Cname record

  5. MX record

  6. TXT record

1.NS Record

it tell us if u want information about this domain , ask this serve

in real life

name - Dushyant

phone no. → 9131XXXXX

now imagine if you dont know Dushyant number, but you know who has his number (his collegue) just like i know a guy who know a guy

ns record works the same way :

domain name → Dushyant

name server → colllegue or class mate who know dushyant’s number

IP adress → actualphone number

example

for a domain example.com

ns record may look like ns1.cloudflare.com

Purpose

  1. Fixes: Who controls the domain’s DNS

  2. Connects: Domain → Responsible DNS server

  3. Result: Internet knows where to ask for all other records

2.A record

it connnect a domai name to an IPv4 adress it means , A record tell the internet → this website lives at this server adreess

eg imagine you buy myshop.in

right now this is empty it points to nothing if u type this on browser where is myshopi,in ? dns say no idea as no adree attached.

now yoou add a record as myshop.in → 103.21.58.44 now user type

myshop.in , browser ask dns give me ip adress for my myshop.in now dns look at A record and replies 103.21.58.44 and thhan browser connect to that server now website load .

Purpose

  1. Browser does not know server adress
  1. Connect: Domail to IP

  2. Result → website open

3.AAAA record

it connect domain name to IPv6 address

imagine in a coty a house number has been ran out

same place older verssion → street 5 , house 120

now city intrduce better adress system → Sector:8F3A:Block:21:Unit:9A

same houuse beter syatem more spacwe this is IPv6

A record : old adress → IPv4

AAAA record new adress → IPv6

since IPv4 have limited adress we need a new one with this we can do faster routung beter salability

Purpose

  1. Fixes: Not enough IPv4 addresses

  2. Connects: Domain → IPv6 address

  3. Result: Website works on modern networks

4.CNAME record

it make one domain name points to anothrt domain name insatead of ip adress

in above example of AAAA we discuss of a myshop.in what is www.myshop.com points to myshop.in

in whih www.myshop.com is nickname

myshop.com is real name

heres what happen

browser ask dna where is www.myshop.com

dns replies its just a false name go for myshop.com

browser ask again where is shop.com

dns replies IP is 103.45.22.10

now browser connect to server

website open

Purpose

  1. Fixes: Multiple names for same site

  2. Connects: Name → Name

  3. Result: www and non-www work together

5.MX Record

stand for mail exchange as it name suggest mail, it is a record that tell internet which mail server whould receive emai for your domain

eg you need to sen mail to Dushyant’s house but he has 2 mail room

one for business and one for personal

MX recorder ddecides that usiness letter go to office mail room .

let us take ex of shop.com

you send mail to shop.com → goojle male server

now sending email:

sender main server ask dns who handle shop.com emails than dns say google mail service , now email is sent to google and you receive mail in gmail inbox

Purpose

  1. Fixes: Email delivery problem

  2. Connects: Domain → Mail server

  3. Result: Emails get delivered

6.TXT Record

in simle term you put board outesdie your house that this property belong to this person for public same as that TXT record is a public note attached to your domain

you claim this is my house and government gives you documentation and when inspector come he see it matxhed his document and confirm ownership

Purpose

  1. Fixes: Proving domain ownership / email trust

  2. Stores: Codes, SPF, DKIM, DMARC

  3. Result: Emails aren’t flagged as spam; services verify domain

how they collab for website

imagine a websiet is your house

Domain: myshop.com

you want peopl vist your website , send mais and verify your ownership

  1. NS Record say I know a guy who know a guy

    internet doesnt know who manages myshop.com how to fix it , ns record points to dns server in charge

  2. A/AAAA Record it says wheres the ouse ?

    browser does not know the sdress so dns tell browser server is at How all DNS records work together for one website

  3. CNAME Record just a alias name

    multiple name for one lae

    pointe www.myshop.com → myshop.in

  4. MX Record - where to deliver emails?

    points myshop.com → mail server

  5. TXT record → public note

    service neeed to verify thta it s reaching to correct person

    Simple Flow

    1. Browser wants website → asks NS → finds A/AAAA → connects → website loads

    2. Someone sends email → asks NS → finds MX → delivers → inbox receives

    3. Google wants verification → asks NS → finds TXT → confirms → done

we could have some doubt in

A vs CNAME

areasA RecordCNAME Record
points toIP address (numbers)Another domain name (a name)
pronblem fixmyshop.com → 103.45.22.10www.myshop.commyshop.com

NS vs MX

AspectNS RecordMX Record
Points toAuthoritative DNS serverMail server
Problem fixedInternet doesn’t know who manages this domainMail system doesn’t know where to deliver emails
ExampleI know a guy who knows a guyDeliver letters here

Whole dns setup look like