How Networks Actually Route Traffic
We know the internet is a network of networks. But when a packet leaves your laptop destined for a server in Tokyo, how does it know which path to take across dozens of independent networks?
The answer is BGP — Border Gateway Protocol. BGP is the routing protocol that autonomous networks use to advertise which IP address blocks they can reach, and to learn routes from their neighbors. It is the protocol that makes the global internet function as a single, coherent routing system.
Autonomous Systems (ASes)
Every independently operated network on the internet is called an Autonomous System (AS). Each AS is assigned a unique AS Number (ASN) by its regional RIR. For example:
- Google's main AS is AS15169
- Cloudflare is AS13335
- Amazon AWS is AS16509
BGP is the language these ASes use to talk to each other. An AS announces: "I can reach these IP prefixes. Send traffic for them to me." Neighboring ASes hear this announcement and decide whether to use that path, based on a set of configurable policies.
How BGP Routing Works (Simplified)
- Your ISP (AS1234) peers with a transit provider (AS5678).
- AS5678 announces: "I can reach
8.8.8.0/24(Google DNS) via my network." - AS1234 accepts this route and installs it in its routing table.
- When your packet destined for
8.8.8.8arrives at AS1234's router, it forwards it to AS5678, which forwards it toward Google.
BGP is a path-vector protocol — each route advertisement carries the full list of ASes the route has traversed. This prevents routing loops (an AS won't accept a route that already contains its own ASN) and allows networks to make policy decisions based on the path.
BGP is Policy-Driven
Unlike interior routing protocols (like OSPF) that optimize purely for shortest path, BGP is designed to enforce business policy. A network can say: "Prefer routes through AS5678 over AS9999, even if AS9999 is technically shorter, because we have a cheaper transit deal with AS5678." This policy flexibility is what makes BGP powerful — and complex.
Key Point: BGP is the glue of the internet. It is not optimized for speed or shortest path — it is optimized for policy enforcement and business relationships. Every major internet outage involving "route leaks" or "BGP hijacks" is a failure of this system.