>> Special Topics / 02 / Lecture

How the Internet
Actually Works

From "Enter" to a webpage
You type google.com, hit Enter, and a page appears in 200 milliseconds. In between, your request crossed cities, maybe oceans. Today we trace that journey, step by step.
Lecture
75 min
Builds on
ST1 — one computer
Series
ST · How It Really Works
ST 02 / 03
>> Today's roadmap

Follow one request across the world

  1. What the internet physically is — cables + agreements
  2. IP addresses — every device has a number
  3. DNS — turning names into numbers
  4. Packets — your data, chopped into postcards
  5. Routers & hops — the relay race across the planet
  6. HTTP & HTTPS — the request, the reply, the padlock
>> The hook

The internet is not in the air.

"The cloud", "wireless", "the web" — the words make it sound like magic floating around us. It isn't. The internet is physical: millions of kilometres of cable, including fibre-optic lines lying on the ocean floor between continents.

Wi-Fi is only the last few metres — from your phone to a router that's plugged into a wire. After that, it's cables all the way down.

>> 01 / 06 · What it's made of

A network of networks

"Internet" literally means inter-network — your home network, joined to your ISP's network, joined to thousands of others, all agreeing to pass each other's traffic.

Your device
phone / laptop
→
Your ISP
Jio, Airtel, the college
→
The backbone
big long-haul cables
Their ISP
the server's provider
→
The server
google's computer
>> 02 / 06 · IP addresses

Every device needs a postal address

addresses
# IPv4 — four numbers, each 0–255
142.250.183.206      # a google server
192.168.0.5          # probably your laptop at home

# We ran out of IPv4, so IPv6 exists too:
2404:6800:4007:80e::200e   # much bigger pool

# Find yours:
$ ipconfig      # Windows
$ ifconfig      # Mac / Linux
No address, no delivery. Just like a letter needs a "to" address, every packet needs a destination IP — or the network has no idea where to send it.
GOOD NEWS

You'll almost never type an IP address. Why? Because of the next slide…

>> 03 / 06 · DNS

DNS — the internet's phonebook

Humans remember google.com. Computers need 142.250.183.206. DNS is the lookup that turns the name into the number.

You type a name
google.com
→
Ask a DNS server
"what's its IP?"
→
Get the number
142.250.183.206
try_it
$ nslookup google.com
Name:    google.com
Address: 142.250.183.206   # ← the phonebook just answered
>> 04 / 06 · Packets

Your data travels as postcards, not a letter

A big file isn't sent in one piece. It's chopped into thousands of small packets, each stamped with where it's going, where it's from, and its order number.

one_packet
# Every packet carries a little header:
to:   142.250.183.206
from: 49.36.220.11
seq:  3 of 1500
data: "...a slice of the image..."
Why bother? Packets can each take a different route, dodge congestion, and if one is lost, only that tiny piece is resent — not the whole file.
REASSEMBLY

Packets can arrive out of order. The seq number lets the other end put them back together correctly.

>> 05 / 06 · Routers & hops

A relay race, not a straight line

No single wire goes from you to Google. Your packets hop router to router, each one reading the "to" address and passing it one step closer. You can watch it happen:

$ traceroute google.com
1  192.168.0.1      # your home router          1 ms
2  100.71.4.1       # your ISP, nearby town     8 ms
3  72.14.215.85     # into the backbone        21 ms
4  108.170.250.97   # google's network         24 ms
5  142.250.183.206  # arrived!                 25 ms

# Each line is one "hop". 5 hops, ~25 ms, across the country.
>> The rulebook, in layers

Four jobs, stacked — the TCP/IP model

Each layer trusts the one below it to do its job, so no single part has to understand everything.

Application HTTP, email — what you actually want. "Give me this page."
Transport (TCP) Splits into packets, numbers them, resends the lost ones.
Internet (IP) Addresses & routes each packet hop to hop.
Link The actual wire / Wi-Fi signal carrying the bits.
>> 06 / 06 · HTTP & HTTPS

The actual conversation

Once connected, your browser and the server talk in plain text: a request goes out, a response comes back.

request →
GET /search?q=cats HTTP/1.1
Host: google.com
User-Agent: Firefox

# "Please send me this page."
← response
HTTP/1.1 200 OK
Content-Type: text/html

<html>...the page...</html>
# 200 = success. 404 = not found.
>> Putting it all together

Enter → page, in six steps

  1. DNS: turn google.com into an IP address.
  2. Connect: your computer opens a TCP connection to that IP (and HTTPS locks it).
  3. Request: your browser sends GET / — "send me the page."
  4. Route: packets hop router-to-router across the world and back.
  5. Respond: the server replies 200 OK with the HTML, in packets.
  6. Render: your browser reassembles them and draws the page. ~0.2 sec.
>> Try it yourself

See the internet move

RUN
Trace a route

In a terminal run tracert google.com (Windows) or traceroute google.com (Mac/Linux). Count the hops. Which is slowest?

LOOK UP
Use the phonebook

Run nslookup youtube.com. Run it twice — do you get different IPs? (Big sites have many servers.)

>> End of Special Topic 02

What you can now explain

  • ✓ The internet is physical cables plus shared agreements (protocols).
  • ✓ IP addresses, and how DNS turns names into them.
  • ✓ Data travels as packets, hopping router to router.
  • ✓ HTTP is the request/reply — and the padlock (HTTPS) is why it's safe.
01 / 13
←/→ navigate   F fullscreen   Ctrl/⌘+P save as PDF