DEV Community

Rajat Yadav
Rajat Yadav

Posted on

DNS & DNS Record Types Explained

When You Type autmnit.github.io, How Does Your Browser Know Where It Lives?

When you enter:

autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

into your browser, something interesting happens behind the scenes.

Your browser doesn’t understand names like humans do.
It only understands IP addresses numbers like:

203.0.113.10
Enter fullscreen mode Exit fullscreen mode

So the real question is:

How does the browser convert a name into a number?

That translation is handled by something called DNS.


What Is DNS? (The Internet’s Phonebook)

Let’s keep it very simple.

The internet runs on IP addresses, but humans prefer names.

Instead of remembering:

203.0.113.10
Enter fullscreen mode Exit fullscreen mode

we type:

autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

DNS (Domain Name System) is the system that converts:

Name → IP address
Enter fullscreen mode Exit fullscreen mode

You can think of DNS like your phone contacts.

You tap on “Mom”, but your phone actually dials a number.
You don’t see the number — but it’s there.

Same thing here.


Simple Flow Diagram

You type: autmnit.github.io

Browser → DNS: "What is the IP of autmnit.github.io?"

DNS → "It is 203.0.113.10"

Browser → Connects to 203.0.113.10
Website loads.
Enter fullscreen mode Exit fullscreen mode

That’s DNS in action.


Why DNS Records Are Needed

DNS is not just one big list.

It’s more like a structured database with different types of records, and each type answers a different question.

For example:

  • Where is the website hosted?
  • Where should emails be delivered?
  • Who is responsible for managing this domain?
  • Is this domain verified with Google or some service?

Each of these has a specific DNS record type.

One domain → Many records.

Just like one contact in your phone can have:

  • Mobile number
  • Office number
  • Email
  • Notes

A domain can have:

  • A record
  • AAAA record
  • CNAME
  • MX
  • NS
  • TXT
  • And more

Let’s understand them slowly, one by one.


NS Record – Who Is Responsible for This Domain?

NS stands for Name Server.

An NS record answers this question:

“Who is managing the DNS for this domain?”

It does not tell the IP address of the website.

Instead, it tells the world:

“If you want DNS information about autmnit.github.io, ask these servers.”

Example (conceptually):

autmnit.github.io
NS → ns1.dns-provider.com
NS → ns2.dns-provider.com
Enter fullscreen mode Exit fullscreen mode

That means:

All DNS questions should go to those name servers.


Simple NS Diagram

Internet: "Where do I ask about autmnit.github.io?"

Answer: "Ask ns1.dns-provider.com"
Enter fullscreen mode Exit fullscreen mode

Think of it like paperwork.

NS = the office that manages all the records.


A Record – Name → IPv4 Address

This is one of the most important records.

An A record maps a domain name to an IPv4 address.

Example:

autmnit.github.io → 203.0.113.10
Enter fullscreen mode Exit fullscreen mode

When your browser asks:

“Where is autmnit.github.io?”

The A record answers:

“It’s at 203.0.113.10.”


Diagram for A Record

autmnit.github.io
        ↓
   203.0.113.10
Enter fullscreen mode Exit fullscreen mode

That’s it. Direct mapping.

If you remember just one DNS record, this is usually the one beginners think about.


AAAA Record – Name → IPv6 Address

An AAAA record works just like an A record.

But instead of IPv4, it maps to IPv6.

IPv6 addresses look like:

2001:db8:85a3::8a2e:370:7334
Enter fullscreen mode Exit fullscreen mode

So:

autmnit.github.io → 2001:db8:85a3::8a2e:370:7334
Enter fullscreen mode Exit fullscreen mode

You don’t need to go deep into IPv6 right now.

Just remember:

A     = IPv4
AAAA  = IPv6
Enter fullscreen mode Exit fullscreen mode

Same purpose, different address type.


CNAME Record – One Name Points to Another Name

CNAME stands for Canonical Name.

It does NOT point to an IP.

It points to another domain name.

Example:

www.autmnit.github.io → autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

This means:

“To find www.autmnit.github.io, just look up autmnit.github.io.”


CNAME Diagram

www.autmnit.github.io
        ↓
autmnit.github.io
        ↓
203.0.113.10
Enter fullscreen mode Exit fullscreen mode

So CNAME is like a nickname.

Important beginner confusion:

A vs CNAME

