đ 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
-
āϤā§āĻŽāĻžāϰ āύāĻŋāĻā§āϰ āĻĄā§āĻŽā§āĻāύ āϧāϰā§:
mydomain.com- ā§ŠāĻāĻŋ subdomain āϤā§āϰāĻŋ āĻāϰ⧠āϞāĻŋāĻā§
-
āύāĻŋāĻā§āϰ āĻā§āύāĻāĻŋ 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
-
āύāĻŋāĻā§āϰāĻā§āϞ⧠āĻā§āύ āĻā§āϰā§āĻĒā§āϰ TLD?
.ai.bd.io.hospital
-
āϤā§āĻŽāĻŋ āĻā§āύ 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
.comāĻā§ manage āĻāϰā§?- āϤā§āĻŽāĻŋ āĻā§āύ 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.142ī¸âŖ AAAA Record (IPv6 Address)
google.com â 2607:f8b0:4004:837::200e3ī¸âŖ CNAME (Alias)
āĻāĻāĻāĻž Domain āĻā§ āĻ āύā§āϝ Domain āĻāϰ āĻĻāĻŋāĻā§ point āĻāϰāĻžāĨ¤
Example:
www.mydomain.com â mydomain.com4ī¸âŖ MX Record (Mail Server)
Email āĻā§āĻĨāĻžā§ āϝāĻžāĻŦā§ āϏā§āĻāĻž āύāĻŋāϰā§āϧāĻžāϰāĻŖ āĻāϰā§āĨ¤
Example:
mydomain.com â mail.protection.outlook.com5ī¸âŖ TXT Record
Verification + SPF + Security
Examples:
google-site-verification=xxxx
v=spf1 include:_spf.google.com ~all6ī¸âŖ 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.com9ī¸âŖ 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.comIdentify:
- 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 ANYExplain:
- 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āĻŦāĻžAAAArecord-āĻāϰ āĻļā§āώ⧠āĻĨāĻžāĻāĻž 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.1But 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