18 min read Intermediate Lesson 27 of 30
Part 5 — Domains & Name Resolution

DNS: How Domain Names Turn into Server IP Addresses

Humans remember meaningful names like byteion.com, but internet routers only understand binary numbers and IP addresses. How does the global decentralized phonebook known as DNS (Domain Name System) resolve names into IP addresses in a fraction of a millisecond?

The Largest Distributed Phonebook on Earth

Do you memorize the 10-digit phone numbers of all your friends? No—you save their names in your contacts and tap 'Call'.

DNS provides the exact same service for the internet: you type a domain name, and DNS resolves the exact IP address in milliseconds behind the scenes.

1–4. The Origin of the Problem: Names vs Numbers

In the internet's infancy, the Stanford Research Institute maintained a single file called hosts.txt mapping every host name to an IP. But when millions of computers joined, a monolithic centralized file became completely untenable.

In 1983, Paul Mockapetris invented the Domain Name System (DNS)—a fully decentralized, hierarchical, and caching-friendly architecture that powers the global internet today.

5–9. The DNS Hierarchy: An Inverted Tree Structure

Domain names are structured hierarchically from right to left (e.g., academy.byteion.com.):

[ . ] ROOT ZONE (13 Logical Clusters) │ ┌─────────────────────────────┼─────────────────────────────┐ ▼ ▼ ▼ [ .com ] TLD [ .org ] TLD [ .bd ] ccTLD │ ▼ [ byteion.com ] Second-Level Domain (Authoritative Nameserver) │ ▼ [ academy.byteion.com ] Subdomain / Specific Host Record

10–16. The 4 Key DNS Nameservers

1. Recursive Resolver

Operated by your ISP or public services (1.1.1.1, 8.8.8.8)—this server traverses the global hierarchy to resolve the query on behalf of the client.

2. Root Nameserver

The top level of the internet hierarchy. It knows the addresses of the Top-Level Domain (TLD) servers (.com, .org, etc.).

3. TLD Nameserver

The registry for specific top-level domains. It delegates to the authoritative nameserver hosting the specific second-level domain.

4. Authoritative Nameserver

The official source of truth for the domain. It holds the authoritative DNS record containing the actual destination IP address (A Record).

17–24. Step-by-Step DNS Resolution Journey

  1. Local Cache Check: The browser and OS inspect their internal DNS cache for an existing recent entry.
  2. Query Resolver: If missed, the client queries the Recursive Resolver via UDP port 53.
  3. Ask Root: The resolver queries a Root server ──► Root replies: "Query the .com TLD server."
  4. Ask TLD: The resolver queries the .com TLD server ──► TLD replies: "Query Cloudflare's Authoritative Nameservers."
  5. Ask Authoritative: The Authoritative server returns the destination IP: 104.21.45.12.
  6. Return & Cache: The resolver returns the IP to the browser and caches it for future speed.

25–30. Key DNS Record Types

Record Type Purpose & Description Example
A Record Maps a domain name directly to a 32-bit IPv4 address byteion.com ──► 104.21.45.12
AAAA Record Maps a domain name to a 128-bit IPv6 address byteion.com ──► 2606:4700::1
CNAME Creates an alias mapping one domain to another domain www.byteion.com ──► byteion.com
MX Record Directs email traffic to the domain's mail servers mail.google.com (Priority 10)
TXT Record Arbitrary text used for domain verification, SPF & DKIM v=spf1 include:_spf.google.com ~all

31–39. DNS Caching, TTL & Encrypted DNS (DoH / DoT)

Time To Live (TTL)

Every DNS record specifies a TTL (e.g., 300 seconds or 5 minutes). Resolvers cache the record locally, only querying authoritative servers again after the TTL expires.

DNS over HTTPS (DoH)

Traditional DNS runs over unencrypted plaintext UDP, letting eavesdroppers track every visited website. Modern DoH and DoT protocols tunnel DNS queries inside encrypted HTTPS connections.

40–45. Master DNS Resolution Journey Diagram

[ CLIENT: Chrome Browser ] ──► "Where is byteion.com?" │ ▼ [ RECURSIVE RESOLVER (1.1.1.1) ] ──► 1. Query Root Server │ │ │ ◄── "Go to .com TLD Server" ───────┘ │ ├──► 2. Query .com TLD Server │ │ │ ◄── "Go to Cloudflare Authoritative Nameserver" │ ├──► 3. Query Cloudflare Authoritative Server │ │ │ ◄── "byteion.com IP is 104.21.45.12" (A Record) │ ▼ [ RETURN IP TO BROWSER ] ──► Browser connects to 104.21.45.12:443 (TCP + HTTPS)!

🧠 Key Takeaways

  • DNS Purpose: Translates human-readable domain names into machine-routable numeric IP addresses.
  • Hierarchy: Root (.) ──► TLD (.com) ──► Second-Level (byteion.com) ──► Subdomain (academy).
  • 4 Core Servers: Recursive Resolver, Root Nameserver, TLD Nameserver, and Authoritative Nameserver.
  • Core Records: A (IPv4), AAAA (IPv6), CNAME (Alias), MX (Mail), TXT (Authentication).
  • Caching & TTL: Multi-tiered local and intermediate caching drastically reduces global DNS query traffic.
  • DoH / DoT: Encrypts DNS requests to prevent ISP snooping and unauthorized query tampering.
🚀 Next Lesson

Lesson 28 — HTTP & HTTPS: How Browsers Talk to Web Servers

Discover HTTP methods, status codes, TLS 1.3 encryption, digital certificates, and how browsers parse HTML/CSS into pixel-perfect web pages.