Skip to Content
Go Realm v1 is released 🎉
System DesignDomain Name SystemDNS Basic

🚀 DNS BASICS

📘 SESSION OBJECTIVES

  • Domain āϕ⧀
  • Subdomain āϕ⧀
  • TLD, gTLD, ccTLD
  • Registry vs Registrar vs Registry Operator
  • Nameserver āϕ⧀
  • DNS Zone & Zone File
  • A, AAAA, CNAME, MX, TXT, NS, PTR, SRV, SOA āϰ⧇āĻ•āĻ°ā§āĻĄ
  • DNS propagation āϕ⧀
  • google.com / facebook.com / mydomain.com āĻĻāĻŋāϝāĻŧ⧇ āĻŦāĻžāĻ¸ā§āϤāĻŦ āωāĻĻāĻžāĻšāϰāĻŖ
  • Exercises after each section
  • ASCII diagrams for clear understanding

⭐ TOPIC 1: Domain vs Subdomain

🔹 What is a Domain?

Domain āĻšāϞ⧋ IP address āĻāϰ āĻŽāĻžāύ⧁āώ⧇āϰ āϜāĻ¨ā§āϝ āĻŦā§‹āĻāĻžāϰ āĻŽāϤ⧋ āύāĻžāĻŽāĨ¤

Example:

google.com → 142.250.190.14 facebook.com → 157.240.22.35

āĻāϟāĻžāχ DNS-āĻāϰ āĻŽā§‚āϞ āĻ•āĻžāϜ: Name → IP Mapping


🔹 What is a Subdomain?

Domain-āĻāϰ āφāϗ⧇ āϝ⧇āϕ⧋āύ⧋ prefix āĻ…āĻ°ā§āĻĨāĻžā§Ž āĻ…āĻ‚āĻļāϕ⧇ Subdomain āĻŦāϞāĻž āĻšā§ŸāĨ¤

Example:

mail.google.com docs.google.com developers.facebook.com api.mydomain.com

👉 Formula: đŸ”Ĩ

subdomain.domain.tld | domain.tld

🔹 Diagram: Domain vs Subdomain

+---------------------+ | google.com | +---------------------+ / | \ / | \ mail.google.com docs.google.com maps.google.com

đŸ”Ĩ Exercises

  1. āϤ⧋āĻŽāĻžāϰ āύāĻŋāĻœā§‡āϰ āĻĄā§‹āĻŽā§‡āχāύ āϧāϰ⧋: mydomain.com

    • ā§ŠāϟāĻŋ subdomain āϤ⧈āϰāĻŋ āĻ•āϰ⧇ āϞāĻŋāĻ–ā§‹
  2. āύāĻŋāĻšā§‡āϰ āϕ⧋āύāϟāĻŋ domain āϕ⧋āύāϟāĻŋ subdomain?

    • support.mydomain.com
    • mydomain.com
    • cdn.images.mydomain.com

⭐ TOPIC 2: TLD, gTLD, ccTLD

🔹 TLD (Top Level Domain)

āĻĄā§‹āĻŽā§‡āχāύ⧇āϰ āĻļ⧇āώ āĻ…āĻ‚āĻļ .com, .org, .net—āĻāϗ⧁āϞ⧋āχ TLDāĨ¤

Example:

google.com → .com = TLD gov.bd → .bd = TLD

🔹 gTLD (Generic TLD)

Generic āĻ…āĻ°ā§āĻĨ Category-Based:

Examples:

.com → Commercial .org → Organization .net → Network .xyz .dev .tech .app

🔹 ccTLD (Country Code TLD)

āĻĻ⧇āĻļāĻ­āĻŋāĻ¤ā§āϤāĻŋāĻ• TLD, āĻĻ⧁āχ āĻ…āĻ•ā§āώāϰ⧇āϰāĨ¤

Examples:

.bd → Bangladesh .in → India .uk → United Kingdom .us → USA