A record:

Name → IP directly
Enter fullscreen mode Exit fullscreen mode

CNAME:

Name → Another name
Enter fullscreen mode Exit fullscreen mode

Also:

  • A CNAME cannot point to an IP.
  • Usually a domain has either A or CNAME for the same name, not both.

MX Record – How Emails Find the Mail Server

MX stands for Mail Exchange.

It answers this question:

“Where should emails for this domain be delivered?”

Example:

autmnit.github.io → MX → mail.autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

Now imagine someone sends:

hello@autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

The sending mail server asks DNS:

“Where do I send mail for autmnit.github.io?”

DNS replies:

“Send it to mail.autmnit.github.io.”

Then DNS looks up:

mail.autmnit.github.io → 203.0.113.20
Enter fullscreen mode Exit fullscreen mode

And the email gets delivered.


Email Flow Diagram

Email sent to: hello@autmnit.github.io

Mail server → DNS: "Where to deliver?"

DNS → MX: mail.autmnit.github.io
DNS → A: 203.0.113.20

Mail server → connects to 203.0.113.20
Email delivered.
Enter fullscreen mode Exit fullscreen mode

NS vs MX (Common Confusion)

NS:

Who manages DNS for this domain?

MX:

Where should emails go?

They solve completely different problems.


TXT Record – Extra Info and Verification

TXT records store text information.

They are widely used for:

  • SPF (which servers can send email)
  • DKIM / DMARC (email authentication)
  • Domain verification (Google, AWS, etc.)

Example:

autmnit.github.io → TXT → "v=spf1 include:_spf.google.com ~all"
Enter fullscreen mode Exit fullscreen mode

TXT records don’t route traffic.

They add rules, proof, or verification.

Think of them like sticky notes attached to your domain.


How All Records Work Together (Complete Setup Example)

Let’s imagine a full setup for:

autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

Example DNS Structure

1. NS Records

NS → ns1.dns-provider.com
NS → ns2.dns-provider.com
Enter fullscreen mode Exit fullscreen mode

These manage everything.


2. A Record (Website)

autmnit.github.io → 203.0.113.10
Enter fullscreen mode Exit fullscreen mode

Website lives here.


3. AAAA Record (Optional)

autmnit.github.io → 2001:db8:85a3::8a2e:370:7334
Enter fullscreen mode Exit fullscreen mode

IPv6 version.


4. CNAME (www version)

www.autmnit.github.io → autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

Alias for main domain.


5. Mail Server Setup

mail.autmnit.github.io → 203.0.113.20
autmnit.github.io → MX → mail.autmnit.github.io
Enter fullscreen mode Exit fullscreen mode

Emails delivered correctly.


6. TXT Records

TXT → SPF rule
TXT → Domain verification code
Enter fullscreen mode Exit fullscreen mode

Security and verification handled.


Complete Website Loading Flow

When you open autmnit.github.io

Browser → DNS: "IP of autmnit.github.io?"

DNS:
   NS → Responsible name server
   A  → 203.0.113.10

Browser → Connects to 203.0.113.10
Website loads.
Enter fullscreen mode Exit fullscreen mode

When someone sends email

Mail server → DNS: "MX for autmnit.github.io?"

DNS:
   MX → mail.autmnit.github.io
   A  → 203.0.113.20

Mail server → Connects to 203.0.113.20
Email delivered.
Enter fullscreen mode Exit fullscreen mode

Quick Recap of All Records

Record What It Solves Simple Meaning
NS Who manages DNS? Official DNS authority
A Where is website (IPv4)? Name → IPv4
AAAA Where is website (IPv6)? Name → IPv6
CNAME Alias for another name Nickname
MX Where do emails go? Mail server
TXT Extra info & verification Notes & rules

Final Thoughts

DNS sounds complex at first, but honestly it’s just:

  • A system that converts names into IP addresses
  • A set of small records, each solving one specific problem

If you remember:

A / AAAA → website location
CNAME → alias
MX → email routing
NS → who manages DNS
TXT → extra rules and verification
Enter fullscreen mode Exit fullscreen mode

Then you already understand DNS better than many beginners.

From here, the best thing you can do is:

Open your domain DNS settings and just observe each record type.
Slowly it stops feeling like magic and starts feeling like logic.

And once that happens, you’re in control.

Happy learning guys..

Top comments (0)