Border Gateway Protocol
ActiveThe routing protocol that makes the internet work, exchanging routing and reachability information between autonomous systems.
In one line
BGP is the internet's routing protocol, defined in RFC 4271. It runs between autonomous systems (AS) – the networks operated by ISPs, cloud providers, and large enterprises – exchanging IP prefix reachability information. BGP uses TCP port 179, maintains persistent sessions called peers, and makes routing decisions based on path attributes including AS-Path, MED, and Local Preference.
Quick Reference
| Field | Size | Description |
|---|---|---|
| Marker | 16 bytes | All 1s – synchronization marker |
| Length | 2 bytes | Total message length including header |
| Type | 1 byte | 1=OPEN, 2=UPDATE, 3=NOTIFICATION, 4=KEEPALIVE |
| AS Number | 2/4 bytes | Autonomous System number (2-byte or 4-byte with RFC 6793) |
| NLRI | Variable | Network Layer Reachability Information – IP prefixes being advertised |
Key Characteristics
Peer Sessions
Persistent TCP sessions between BGP speakers (eBGP/iBGP).
Path Attributes
AS-PATH, NEXT-HOP, MED, LOCAL-PREF, COMMUNITY control routing decisions.
Policy-based
Route policies (accept/reject/modify) are applied at each AS boundary.
Full Internet Table
A full BGP table contains ~900,000+ IPv4 prefixes (July 2024).
Implementations
Edge cases
- •BGP hijacking – an AS advertises prefixes it doesn't own – has caused major internet outages.
- •Route leaks occur when a transit AS incorrectly re-advertises learned routes.
- •BGP convergence after a session drop can take minutes, causing temporary black-holing.
- •RPKI (RFC 6480) signs route origin to prevent hijacking, but adoption is incomplete.
- •The MOAS problem: multiple origin AS for same prefix causes routing instability.
History
BGP replaced EGP (RFC 827, 1982) as the inter-AS routing protocol. BGP-4 (1994) added CIDR support critical for scaling the internet. BGP's simplicity and policy flexibility made it the dominant routing protocol despite known security limitations.