đŸ”Ĩ Exercises

  1. āύāĻŋāĻšā§‡āϰāϗ⧁āϞ⧋ āϕ⧋āύ āĻ—ā§āϰ⧁āĻĒ⧇āϰ TLD?

    • .ai
    • .bd
    • .io
    • .hospital
  2. āϤ⧁āĻŽāĻŋ āϕ⧋āύ ccTLD āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāϤ⧇ āϚāĻžāĻ“ āĻāĻŦāĻ‚ āϕ⧇āύ?


⭐ TOPIC 3: Registry vs Registrar vs Registry Operator

🔹 Registry

Domain database āĻĒāϰāĻŋāϚāĻžāϞāύāĻž āĻ•āϰ⧇āĨ¤

Examples:

  • Verisign → .com, .net
  • PIR → .org
  • Nominet → .uk

🔹 Registrar

āϝ⧇āĻ–āĻžāύ āĻĨ⧇āϕ⧇ āφāĻŽāϰāĻž Domain āĻ•āĻŋāύāĻŋāĨ¤

Examples:

  • Namecheap
  • GoDaddy
  • Google Domains
  • Hostinger
  • Porkbun

🔹 Registry Operator

āϝāĻžāϰāĻž backend infrastructure āϚāĻžāϞāĻžā§ŸāĨ¤


🔹 Diagram

Registry (Database) → Verisign Registrar (Store) → Namecheap User (Buyer) → You

đŸ”Ĩ Exercises

  1. .com āϕ⧇ manage āĻ•āϰ⧇?
  2. āϤ⧁āĻŽāĻŋ āϕ⧋āύ Registrar-āĻ domain āĻ•āĻŋāύ⧇āϛ⧋?

⭐ TOPIC 4: Nameserver āϕ⧀?

Nameserver āĻšāϞ⧋ DNS configuration āϏāĻ‚āϰāĻ•ā§āώāĻŖāĻ•āĻžāϰ⧀ ServerāĨ¤

Example:

ns1.cloudflare.com ns2.cloudflare.com ns1.hostinger.com ns2.hostinger.com

🔹 Nameserver āϕ⧀ āϰāĻžāϖ⧇?

  • Domain-āĻāϰ A record
  • CNAME
  • MX
  • TXT
  • NS
  • SOA

āĻāϗ⧁āϞ⧋ āĻŽāĻŋāϞ⧇āχ āĻāĻ•āϟāĻž Zone File āϤ⧈āϰāĻŋ āĻšā§ŸāĨ¤


🔹 Diagram (Simple)

Browser → Nameserver → Records → IP Address

⭐ TOPIC 5: DNS Zone & Zone File

🔹 DNS Zone

āĻāĻ•āϟāĻŋ Domain āĻāϰ DNS configuration āĻāϰ āĻāϞāĻžāĻ•āĻžā§Ÿ āϝāĻžāϕ⧇ Zone āĻŦāϞāĻž āĻšā§ŸāĨ¤

🔹 Zone File

āϏāĻŦ DNS record āϝ⧇āĻ–āĻžāύ⧇ āϏāĻ‚āϰāĻ•ā§āώāĻŖ āĻ•āϰāĻž āĻĨāĻžāϕ⧇āĨ¤


⭐ TOPIC 6: DNS RECORDS — (Most Important)

āύ⧀āĻšā§‡ āĻĒā§āϰāϤāĻŋāϟāĻŋ Record-āχ āĻŦāĻžāĻ‚āϞāĻž + Example + Purpose āϏāĻš āĻĻ⧇āĻ“ā§ŸāĻž āĻšāϞ⧋:


1ī¸âƒŖ A Record (IPv4 Address)

google.com → 142.250.190.14

2ī¸âƒŖ AAAA Record (IPv6 Address)

google.com → 2607:f8b0:4004:837::200e

3ī¸âƒŖ CNAME (Alias)

