SkillSprout
Chapter 3 · Lesson 1
Beginner
4 min read

What Is DNS and How Resolution Works

Overview

People remember names like example.com, but the network needs IP addresses. DNS is the internet's phone book that translates one into the other. This lesson shows who is asked, in what order, to get the answer.

Detailed Notes

What is DNS

DNS (Domain Name System) is a worldwide system that maps human-friendly domain names (www.example.com) to IP addresses (203.0.113.25). Looking up that address is called name resolution.

Think of your phone's contacts: you tap "Mum" instead of typing digits. DNS is the contacts list of the internet.

The problem it solves

From the previous chapter, packets are delivered by IP address. But:

  • Humans cannot remember numbers for every site.
  • A server's IP address can change (a move to a new machine or data centre). If users had typed raw IPs, every change would break them.

With DNS, the name stays the same while the address behind it can change freely.

How it works

A domain name is read right to left as a hierarchy: www . example . com . (an invisible root at the end). No single computer knows everything, so the work is split across several kinds of servers:

  • Recursive resolver: a helper, usually run by your internet provider or a public service. It does the searching on your behalf and remembers (caches) answers.
  • Root servers: know which servers handle each top-level ending (.com, .org).
  • TLD servers (top-level domain): know which servers handle each domain under their ending, e.g. everything in .com.
  • Authoritative servers: hold the real, final records for a domain. They are the source of truth for example.com.

Resolution steps when your browser needs www.example.com:

  1. The browser checks its own cache, then the operating system's cache.
  2. If unknown, it asks the recursive resolver.
  3. The resolver (if it has no cached answer) asks a root server: "Who handles .com?" and gets pointed to the TLD servers.
  4. It asks a TLD server: "Who handles example.com?" and gets the authoritative server.
  5. It asks the authoritative server: "What is the IP of www.example.com?" and gets 203.0.113.25.
  6. The resolver returns this to the browser and caches it. The browser connects to that IP.

DNS usually uses UDP on port 53 because the questions and answers are tiny and speed matters (as covered in the Network Essentials chapter).

A simple example

You want to call a friend whose number you do not have. You ask a helper (resolver). The helper asks the national directory ("who handles area code 080?"), then the area directory ("who has Priya's number?"), then reads you the number. Next time, the helper remembers it and answers instantly.

You can try it yourself:

bash
nslookup www.example.com

System design example

When a user opens your shop at shop.example.com, DNS is almost always the very first step before any request reaches your servers. If DNS is slow or down, users cannot reach you even though your servers are healthy.

Because the answer comes from a record you control, you can move your site to new servers by changing the record; users follow the name and never notice. Most companies rent a managed authoritative DNS service so that it stays available and fast worldwide.

Summary

  • DNS maps domain names to IP addresses.
  • The resolver does the legwork: root, then TLD, then authoritative server.
  • The authoritative server holds the real answer; everything else is a cache or a pointer.
  • Names stay stable while IP addresses can change.
  • If DNS fails, users cannot reach your site even if servers are fine.

Architecture Diagram

DNS resolution path
Architecture
Browserasks for the IP
Recursive Resolvercache
Root and TLD
Authoritative DNSA record + TTL

The resolver walks down the hierarchy and caches the answer.

  1. 1The browser asks the recursive resolver.
  2. 2The resolver asks root, then the TLD server.
  3. 3The authoritative server returns the IP address.
  4. 4The resolver caches it and answers the browser.

Common Interview Questions

Finished this lesson?

0 of 91 lessons done · 0% of the course