Border Gateway Protocol (BGP) is the routing protocol that makes the internet work. While most VPS administrators won't configure BGP directly, understanding it helps diagnose routing issues and work with upstream providers.
BGP Fundamentals
BGP is a path-vector routing protocol that exchanges routing information between autonomous systems (AS). Each AS is identified by a unique ASN (Autonomous System Number). BGP routers establish TCP sessions on port 179 to exchange route information.
Key Concepts
- AS Path: The list of ASNs a route has traversed, used to prevent loops
- Prefix: A network address block (e.g., 198.51.100.0/24)
- Next Hop: The IP address of the next router in the path
- Communities: Tags attached to routes for policy decisions
Viewing BGP Information
# Check BGP routes for an IP
whois -h whois.radb.net 198.51.100.0/24
# Use looking glass tools
curl -s "https://stat.ripe.net/data/looking-glass/data.json?resource=198.51.100.0/24"
# Traceroute to see AS path
mtr --aslookup example.com
Summary
Understanding BGP fundamentals helps you diagnose routing issues and communicate effectively with network providers when troubleshooting connectivity problems.