Skip to main content

What is DNS? 🌐

DNS (Domain Name System) is the internet's phone book that translates human-readable domain names into IP addresses that computers understand.

Everyday Analogy​

DNS is like a phone book πŸ“ž

Without phone book:
"Call 010-1234-5678..." β†’ Hard to remember πŸ˜“

With phone book:
Search "John Doe" β†’ Phone book provides number
β†’ Automatically connects! βœ…

DNS works the same way!

Without DNS:
"Connect to 192.168.1.1..." β†’ Impossible to remember πŸ˜“

With DNS:
Type "google.com" β†’ DNS provides 172.217.175.46
β†’ Automatically connects! βœ…

How DNS Works​

Basic Process​

1. Browser β†’ DNS Server: "What's google.com's IP?"
2. DNS Server queries hierarchy:
Root DNS β†’ TLD DNS (.com) β†’ Authoritative DNS
3. DNS Server β†’ Browser: "It's 172.217.175.46"
4. Browser connects to 172.217.175.46 βœ…

DNS Record Types​

A Record: Domain β†’ IPv4

example.com β†’ 192.168.1.1

CNAME Record: Alias β†’ Domain

www.example.com β†’ example.com

MX Record: Mail server

example.com β†’ mail.example.com

DNS Caching​

1. Browser cache β†’ Fastest (1ms)
2. OS cache β†’ Very fast (5ms)
3. Router cache β†’ Fast (10ms)
4. ISP DNS cache β†’ Normal (50ms)
5. Actual DNS query β†’ Slow (200ms+)

TTL (Time To Live): How long to cache

TTL: 3600 β†’ Cache for 1 hour

Public DNS Servers​

Google DNS:

Primary: 8.8.8.8
Secondary: 8.8.4.4
β†’ Fast and reliable

Cloudflare DNS:

Primary: 1.1.1.1
Secondary: 1.0.0.1
β†’ Fastest speed
β†’ Privacy focused

DNS Security​

DNS Spoofing​

Hackers manipulate DNS responses to redirect users to fake sites.

Defense: DNSSEC (DNS Security Extensions)

  • Encrypts and verifies DNS responses

DNS over HTTPS (DoH)​

Encrypts DNS queries via HTTPS
β†’ ISPs and hackers can't see your queries
β†’ Privacy protection πŸ”’

Troubleshooting​

Website won't load?

  1. Flush DNS cache:
# Windows
ipconfig /flushdns

# Mac
sudo dscacheutil -flushcache

# Linux
sudo systemd-resolve --flush-caches
  1. Change DNS server to Google DNS (8.8.8.8)

  2. Check with nslookup:

nslookup google.com

FAQ​

Q: How long does DNS lookup take? A:

  • Cache hit: 1-10ms (very fast)
  • Cache miss: 50-200ms (normal)
  • Slow: 500ms+ (ISP DNS issues)

Q: Why change DNS servers? A:

  • Speed: Google DNS is faster than ISP DNS
  • Reliability: Bypass ISP DNS failures
  • Security: Block malicious sites
  • Privacy: Use DoH/DoT

Q: Why doesn't domain change apply immediately? A: DNS propagation time - Usually 24-48 hours for worldwide distribution.

Summary​

Remember:

  • DNS = Domain β†’ IP address translation
  • google.com β†’ 172.217.175.46
  • Caching provides fast speed
  • Public DNS (8.8.8.8) recommended
  • DNSSEC, DoH enhance security

DNS lets us visit websites with meaningful names instead of numbers! 🌐