How the Internet Works

Typetheory
Duration1.5 hours
PrerequisitesNone

Learning Objectives

By the end of this unit, you will be able to:

  • Explain how data travels across the internet
  • Understand DNS resolution and domain name lookups
  • Describe the HTTP request/response cycle
  • Use browser DevTools to inspect network traffic

Every time you type a URL into your browser and press Enter, a complex series of events unfolds in milliseconds. Understanding this process is fundamental to becoming a full-stack developer — it helps you debug issues, optimize performance, and design better applications.

The Internet vs. The Web

The Internet is the global network of interconnected computers. It's the infrastructure — cables, routers, servers, and protocols that allow machines to communicate.

The World Wide Web is a service that runs on top of the Internet. It's the collection of websites, pages, and resources accessible via HTTP/HTTPS.

Interactive: Internet vs The Web

THE WEB (HTTP/S)
Application Layer

Collection of websites, APIs, and resources accessed through browsers. Built on top of the Internet infrastructure.

WebsitesAPIsWeb Apps
↑ RUNS ON TOP OF ↑
THE INTERNET (INFRASTRUCTURE)
Network Layer

The global network of cables, routers, and servers. Supports multiple services beyond just the Web.

Email (SMTP)
File Transfer (FTP)
Streaming (RTMP)

IP Addresses

Every device connected to the internet has an IP address — a unique numerical identifier.

IPv4

The traditional format, consisting of four numbers (0-255) separated by dots:

192.168.1.1
142.250.80.46 (Google)

IPv6

A newer format with more addresses available:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

Think of it like this: IP addresses are like phone numbers for computers. Every device needs one to send and receive data.

IPv4 vs IPv6 comparison infographic
Figure 1: IPv4 vs IPv6 — Address Space Comparison

Domain Name System (DNS)

Humans don't remember IP addresses — we use domain names like google.com. The DNS translates human-readable domains into IP addresses.

DNS Resolution Process

Interactive: DNS Resolution

Looking up:glyphtic.com
Browser CacheChrome/Safari
OS CacheWindows/Mac/Linux
Router CacheHome Gateway
ISP ResolverISP / 8.8.8.8
  • Browser Cache — Checks if it knows the IP already
  • OS Cache — Operating system's DNS cache
  • Router Cache — Your home router's cache
  • ISP DNS Server — Your internet provider's DNS
  • Root DNS Server — Directs to .com TLD server
  • TLD Server (.com) — Directs to the domain's DNS
  • Authoritative DNS — Returns the final IP address

DNS Record Types

TypePurposeExample
AMaps domain to IPv4example.com142.250.80.46
AAAAMaps domain to IPv6example.com2001:db8::1
CNAMEAlias to another domainwww.example.comexample.com
MXMail serverexample.commail.google.com
TXTText records (verification)SPF, DKIM records
DNS Record Types Visual Guide
Figure 2: Common DNS Record Types and Their Functions

HTTP: The Language of the Web

HTTP (HyperText Transfer Protocol) is the protocol browsers and servers use to communicate. HTTPS is the secure version using TLS encryption.

HTTP Methods

MethodPurposeHas Body
GETRetrieve dataNo
POSTCreate new resourceYes
PUTUpdate entire resourceYes
PATCHPartial updateYes
DELETERemove resourceNo

HTTP Status Codes

RangeCategoryExamples
1xxInformational100 Continue
2xxSuccess200 OK, 201 Created, 204 No Content
3xxRedirection301 Moved Permanently, 304 Not Modified
4xxClient Error400 Bad Request, 401 Unauthorized, 404 Not Found
5xxServer Error500 Internal Server Error, 503 Service Unavailable

What Happens When You Visit a Website?

  • Step 1: DNS Lookup — Browser resolves the domain to an IP address
  • Step 2: TCP Connection — Browser establishes connection (SYN → SYN-ACK → ACK)
  • Step 3: TLS Handshake — For HTTPS, encryption is negotiated
  • Step 4: HTTP Request — Browser sends GET / HTTP/1.1 request
  • Step 5: Server Processing — Server processes and prepares response
  • Step 6: HTTP Response — Server sends back HTML, CSS, JS, assets
  • Step 7: Rendering — Browser parses, builds DOM, applies CSS, executes JS

Interactive: Page Load Timeline

DNS~50ms
TCP~20ms
TLS~30ms
Request~5ms
Process~200ms
Response~50ms
Render~100ms
Hover over a step to see details

Hands-On: Using Browser DevTools

Open your browser's DevTools (F12 or Cmd+Option+I) and navigate to the Network tab.

Exercise: Inspect a Request

  1. Open DevTools → Network tab
  2. Visit any website
  3. Click on the first HTML document request
  4. Explore: Headers tab, Preview tab, Response tab, Timing tab

Exercise: DNS Timing

  1. Look at the timing breakdown in the Network tab
  2. Identify: DNS Lookup, Initial Connection, SSL, Waiting (TTFB), Content Download

Key Takeaways

  1. The Internet is infrastructure; the Web is a service on top of it
  2. DNS translates domain names to IP addresses through hierarchical lookup
  3. HTTP is a request/response protocol with methods (`GET`, `POST`, etc.) and status codes
  4. HTTPS adds encryption via TLS for security
  5. Every page load involves: DNS → TCP → TLS → HTTP → Rendering