How the Internet Works
Packets, routers, ISPs and autonomous systems; IP addresses and DNS; packet switching; and the journey of data across the world in milliseconds.
The Internet is a network of networks: tens of thousands of independently operated networks (ISPs, universities, companies, cloud providers) that agree to exchange traffic using a common set of protocols, TCP/IP. No one owns it and there's no central computer. It works because everyone speaks the same protocols.
Packets, not circuits
The old telephone network was circuit-switched: a call reserved a dedicated path for its whole duration. The Internet is packet-switched: data is chopped into packets (typically up to ~1500 bytes), each carrying its source and destination addresses, and each is forwarded independently.
- A dedicated path is reserved upfront
- Guaranteed bandwidth and latency
- Capacity is wasted when idle
- One broken link drops the call
- No reservation; links are shared by everyone
- Very efficient for bursty traffic
- Variable delay; packets can be lost or reordered
- Routes around failures automatically
Losing and reordering packets sounds bad, but the end hosts fix it: TCP retransmits lost packets and reorders them, so applications see a reliable byte stream (TCP).
The main pieces
| Piece | Role |
|---|---|
| Hosts | End devices: laptops, phones, servers |
| Switches | Forward frames within a local network, using MAC addresses |
| Routers | Forward packets between networks, using IP addresses |
| ISPs | Connect customers and each other; tiered (local, regional, global transit) |
| Internet exchange points (IXPs) | Buildings where many networks interconnect and swap traffic directly |
| Autonomous systems (AS) | Each independently run network, identified by a number (AS15169 is Google) |
| Undersea cables | Carry ~99% of intercontinental traffic |
Addresses and names
- Every device on the Internet needs an IP address: IPv4 like
142.250.72.14(about 4.3 billion possible, long since exhausted) or IPv6 like2607:f8b0:4005:80b::200e. - Humans use domain names (
example.com); DNS translates them to IP addresses (DNS). - Home networks share one public IPv4 address through NAT in the router (IP addressing).
How a packet finds its way
Each router has a forwarding table: for each destination prefix, which neighbour to send to. It looks at the packet's destination IP, picks the longest matching prefix, and forwards the packet one hop closer. No router knows the full path.
Routers build these tables with routing protocols:
- Inside a network (interior): OSPF, IS-IS — find the shortest paths.
- Between networks (exterior): BGP — each AS announces which address prefixes it can reach; ASes choose routes based on business policy (customers, peers, providers) as much as distance.
Try it yourself:
traceroute example.com # tracert on Windows: every router hop and its latency
ping -c 4 example.com # round-trip timeLatency: physics sets the floor
Light in fibre travels at about 200,000 km/s (two-thirds of c). New York ↔ London is ~5,600 km, so the round trip can never be faster than ~56 ms, and is typically ~70 ms after routing detours.
| Delay | Cause |
|---|---|
| Propagation | Distance / signal speed — physics |
| Transmission | Packet size / link bandwidth |
| Queuing | Waiting in router buffers when links are busy |
| Processing | Routers inspecting headers (microseconds) |
That's why companies put servers and CDNs close to users: you can add bandwidth, but you can't make light faster (CDN).
Layering
Networking is organised in layers, each using the one below: physical signals → local delivery (Ethernet, Wi-Fi) → global addressing and routing (IP) → reliable or fast delivery between programs (TCP, UDP) → applications (HTTP, DNS, SMTP). Each layer adds its own header around the data from the layer above (encapsulation). Next lesson: OSI and TCP/IP models.
- The Internet is a network of independently run networks speaking TCP/IP.
- Data travels as independent packets (packet switching); TCP restores order and reliability.
- Routers forward hop by hop using longest-prefix match; BGP connects networks.
- DNS maps names to IPs; NAT lets many devices share one IPv4 address.
- Latency has a physical floor; CDNs move content closer to users.
QWhat is the difference between a router and a switch?easy
A switch forwards frames within one local network using MAC addresses (layer 2). A router forwards packets between different networks using IP addresses (layer 3), choosing the next hop from its routing table. Home "routers" combine a router, a switch, a Wi-Fi access point, NAT and DHCP in one box.