Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

A beginner-friendly guide to understanding how different DNS records work together to help websites and email systems function

Updated
8 min read
DNS Record Types Explained
P
IT graduate 2024. Learning software and web development in public. Writing about bugs, fixes, small projects, useful tools, and lessons from building things step by step.

Introduction

How does a browser know where a website lives?

Jab tum google.com ya example.com type karte ho, browser ko kisi na kisi tarah us website ka actual location chahiye hota hai.

Browser domain name samajhta hai, but server tak pahunchne ke liye usse network address bhi chahiye hota hai.

Yahin DNS ka role aata hai.

Simple words mein:

DNS internet ka phonebook hai.

Jaise phonebook mein kisi naam ke saamne number hota hai, waise hi DNS domain ke saath useful network information attach karke rakhta hai.

Lekin DNS sirf ek number store karne wali system nahi hai.

Uske andar alag-alag record types hote hain, aur har record ek alag problem solve karta hai.


What DNS Is in Very Simple Terms

DNS ka full form hai Domain Name System.

Iska basic kaam hai human-friendly names ko machine-friendly information mein convert karna.

Example:

  • chaicode.com yaad rakhna easy hai

  • 142.250.xxx.xxx yaad rakhna difficult hai

Isliye hum domain names use karte hain.

Phir DNS background mein kaam karke browser ko batata hai ki website ya service actually kahan mil sakti hai.


Why DNS Records Are Needed

Ek domain ke baare mein sirf ek hi question nahi hota.

Different situations mein different information chahiye hoti hai.

For example:

  • website ka IPv4 address kya hai

  • website ka IPv6 address kya hai

  • mail kis server par aayegi

  • kaunse nameservers is domain ke responsible hain

  • kya ye name kisi aur name ka alias hai

  • verification ya extra text info kya hai

Agar ye sab information ek hi generic field mein store hoti, toh system confusing aur unreliable ho jaata.

Isliye DNS records exist karte hain.

Har record ek specific type ki information store karta hai.


Start with the Biggest Picture

Ek simple mental model yaad rakho:

  • NS batata hai domain ko kaun manage kar raha hai

  • A aur AAAA batate hain website kis address par mil sakti hai

  • CNAME batata hai ek naam doosre naam ki taraf point kar raha hai

  • MX batata hai email kahan deliver hogi

  • TXT extra info aur verification ke kaam aata hai

Yani DNS records milkar ek website ya domain ka poora ecosystem chalate hain.


NS Record: Who Is Responsible for This Domain?

Sabse pehle NS record ko samajhte hain.

NS ka matlab hota hai Name Server.

Yeh record batata hai:

is domain ke DNS records ko kaun manage kar raha hai

Example:

example.com -> ns1.provider.com
example.com -> ns2.provider.com

Simple real-life analogy:

Socho tumhe kisi ghar ka address chahiye, but tum pehle post office se poochte ho:

"Is area ki official registry kiske paas hai?"

NS record wahi direction deta hai.

Yeh directly website ka IP nahi batata.

Yeh batata hai ki correct DNS answers kis authority ke paas milenge.


A Record: Domain to IPv4 Address

A record sabse common DNS records mein se ek hai.

Iska kaam hai:

domain name ko IPv4 address se map karna

Example:

example.com -> 93.184.216.34

Real-life analogy:

Agar domain ek contact name hai, toh A record uska actual house address deta hai.

Yeh browser ko batata hai ki request kis IPv4 address tak bhejni hai.


AAAA Record: Domain to IPv6 Address

AAAA record bhi same problem solve karta hai, but IPv6 ke liye.

Example:

example.com -> 2606:2800:220:1:248:1893:25c8:1946

Isse aise samjho:

  • A record = older/common road address format

  • AAAA record = newer and larger address format

Beginner ke liye bas itna yaad rakhna enough hai:

  • A -> IPv4

  • AAAA -> IPv6


CNAME Record: One Name Pointing to Another Name

CNAME ka full form hai Canonical Name.

Yeh record ek naam ko kisi doosre naam ki taraf point karta hai.

Example:

www.example.com -> example.com

Yahan www.example.com ka apna direct IP nahi diya gaya.

Usse bola gaya:

"Is naam ko dekhna hai? Toh pehle doosre naam ko dekho."

Real-life analogy:

Jaise kisi contact ke saamne likha ho:

"Main address yahan nahi, uss doosre entry par dekho."

Common confusion: A vs CNAME

