DEV Community

Cover image for From Domain to IP: Demystifying DNS Records in Minutes
swati goyal
swati goyal

Posted on

From Domain to IP: Demystifying DNS Records in Minutes

🧠 First: Big Picture

DNS is basically a huge phonebook:
πŸ‘‰ β€œHuman-readable name” β†’ β€œIP address”

Example:
quizmaker.co.in β†’ 104.18.2.119

But instead of just one mapping, DNS stores different types of records (RRs) for different purposes.


🧩 Key Terms (Super Important)

1. 🌐 Domain Name

A domain name is the main name registered on the internet.

πŸ‘‰ Example:
quizmaker.co.in

  • Think of it as your brand / root identity
  • Managed at domain level

2. 🏠 Hostname

A hostname is a specific machine/service under a domain.

πŸ‘‰ Examples:
www.quizmaker.co.in
api.quizmaker.co.in
relay1.main.quizmaker.co.in

πŸ‘‰ Structure:
[hostname].[domain]

So:

  • quizmaker.co.in β†’ domain
  • relay1.main.quizmaker.co.in β†’ hostname (specific server/service)

3. 🎯 IP Address

The actual address of a machine on the internet

πŸ‘‰ Example:
104.18.2.119

  • Computers talk using IPs, not names

4. πŸ” Canonical Name

β€œCanonical” = real/original name

A canonical name is the true hostname of a server.

πŸ‘‰ Used in CNAME records

Example:
relay1.main.quizmaker.co.in β†’ server1.primary.quizmaker.co.in

Here:

  • relay1.main.quizmaker.co.in = alias
  • server1.primary.quizmaker.co.in = canonical (real) name

πŸ”— Now Let’s Understand Each Record Type

πŸ…°οΈ A Record (Most Important)

πŸ‘‰ Maps hostname β†’ IP address

(A, relay1.main.quizmaker.co.in, 104.18.2.119)

Meaning:

  • Hostname: relay1.main.quizmaker.co.in
  • IP: 104.18.2.119

πŸ“Œ This is what ultimately lets your browser connect


🟑 NS Record (Name Server)

πŸ‘‰ Tells: β€œWho is responsible for this domain?”
Maps domain name β†’ hostname

(NS, quizmaker.co.in, relay1.main.quizmaker.co.in)

Meaning:

  • Domain: quizmaker.co.in
  • Hostname: relay1.main.quizmaker.co.in

πŸ“Œ Used during DNS lookup process


πŸ” CNAME Record (Alias)

πŸ‘‰ Maps alias hostname β†’ real (canonical) name

(CNAME, relay1.main.quizmaker.co.in, server1.primary.quizmaker.co.in)

Meaning:

  • Alias: relay1.main.quizmaker.co.in
  • Real server: server1.primary.quizmaker.co.in

πŸ“Œ Then DNS will do:
relay1.main.quizmaker.co.in β†’ 104.18.2.119 (via A record)
server1.primary.quizmaker.co.in β†’ 104.18.2.119 (via A record)

So CNAME = indirection layer


πŸ“§ MX Record (Mail Server)

πŸ‘‰ Tells where emails should go

(MX, mail.quizmaker.co.in, mailserver1.backup.quizmaker.co.in)

Meaning:

  • Email domain: mail.quizmaker.co.in
  • Mail server: mailserver1.backup.quizmaker.co.in

πŸ“Œ Used by email systems (SMTP)


βš–οΈ Differences (Crystal Clear)

Concept Meaning Example
Domain Name Root identity quizmaker.co.in
Hostname Specific service relay1.main.quizmaker.co.in
Canonical Name Real/original hostname server1.primary.quizmaker.co.in
IP Address Machine address 104.18.2.119

πŸ”„ End-to-End Example (Putting It All Together)

Let’s say you type:
https://quizmaker.co.in

DNS might do:

CNAME:
quizmaker.co.in β†’ server1.primary.quizmaker.co.in

A record:
server1.primary.quizmaker.co.in β†’ 104.18.2.119

Browser connects to:
104.18.2.119


🧠 Intuition (Real-world analogy)

Think of it like this:

  • Domain name = Company name
  • Hostname = Specific office
  • Canonical name = Official registered office
  • IP address = GPS coordinates

CNAME is like:
πŸ‘‰ β€œThis office is actually handled by another main office”


⚑ Key Takeaways

  • Domain = top-level identity
  • Hostname = specific service under domain
  • Canonical name = actual server name (used in CNAME)
  • IP address = real machine location
  • A record = final step (name β†’ IP)
  • CNAME = alias layer (name β†’ name β†’ IP)

πŸ“– Want a better reading experience?

πŸ‘‰ Visit the full blog here: https://quizmaker.co.in/creators/@swati_goyal_911/blog/from-domain-to-ip-demystifying-dns-records-in-minutes

Top comments (0)