DEV Community

Cover image for DNS Explained in very simple words(For Everyone)
Debashis Das
Debashis Das

Posted on

DNS Explained in very simple words(For Everyone)

If you heard about DNS or Domain Name System and want to know the basic overview of how exactly DNS works, then dont worry, i will explain it to you in a very simple term, not with handy word.

So Now Let's start with the simple question.

How does your browser know where a website lives?

When you type:


πŸ‘‰ google.com
Enter fullscreen mode Exit fullscreen mode

Your browser is actually confused πŸ€”πŸ™„πŸ˜΅
Because computers do not understand names like "google", "facebook", "instagram" etc.

Computers only understnad numbers.

So someone has to tell the browser:

"Hey, google.com live at this number"

That "someone" is DNS.


What DNS Really Is (No Tech Meaning):

DNS is like the phonebook of the internet.

In your phone:

  • You save names like (Mom, Dad, Brother, Friends, Ofiice)
  • But calling happens using a phone number

On the internet:

  • You type a website name
  • DNS finds the number
  • Browser goes there for lookup

Without DNS, the internet would look like this:


Type 142.250.182.14 to open 'Google'
Enter fullscreen mode Exit fullscreen mode

And nobody wants that to remember the whole number.
What if we have some tool that remember those large number for us,it's kind of a middleware.And that's the reason why DNS plays a important role for us to find website actual location.


Why DNS Record Exist

DNS record are just small pieces of information that answer different questions.

Like:

  • Where is this Websites?
  • Who is in charge of this domain?
  • Where should email go?
  • Is this domain trusted?

Instead of putting everything in one place, DNS uses different record, each with one clear job.


NS Record-Who is Responsible for This Website?

Imagine an apartment building 🏒
You don't ask any random people about a flat-you go to the main office.

NS record is that main office.

It tells the internet:

"Ask this company for all information about this domain."

So NS record answers:

  • Who manages this website?
  • Who has the authority?

Without NS:

  • Internet would not know where to ask questions and to whome.

A Record- Where Is the Website?

This is the most important record.
A Record tells the exact address of the website.
Think of it like:

  • House name -> House number

Example:


example.com -> 93.128.332.34
Enter fullscreen mode Exit fullscreen mode

Your browser:

  • Find this number
  • Goes direct to the server with the help of that number
  • And finally load the website for us in the browser

Simple and direct.


AAAA Record - Same Job, Newer System

AAAA record does the same thing as A record.
The only differece:

  • A record -> Old type address
  • AAAA record -> new type address

You don't need to worry much about it.
Just remember:

A and AAAA both tell where the website lives.


CNAME Record - Another Name for the Same Place

Something a place has two names.

Example:

  • "Main street shop"
  • "MS Shop"

Both go to the CNAME does.

Example:


www.example.com -> example.com
Enter fullscreen mode Exit fullscreen mode

This means:

  • www.example.com is just another name
  • Real website is example.com

Easy difference to remember:

  • A Record -> name to number [google.com -> 123.652.88.90]
  • CNAME -> name to name [it's like giving someone to a nickname]

MX Record - How Emails Know Where to Go

Now let's talk about emailπŸ“§
When someone sends:

hello.example.com
Enter fullscreen mode Exit fullscreen mode

The internet asks:

"Where should i deliver this email?"

The answer comes from the MX record.The MX is like a post office address.
It btells:

  • Which mail server recieves emails
  • For that domain

No MX record = No email delivery.


TXT Record - Extra Notes and Proof

TXT records are like stricky notes attached to a domain.
They arev used to:

  • Prove ownership
  • Keeps email safe
  • Verify services

Example:

  • Google asks: "Is this your domain?"
  • You add a TXT record
  • Google checks it
  • Done βœ…

TXT records don't affect websites directly -- they help in the background.

How Everything Works Together (One simple Story)
Let's say someone opens your website.

Step-by-step:

  1. Browser looks for NS
    -> Who controls this domain?

  2. DNS server gives A / AAAA
    -> Here is the website address

  3. If www is used, CNAME helps
    -> Redirects to main name

  4. If someone sends email, MX helps
    -> delivers email properly

  5. TXT keeps things verified and safe

All Records work together like a team.


One Complete DNS Setup (Easy View)

NS    -> Who manage the domain
A     -> WEbsite address
AAAA  -> Newer website address
CNAME -> Another name
MX    -> Email delivery
TXT   -> Proof and Security
Enter fullscreen mode Exit fullscreen mode

Final Words (Very important)

DNS sounds scary only because of it's name.

But in reality, its just:

A system that helps names find the right place.

If you understand Phonebook, House address and Post office, then you already understand DNS.

Top comments (0)