Hop by hop
The internet does not hold an end to end circuit. Instead each packet carries a destination IP address, and every router along the way makes an independent forwarding decision. No single device knows the whole path.
The routing table
A router keeps a routing table mapping address prefixes to next hops:
- It compares the destination against each prefix and picks the longest prefix match, the most specific entry.
- That entry names an outgoing interface and the next router to forward to.
- If nothing matches, the packet follows the default route toward the wider internet.
Routers learn these prefixes from protocols like BGP between networks and OSPF inside one network. Each hop decrements the time to live field, and a packet that reaches zero is dropped so loops cannot run forever.
Why this scales
Because forwarding is local and stateless, routers do not track every connection. They only need prefixes, so a handful of table entries can reach billions of addresses. This is why the internet keeps working even when links fail and traffic reroutes around them.
Key idea
Packets are forwarded one hop at a time by longest prefix match, with no router holding the full end to end path.