TechFedd LogoTechFedd

How DNS Works 🔥

The System Design Newsletter

The System Design Newsletter

Neo Kim • Published about 1 month ago • 1 min read

Read Original
How DNS Works 🔥

1. Executive Summary
DNS (Domain Name System) servers translate human-readable domain names into machine-readable IP addresses, enabling internet communication. They operate through a hierarchical, distributed system involving root, TLD, and authoritative servers, with caching to improve efficiency. DNS queries follow a recursive or iterative resolution process, and various record types (A, CNAME, MX, etc.) serve specific functions.

2. Core Technical Concepts/Technologies

  • DNS (Domain Name System)
  • IP address resolution
  • DNS hierarchy (root, TLD, authoritative servers)
  • Recursive vs. iterative queries
  • DNS record types (A, CNAME, MX, TXT, NS)
  • Caching and TTL (Time to Live)

3. Main Points

  • DNS Purpose: Maps domain names (e.g., google.com) to IP addresses (e.g., 142.250.190.46).
  • Hierarchy:
    • Root servers: Direct queries to TLD servers (e.g., .com, .org).
    • TLD servers: Point to authoritative servers for specific domains.
    • Authoritative servers: Store the domain’s DNS records.
  • Query Process:
    • Recursive: Resolver fetches the answer on behalf of the client.
    • Iterative: Resolver queries servers step-by-step until resolution.
  • DNS Records:
    • A: IPv4 address.
    • AAAA: IPv6 address.
    • CNAME: Alias for another domain.
    • MX: Mail server address.
    • TXT: Text metadata (e.g., SPF records).
  • Caching: DNS resolvers cache responses to reduce latency (TTL dictates cache duration).

4. Technical Specifications/Examples

  • Example DNS query flow:
    1. User requests example.com.
    2. Recursive resolver queries root → TLD (.com) → authoritative server.
    3. Authoritative server returns the A record (93.184.216.34).
  • Sample DNS records:
    example.com.    A     93.184.216.34
    www.example.com. CNAME example.com.
    example.com.    MX    10 mail.example.com.
    

5. Key Takeaways

  • DNS is critical for internet functionality, translating domains to IPs.
  • Uses a distributed, hierarchical system for scalability and reliability.
  • Caching and TTL optimize performance and reduce server load.
  • Different record types serve distinct purposes (e.g., MX for email).
  • Recursive resolvers simplify queries for end users.

6. Limitations/Caveats

  • DNS caching can delay updates (propagation depends on TTL).
  • Vulnerable to attacks like DNS spoofing (DNSSEC mitigates this).
  • Complex setups (e.g., load balancing) may require advanced record configurations.

#70: Distributed Hierarchical Database for 5.35B Users (2 Minutes)

This article was originally published on The System Design Newsletter

Visit Original Source