Skip to main content
BGP

Border Gateway Protocol

Active

The routing protocol that makes the internet work, exchanging routing and reachability information between autonomous systems.

RoutingRFC 42711989Internet Standard

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

FieldSizeDescription
Marker16 bytesAll 1s – synchronization marker
Length2 bytesTotal message length including header
Type1 byte1=OPEN, 2=UPDATE, 3=NOTIFICATION, 4=KEEPALIVE
AS Number2/4 bytesAutonomous System number (2-byte or 4-byte with RFC 6793)
NLRIVariableNetwork 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

linuxsince FRRouting, BIRD, GoBGPavailable
freebsdsince BIRD, OpenBGPDavailable

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.

Related protocols