FOUNDATIONS / SYSTEM CONCEPT BRIEF

How the Internet works

The internet is a network of networks.

BeginnerPhase 01 / Topic 1 of 17RequirementsTrade-offsFailure modes
01

Overview

The internet is a network of networks. Millions of independently operated networks (ISPs, clouds, universities, companies) agree to exchange traffic using a shared set of protocols. Data travels as small packets, each carrying a source and destination IP address, and routers forward each packet one hop closer to its destination.

Communication is organized in layers. Each layer solves one problem and relies on the layer below: the physical link moves bits, IP moves packets between machines, TCP or UDP moves data between programs, and application protocols like HTTP define what the data means. Understanding these layers lets you reason about latency, failures, and where a design decision actually takes effect.

The postal system

A letter is split into numbered postcards (packets). Each postcard has a destination address (IP) and an apartment number (port). Sorting offices (routers) do not know the whole route; they only know which next office gets closer. Postcards can take different routes and arrive out of order, and TCP numbers them so the receiver can reassemble the letter.

02

When to use it

  • Explaining why latency exists and why distance matters.
  • Debugging connectivity: is it DNS, routing, TCP, TLS, or the application?
  • Choosing where to place servers, CDNs, and load balancers.
  • Understanding what can fail between a user and your service.
03

Where it shows up in interviews

Latency budgets

Recognize it when: an interviewer asks why a global service is slow or how to make it faster.

  • Design a global video platform
  • Design a multiplayer game backend
Failure domains

Recognize it when: what happens when a region, ISP link, or data center goes down.

  • Design a highly available API
  • Design multi-region failover
04

Where it is used in real software

BGP and internet routing

Autonomous systems (ISPs, clouds) announce which IP ranges they can reach using BGP. Misconfigured BGP announcements have taken major services offline for hours.

Undersea cables

About 99% of intercontinental traffic runs through undersea fiber cables. The speed of light in fiber (about 200,000 km/s) sets a hard lower bound on latency, around 70 ms for a New York to London round trip.

Cloud regions

AWS, Azure, and GCP place regions near users and connect them with private backbones to reduce hops over the public internet.

05

Key terms

Packet
A small unit of data with headers (addresses, protocol info) and a payload.
Router
A device that forwards packets toward their destination based on routing tables.
ISP / autonomous system
An independently managed network that exchanges routes with others via BGP.
TCP/IP model
Link, Internet (IP), Transport (TCP/UDP), Application (HTTP, DNS, SMTP).
RTT
Round-trip time: how long a packet takes to reach a destination and come back.
06

How one packet crosses the internet

  1. 1
    Application creates data

    Your browser produces an HTTP request.

  2. 2
    Transport layer adds ports

    TCP wraps the data with source and destination ports and sequence numbers.

  3. 3
    Network layer adds IP addresses

    IP adds the source and destination addresses. This is what routers read.

  4. 4
    Link layer delivers to the next hop

    Wi-Fi or Ethernet frames carry the packet to your router, which forwards it to your ISP.

  5. 5
    Routers forward hop by hop

    Each router looks up the destination prefix and forwards the packet toward it, typically 10 to 20 hops.

  6. 6
    Destination unwraps the layers

    The server's network stack removes each header and hands the payload to the program listening on the destination port.

A request travelling from laptop to server
Step 1 / 5
Laptop
Home router
ISP
Internet backbone
Cloud edge
Server

STEP 1The browser creates an HTTP request; TCP and IP wrap it in a packet addressed to the server's IP.

07

Latency by distance

Light in fiber travels about 200 km per millisecond; real routes add 20-50% overhead

Step 1 / 5
RouteDistanceMinimum RTTTypical RTT
Same data center< 1 km< 0.1 ms0.2-0.5 ms
Same city~50 km0.5 ms1-5 ms
US East to US West~4,000 km40 ms60-80 ms
New York to London~5,600 km56 ms70-80 ms
US to Australia~15,000 km150 ms180-220 ms

NOWRoute: Same data center | Distance: < 1 km | Minimum RTT: < 0.1 ms | Typical RTT: 0.2-0.5 ms

No amount of server optimization beats physics. For global users, you reduce latency by moving content and compute closer (CDNs, edge, regions) and by reducing the number of round trips.

08

Implementation

# See the route packets take (hops and per-hop latency)traceroute example.com        # macOS / Linuxtracert example.com           # Windows # Measure round-trip timeping -c 4 example.com # Show your machine's IP addresses and default gatewayip addr && ip route           # Linuxifconfig && netstat -rn       # macOS # Inspect each layer of an HTTPS requestcurl -v https://example.com   # DNS, TCP connect, TLS handshake, HTTP exchange
09

Complexity and performance

Speed of light in fiber~200 km/ms

A physical floor on latency.

Typical hops10-20

Routers between client and server.

MTU1,500 bytes

Typical maximum packet size on Ethernet.

10

Trade-offs

Packet switching vs circuits

The internet shares links between many users (packet switching), which is efficient but gives no latency guarantees, unlike old telephone circuits.

Best-effort delivery

IP does not guarantee delivery or order. TCP adds reliability at the cost of extra round trips and head-of-line blocking.

11

Variants and related techniques

OSI model

A 7-layer reference model (physical, data link, network, transport, session, presentation, application) often used in interviews.

Private backbones

Large providers route traffic over their own fiber to avoid congested public paths.

12

Common mistakes

  • Assuming the network is reliable and instant.

    Fix: Design for timeouts, retries, packet loss, and variable latency (the fallacies of distributed computing).

  • Ignoring round trips.

    Fix: Every extra round trip (DNS, TCP, TLS, redirects) costs a full RTT, which dominates on mobile and long distances.

13

Interview questions

Why can't we make cross-continent latency near zero?

Data cannot travel faster than light in fiber, about 200 km per millisecond. The only fixes are moving data closer to users and reducing the number of round trips.

What is the difference between the IP and TCP layers?

IP delivers packets between machines using addresses, with no guarantees. TCP runs on top and delivers an ordered, reliable byte stream between specific programs identified by ports.

14

Practice problems

ProblemDifficultyWhat it trains
Run traceroute to three distant sites and explain the hopsEasyRouting and latency.
Estimate page load time for a user in Sydney hitting a US serverMediumRTT math and round trips.
Design a global static website with low latencyMediumCDN and edge placement.