I spent the last few weeks reading about BGP after running into a routing issue that I could not explain with traceroute alone. These are rough notes, not a tutorial.
The basics
BGP (Border Gateway Protocol) is how autonomous systems on the internet exchange routing information. An autonomous system (AS) is a network or group of networks operated by a single organization, identified by an AS number (ASN). For example, Cloudflare is AS13335, Hetzner is AS24940.
When your packets travel from your home to a server in Amsterdam, they cross multiple autonomous systems. BGP is what lets those networks agree on the path.
How routes propagate
Each AS announces the IP prefixes it owns to its neighbors. Those neighbors pass the announcements along, prepending their own ASN to the path. The result is an AS path — a chain of AS numbers that describes the route.
203.0.113.0/24 via AS64500 AS64501 AS64502
This means: to reach 203.0.113.0/24, go through AS64502, then AS64501, then AS64500. Shorter paths are generally preferred, but it is more nuanced than that.
BGP communities
Communities are tags attached to route announcements. They let operators signal intent to their peers. For example, a provider might define a community that means “do not export this route to other peers” or “lower the local preference for this route.”
Communities are typically written as ASN:value, like 64500:100. Large communities use a three-part format: ASN:function:parameter.
I found the RIPE NCC BGP community guides useful for understanding how different networks use these.
Interesting observations
A few things that surprised me:
Routing is not symmetric. The path from A to B can be completely different from the path from B to A. Each AS makes independent routing decisions.
AS path length is not the only metric. Local preference, multi-exit discriminator (MED), and operator policy all influence route selection. A longer AS path can win if the operator configured it that way.
Route convergence takes time. When a link goes down, BGP routers withdraw the affected routes and announce alternatives. This process can take seconds to minutes. During convergence, packets can be dropped or take suboptimal paths.
Useful tools
For looking up ASN information and BGP routes, I found these helpful:
whois -h whois.radb.net AS64500— query the RADB for an AS’s routing policy- bgp.tools — clean interface for AS and prefix lookups
- PeeringDB — information about where networks peer
- RIPE Stat — routing history and visibility data
I do not operate a network that runs BGP, but understanding the basics has helped me make sense of traceroute output and routing anomalies. When you see a strange path or unexpected latency, knowing that BGP policy decisions are behind it makes the situation less mysterious.