Packet.School
HomeLevelsSandboxFreeAbout
XP0
L3 · Protocols
Level 3
5 lessons
  • 01HTTP/HTTPS
  • 02How DNS Works?
  • 03DHCP
  • 04TCP vs UDP
  • 05Level 3 Quiz
Levels/L3 · Protocols/Lesson 02
Simulation · 02

How DNS Works?

DNS is the internet's phone book: it converts the domain names humans remember into the IP addresses machines use. You type `google.com`, DNS finds `142.250.185.78`.

Duration
3min
Level
L3
Type
Simulation
Progress
2/ 5

01Why DNS?

Which is easier to memorize?

  • 142.250.185.78
  • google.com

People like names, computers like numbers. DNS bridges the two — and without that bridge the web would be practically unusable.

02The DNS query process

When you type an address, the answer is searched for starting at the nearest place; if it isn't found, the chain extends upward:

  1. Browser cache — did you look this domain up just now?
  2. OS cache — does the operating system know the answer?
  3. Router cache — is it stored on your home router?
  4. ISP DNS (recursive resolver) — your provider goes looking on your behalf
  5. Root DNS — answers "who knows about .com?"
  6. TLD DNS — the .com servers say "that host knows example.com"
  7. Authoritative DNS — the domain's own server gives the real answer

On the way back, every layer caches the answer for its TTL (time to live) — which is why the second lookup is far faster.

Protocol detail
DNS queries use UDP port 53 by default — setting up a TCP connection isn't worth it for one question and one answer. For large responses (e.g. DNSSEC) it falls back to TCP.

03DNS record types

RecordDescriptionExample
AIPv4 addressexample.com → 93.184.216.34
AAAAIPv6 addressexample.com → 2606:2800:...
CNAMEAliaswww → example.com
MXMail servermail.example.com
TXTText infoDomain verification, SPF
NSAuthoritative serverns1.example.com

04Try it yourself

Query a real domain in the simulator below: watch which steps the query passes through, how the chain shortens on a cache hit, and what TTL does.

Sandbox · ProtocolDNS LookupStep through recursive resolution: play with cache hits, TTL, and record types.Open tool

05Summary

  • DNS = the distributed system that maps names to IPs
  • Answers are checked in caches first, then root → TLD → authoritative
  • TTL controls how long an answer stays cached
  • A records are IPv4, AAAA are IPv6, CNAME defines an alias
Previous
HTTP/HTTPS
Next
DHCP
On this page
  • Why DNS?
  • The DNS query process
  • DNS record types
  • Try it yourself
  • Summary
Packet.School

An open, interactive curriculum for computer networking.

v3.0 · MIT22 lessons live

Learn

  • Lessons
  • Sandbox
  • Levels
  • Free
  • About

Simulations

  • Packet Journey
  • DNS Lookup
  • DHCP Simulator
  • Subnet Calc
  • Network Builder
  • Terminal

Project

  • About
  • Changelog
  • GitHub
  • Contributing
  • Style guide

Newsletter

One short email when a new level ships. No tracking pixels.

© 2026 Packet.School — MIT licensedSupport with a coffeebuilt in the open