āĻāĻ•āϟāĻž Domain āϕ⧇ āĻ…āĻ¨ā§āϝ Domain āĻāϰ āĻĻāĻŋāϕ⧇ point āĻ•āϰāĻžāĨ¤

Example:

www.mydomain.com → mydomain.com

4ī¸âƒŖ MX Record (Mail Server)

Email āϕ⧋āĻĨāĻžā§Ÿ āϝāĻžāĻŦ⧇ āϏ⧇āϟāĻž āύāĻŋāĻ°ā§āϧāĻžāϰāĻŖ āĻ•āϰ⧇āĨ¤

Example:

mydomain.com → mail.protection.outlook.com

5ī¸âƒŖ TXT Record

Verification + SPF + Security

Examples:

google-site-verification=xxxx v=spf1 include:_spf.google.com ~all

6ī¸âƒŖ NS Record

Nameserver āύāĻŋāĻ°ā§āĻĻ⧇āĻļ āĻ•āϰ⧇āĨ¤


7ī¸âƒŖ PTR Record (Reverse DNS)

IP → Domain mapping Used in Email security.


8ī¸âƒŖ SRV Record

Service specific record Example:

_ldap._tcp.example.com

9ī¸âƒŖ SOA Record

Start of Authority – zone information

Contains:

  • admin email
  • serial number
  • refresh, retry, expire, TTL

⭐ TOPIC 7: DNS Propagation

DNS change (A, CNAME, MX, etc) āĻŦāĻŋāĻļā§āĻŦāĻŦā§āϝāĻžāĻĒā§€ āĻ›ā§œāĻžāϤ⧇ āϏāĻŽā§Ÿ āϞāĻžāϗ⧇āĨ¤

Usually: 5 minutes – 48 hours

Because:

  • Every ISP has caches
  • TTL respected

🔹 Diagram: Propagation

You Change DNS → Nameserver → ISP Cache → Worldwide Update

⭐ Real Examples (google.com, facebook.com)

🔹 google.com

dig google.com gives:

google.com. 300 IN A 142.250.190.14

🔹 facebook.com

facebook.com. 1800 IN A 157.240.22.35

🔹 mydomain.com Example

A: mydomain.com → 206.189.120.10 CNAME: www → mydomain.com MX: mail → mail.mydomain.com

đŸ”Ĩ SESSION 1 PRACTICAL EXERCISES

Exercise 1: Identify Parts

Break this domain:

cdn.images.blog.mydomain.com

Identify:

  • TLD
  • Domain
  • Subdomain
  • Root domain

✅ Solution

  • TLD: .com
  • Domain: mydomain.com
  • Subdomain: cdn.images.blog
  • Root domain: mydomain.com (domain + TLD)

Exercise 2: Create DNS Records

āϧāϰ⧋ āϤ⧋āĻŽāĻžāϰ domain: examplebd.com

āϤ⧁āĻŽāĻŋ āϤ⧈āϰāĻŋ āĻ•āϰāĻŦā§‡â€”

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

✅ Solution

āĻāĻ•āϟāĻŋ sample setup (dummy IP āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āĻšā§Ÿā§‡āϛ⧇, production-āĻ āύāĻŋāĻœā§‡āϰ server IP āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻŦ⧇):

  • A: examplebd.com → 206.189.120.10
    (IPv4 address)
  • AAAA: examplebd.com → 2001:db8::10
    (IPv6 address)
  • CNAME: www → examplebd.com
    (www subdomain root āĻĄā§‹āĻŽā§‡āχāύ⧇āϰ āĻĻāĻŋāϕ⧇ point āĻ•āϰāĻŦ⧇)
  • MX: examplebd.com → 10 mail.examplebd.com
    (priority 10, mail server)
  • TXT: "v=spf1 include:_spf.google.com ~all"
    (SPF / verification record āωāĻĻāĻžāĻšāϰāĻŖ)
  • NS: ns1.examplebd.com, ns2.examplebd.com
    (nameserver pair)

