Knowledge Guide
HomeSystem DesignDNS

Introduction to DNS

What is DNS (Domain Name System)?

DNS, or Domain Name System, is a system used to translate human-readable domain names (e.g., www.designgurus.com) into IP addresses (e.g., 198.47.25.1) that computers can understand. This translation process is crucial because computers and networking devices rely on IP addresses to identify and communicate with each other on the internet. In simple terms, DNS acts like a phonebook for the internet, allowing users to access websites using easy-to-remember domain names instead of having to memorize numeric IP addresses.

Purpose and Importance of DNS

The primary purpose of DNS is to make it easier for people to access websites and other online resources. By providing a human-readable naming system for computers and other devices connected to the internet, DNS enables users to navigate the internet using familiar and intuitive domain names.

DNS is essential for the smooth functioning of the internet. Some of its key benefits include:

DNS Components and Terminology

1. Domain names, TLDs (Top-Level Domains), and subdomains

2. DNS servers: Root, TLD, and Authoritative Name Servers

DNS
DNS

3. DNS resolvers

A DNS resolver is any component (software or hardware) responsible for translating a human-friendly domain name (like example.com) into the IP address that the computer needs to connect to (such as 93.184.216.34).

When you type a website address into your browser or click a link, your system relies on DNS resolvers to figure out the correct IP address. There are several types of DNS resolvers, each serving different roles in the DNS lookup process.

The DNS Lookup Process in Brief

Before diving into the types of DNS resolvers, it helps to have a high-level overview of the DNS lookup process:

  1. You request a domain name (e.g., example.com) from your computer or device.
  2. Your computer’s resolver (or stub resolver) sends the request to a DNS recursive resolver (often your ISP’s or a public DNS like Google’s 8.8.8.8).
  3. The recursive resolver checks if it already has the domain name’s IP address in its cache. If so, it returns it immediately.
  4. If not, the recursive resolver queries the root DNS servers, then the TLD (Top-Level Domain) DNS servers, then the authoritative DNS server for the domain, following DNS hierarchy.
  5. Once the IP address is found, the resolver returns it to your computer. Your computer can then contact the web server at that IP.

1. Stub Resolver

A stub resolver is the minimal DNS client software running on your device (laptop, smartphone, IoT gadget, etc.) that starts the DNS lookup process. It typically does not perform the full DNS query process by itself.

How It Works

Example

2. Recursive Resolver

A recursive resolver is a DNS server that actively performs the DNS query process on behalf of the client. It hunts down the IP address by querying multiple DNS servers until it gets the final answer.

How It Works

  1. The recursive resolver receives a request from a stub resolver (or another forwarder).
  2. It first checks its local cache to see if the requested domain’s IP address is stored there.
    • If found, it returns the cached answer immediately.
  3. If the record is not cached, the resolver queries the root DNS servers to learn which TLD server (e.g., .com, .org) to query next.
  4. It then queries the relevant TLD server to find the authoritative DNS server for the specific domain.
  5. Finally, it queries the authoritative server to obtain the required DNS records (e.g., the A record for IPv4).
  6. The resolved IP is cached for future requests and returned to the stub resolver.

Example

3. Caching-Only Resolver

A caching-only resolver is a type of DNS server whose primary function is to cache DNS query results and reuse them to speed up subsequent lookups. It does not host any DNS zones (i.e., it is not authoritative for any domain) and typically performs recursive lookups on behalf of clients.

How It Works

Example

4. Forwarder

A forwarder is a DNS server that forwards all queries (or queries that it cannot resolve locally) to another DNS server instead of performing the complete recursive resolution process itself.

How It Works

Example

5. Iterative (Non-Recursive) Resolver

Sometimes called a non-recursive resolver, an iterative resolver typically gives back partial results or referrals, instructing the client to continue the resolution process on its own.

How It Works

This type is less common for end-user devices; it is often used by authoritative DNS servers to direct queries up or down the DNS hierarchy.

Example

Visualizing the DNS Resolution Chain

Below is a simplified chart showing the typical path of a DNS query:

User's Device (Stub Resolver)
     |
     v
Recursive Resolver (Often ISP/ Public)
     |
     v
  Root Server
     |
     v
 TLD Server (.com, .net, etc.)
     |
     v
 Authoritative Server (example.com)
     |
     v
   IP Address

Putting It All Together

  1. Stub Resolver on your device:

    • Minimal functionality—just sends the query to a DNS server.
  2. Recursive Resolver (may also be a Caching-Only Resolver):

    • Receives queries from stub resolvers.
    • Looks up (recursively) the chain of DNS servers if not cached.
    • Caches the response for future requests.
  3. Forwarder:

    • A DNS server configured to pass queries on to another resolver rather than doing the full lookup.
    • Can also cache responses.
  4. Iterative (Non-Recursive) Resolver:

    • Responds with direct answers if known or references to other DNS servers (referrals), but doesn’t do recursion.

Real-World Example Scenario

  1. Your Laptop (Stub Resolver) is set to use 8.8.8.8 (Google DNS).
  2. You type www.example.com into your browser.
  3. The stub resolver on your laptop sends the DNS query to 8.8.8.8 (a Public Recursive Resolver).
  4. Google DNS checks its cache:
    • If www.example.com is cached, it returns the IP right away.
    • If not, it queries the root server, then .com TLD server, then the example.com authoritative server in turn.
  5. Once found, the IP address is cached in Google’s DNS servers and returned to your laptop’s stub resolver.
  6. Your laptop connects to the returned IP address, and the website loads.
🤖 Don't fully get this? Learn it with Claude

Stuck on Introduction to DNS? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **Introduction to DNS** (System Design) and want to truly understand it. Explain Introduction to DNS from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **Introduction to DNS** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **Introduction to DNS** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **Introduction to DNS** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes