From Domain to IP: Demystifying DNS Records in Minutes | @swati_goyal_911 | QuizMaker

A concise guide to domain names, hostnames, canonical names, and IP addresses, and how DNS maps them using A, CNAME, NS, and MX records.

Read
10m
Type
Blog
By
@swati_goyal

Series or course

System Design Essentials: Core Building Blocks

🧠 First: Big Picture

DNS is basically a huge phonebook:

πŸ‘‰ β€œHuman-readable name” β†’ β€œIP address”

Example:

educative.io β†’ 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:

educative.io

2. 🏠 Hostname

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

πŸ‘‰ Examples:

www.educative.io
api.educative.io
relay1.main.educative.io

πŸ‘‰ Structure:

[hostname].[domain]

So:

3. 🎯 IP Address

The actual address of a machine on the internet

πŸ‘‰ Example:

104.18.2.119

4. πŸ” Canonical Name

β€œCanonical” = real/original name

A canonical name is the true hostname of a server.

πŸ‘‰ Used in CNAME records

Example:

educative.io β†’ server1.primary.educative.io

Here:

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

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

πŸ‘‰ Maps hostname β†’ IP address

(A, relay1.main.educative.io, 104.18.2.119)

Meaning:

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

🟑 NS Record (Name Server)

πŸ‘‰ Tells: β€œWho is responsible for this domain?”

(NS, educative.io, dns.educative.io)

Meaning:

πŸ“Œ This is used during DNS lookup process

πŸ” CNAME Record (Alias)

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

(CNAME, educative.io, server1.primary.educative.io)

Meaning:

πŸ“Œ Then DNS will do:

server1.primary.educative.io β†’ IP (via A record)

So CNAME = indirection layer

πŸ“§ MX Record (Mail Server)

πŸ‘‰ Tells where emails should go

(MX, mail.educative.io, mailserver1.backup.educative.io)

Meaning:

πŸ“Œ Used by email systems (SMTP)

βš–οΈ Differences (Crystal Clear)
ConceptMeaningExample
Domain NameRoot identityeducative.io
HostnameSpecific machine/serviceapi.educative.io
Canonical NameReal/original hostnameserver1.primary.educative.io
IP AddressMachine address104.18.2.119
πŸ”„ End-to-End Example (Putting It All Together)

Let’s say you type:

https://educative.io

DNS might do:

  1. CNAME:
educative.io β†’ server1.primary.educative.io
  1. A record:
server1.primary.educative.io β†’ 104.18.2.119
  1. Browser connects to:
104.18.2.119
🧠 Intuition (Real-world analogy)

Think of it like this:

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

⚑ Key Takeaways

Open on QuizMaker