Exercise 3: Use Dig Command

Run these:

dig google.com dig facebook.com dig example.com MX dig example.com ANY

Explain:

  • TTL
  • IP
  • Nameserver
  • Resolved answer

✅ Solution

dig output-āĻ āϏāĻžāϧāĻžāϰāĻŖāĻ­āĻžāĻŦ⧇ āϝāĻž āĻĻ⧇āĻ–āĻŦ⧇:

  • TTL:
    āĻĒā§āϰāϤāĻŋāϟāĻŋ record āϞāĻžāχāύ⧇ name-āĻāϰ āĻĒāĻžāĻļ⧇ āĻĨāĻžāĻ•āĻž āϏāĻ‚āĻ–ā§āϝāĻž (seconds)āĨ¤
    āωāĻĻāĻžāĻšāϰāĻŖ: google.com. 300 IN A 142.250.190.14 → āĻāĻ–āĻžāύ⧇ 300 āĻšāϞ⧋ TTLāĨ¤
  • IP:
    A āĻŦāĻž AAAA record-āĻāϰ āĻļ⧇āώ⧇ āĻĨāĻžāĻ•āĻž addressāĨ¤
    āωāĻĒāϰ⧇āϰ example-āĻ: 142.250.190.14āĨ¤
  • Nameserver:
    AUTHORITY section / NS records-āĻ āϝ⧇ server āύāĻžāĻŽ āφāϏ⧇, āĻ…āĻĨāĻŦāĻž SERVER: āϞāĻžāχāύ⧇ āϝ⧇ nameserver āĻĨ⧇āϕ⧇ answer āĻāϏ⧇āϛ⧇āĨ¤
  • Resolved answer:
    ANSWER section-āĻāϰ āĻĒ⧁āϰ⧋ āϞāĻžāχāύāϟāĻžāχ actual DNS answer (record type + value)āĨ¤

Exercise 4: Spot the Error

āϧāϰ⧋ āϤ⧁āĻŽāĻŋ āϞāĻŋāϖ⧇āϛ⧋:

www A 127.0.0.1

But website load āĻšāĻšā§āϛ⧇ āύāĻžāĨ¤

Find reason:

  • Should be CNAME, not A?
  • Should point to root domain

✅ Solution

  • 127.0.0.1 āĻšāϞ⧋ local machine (localhost) āĻāϰ IP; public website āϏāĻžāϧāĻžāϰāĻŖāϤ āĻāχ IP-āϤ⧇ āĻĨāĻžāϕ⧇ āύāĻžāĨ¤
  • Public web server-āĻāϰ real IP use āĻ•āϰāĻž āωāϚāĻŋāϤ, āωāĻĻāĻžāĻšāϰāĻŖ:
    mydomain.com A 203.0.113.10
  • www āĻāϰ āϜāĻ¨ā§āϝ best practice:
    www CNAME mydomain.com
    āĻāĻŦāĻ‚ root domain-āĻ A record āĻĨāĻžāĻ•āĻŦ⧇āĨ¤
  • āĻāĻ–āύāĻ•āĻžāϰ config-āĻ www āφāϏāϞ⧇ āϤ⧋āĻŽāĻžāϰ āύāĻŋāĻœā§‡āϰ PC-āϤ⧇ point āĻ•āϰāϛ⧇, āϤāĻžāχ public internet āĻĨ⧇āϕ⧇ site open āĻšāĻšā§āϛ⧇ āύāĻžāĨ¤

🧠 END OF SESSION 1 SUMMARY (Cheat Sheet)

Domain → Name of the website Subdomain → prefix of domain TLD → Last part (.com/.bd) DNS → Converts Name to IP Nameserver → Stores DNS records A → IPv4 AAAA → IPv6 CNAME → Alias MX → Mail server TXT → Verification NS → Nameserver SOA → Zone info Propagation → DNS Update Time