Core Module
12 min forge

DNS (Domain Name System)

Master the phonebook of the internet. Learn how human-readable names are translated into IP addresses.

πŸ“– DNS: Domain Name System

DNS is the system that translates human-readable domain names (like google.com) into machine-readable IP addresses (like 142.250.190.46).

πŸ’‘ The Logic (ELI5)

Think of your Smartphone Contacts:

  1. You want to call "Mom."
  2. Your phone doesn't know what "Mom" is.
  3. It looks up "Mom" in your Contact List (DNS).
  4. It finds her phone number: +1 555-123-4567.
  5. Your phone dials the number, connecting you to her phone.

πŸ” The Deep Dive

How the lookup works

  1. Local Cache: Your browser/OS checks if it already knows the IP.
  2. Recursive Resolver: Usually your ISP's server. It starts the multi-step journey.
  3. Root Nameserver: Points to the Top-Level Domain (TLD) server (like .com).
  4. TLD Nameserver: Points to the Authoritative Nameserver for the specific domain.
  5. Authoritative Nameserver: The final source of truth that says "Yes, google.com is at IP X."

DNS Records to Know

  • A Record: Maps a name to an IPv4 address.
  • AAAA Record: Maps a name to an IPv6 address.
  • CNAME: Maps one name to another name (Alias).
  • MX Record: Tells the internet where to send emails for that domain.

🎯 Interview Pulse

Use Case: Load Balancing (DNS Round Robin)

Did you know DNS can act as a simple Load Balancer? You can list 5 different IP addresses for the same www.myapp.com. The DNS server will rotate through them, sending users to different servers.

The "Latency" Cost

DNS lookups take time (sometimes 100ms+). This is why browsers and CDNs cache DNS results heavily. Keyword: TTL (Time To Live). This tells the internet how long to cache a DNS record before asking for it again.

Common Question

"What happens if I change my DNS today?" Answer: DNS Propagation. It can take up to 48 hours for the new IP to reach every server and user on Earth because of all the different layers of caching. 🌐