Yeh bahut important hai.

  • A record directly IP tak le jaata hai

  • CNAME direct IP nahi deta, kisi aur hostname tak le jaata hai

Yani:

  • A = final address

  • CNAME = redirect to another name


MX Record: How Email Finds Your Mail Server

Website chalana aur email chalana same cheez nahi hai.

Possible hai:

  • website ek server par ho

  • email kisi doosre mail provider par handle ho rahi ho

Yahin MX record ka use hota hai.

MX ka matlab hota hai Mail Exchange.

Yeh batata hai:

is domain ke emails kis mail server par deliver honge

Example:

example.com -> mail.example.com

Ya real services ke case mein:

  • Google Workspace

  • Zoho Mail

  • Outlook

Real-life analogy:

Ghar ka address alag ho sakta hai, but letters kisi special mailbox center par redirect ho sakte hain.

MX wahi mailbox routing system hai.

Common confusion: NS vs MX

Beginners kabhi-kabhi in dono ko mix kar dete hain.

  • NS batata hai domain ka DNS kaun manage kar raha hai

  • MX batata hai emails kis server par jayengi

Yeh dono bilkul alag jobs karte hain.


TXT Record: Extra Information and Verification

TXT record text-based information store karta hai.

Sunne mein simple lagta hai, but real world mein ye kaafi important hota hai.

Common uses:

  • domain verification

  • SPF

  • DKIM related setup

  • ownership proof

  • custom configuration values

Example:

v=spf1 include:_spf.google.com ~all

Real-life analogy:

Socho kisi ghar ke gate par ek note chipka ho:

"Ye address verify ho chuka hai" "Official mail rule ye hai" "Delivery instructions yahan dekho"

TXT record waise extra notes ki tarah kaam karta hai.


How These Records Work Together for One Website

Ab sabse important part.

Ek real domain usually ek hi record se kaam nahi chalata.

Socho example.com ka setup kuch aisa ho:

  • NS -> kaun DNS manage kar raha hai

  • A -> root domain website ka IPv4 address

  • AAAA -> same website ka IPv6 address

  • CNAME -> www.example.com ko example.com par point kar raha hai

  • MX -> email ko mail provider tak bhej raha hai

  • TXT -> verification and email safety rules store kar raha hai

Yani ek single domain ke andar website, aliases, email, aur verification sab ek saath chal rahe hote hain.

Yehi reason hai ki DNS ko sirf "domain to IP" kehna technically incomplete hota hai.


One Gentle Example

Chalo ek beginner-friendly example dekhte hain:

myportfolio.dev

Uska setup kuch aisa ho sakta hai:

  • NS records tell who controls the DNS

  • A record points myportfolio.dev to the hosting server

  • AAAA record supports IPv6 visitors

  • CNAME points www.myportfolio.dev to myportfolio.dev

  • MX sends emails to the mail provider

  • TXT proves domain ownership and stores mail verification text

Ab agar koi browser se site open kare, mail bheje, ya Google Search Console verification kare, alag-alag records ka role dikhai dega.


Common Beginner Confusions

A vs CNAME

  • A record IP deta hai

  • CNAME doosre hostname ki taraf point karta hai

NS vs MX

  • NS DNS authority batata hai

  • MX email routing batata hai

A vs AAAA

  • A = IPv4

  • AAAA = IPv6

Ye small differences later deployment mein big difference create karte hain.


Summary

  • DNS internet ka phonebook hai

  • DNS records isliye needed hain kyunki domain ke baare mein multiple types ki information store karni padti hai

  • NS batata hai domain ke DNS answers kaun manage karta hai

  • A aur AAAA website ko IP addresses se connect karte hain

  • CNAME ek naam ko doosre naam ki taraf point karta hai

  • MX email routing ke liye hota hai

  • TXT verification aur extra information ke liye hota hai

  • ek real website setup mein multiple DNS records milkar kaam karte hain


Final Thought

DNS tab zyada clearly samajh aata hai jab tum har record ko sirf definition ki tarah nahi, balki ek responsibility ki tarah dekhte ho.

Phir domain setup random settings ka collection nahi lagta.

Woh ek organized system lagta hai jahan har record apna kaam kar raha hota hai.


Continue Reading

Networking & Internet

Part 3 of 7

A beginner-friendly series on how the web actually works behind the scenes, covering network devices, DNS, TCP, UDP, cURL, and browser internals.

Up next

TCP Working: 3-Way Handshake & Reliable Communication

A beginner-friendly guide to how TCP establishes trust, sends data in order, and keeps communication reliable