Routing & Switching

BGP

Border Gateway Protocol — the path-vector protocol that routes the Internet and, increasingly, the data centre. Four chapters: how sessions and route exchange actually work, the full best-path selection order, policy control with communities and filters, and the scaling machinery of route reflectors and convergence tuning.

read in order, or dip in
4 chapters

read in order, or dip in

updated 31 Aug 2026
Free — no signup

updated 31 Aug 2026

Contents

  1. 01BGP Fundamentals: eBGP, iBGP and Peering SessionsBGP is a path-vector protocol that exchanges routes over explicitly configured TCP sessions on port 179 — nothing is auto-discovered. External BGP peers different autonomous systems and is loop-protected by the AS-path; internal BGP distributes those routes within an AS and, because iBGP-learned routes are never re-advertised to other iBGP peers, requires a full mesh, route reflectors or confederations.
  2. 02BGP Path Selection: The 11 AttributesFor every prefix with multiple paths, Cisco BGP walks a fixed decision list: highest weight, highest local preference, locally originated routes, shortest AS-path, lowest origin code, lowest MED, eBGP over iBGP, nearest IGP next hop, oldest eBGP path, lowest router ID, lowest neighbour address. Weight and local preference steer outbound traffic; AS-path prepending and MED influence inbound.
  3. 03BGP Communities, Route Filtering and Policy ControlBGP policy is applied per neighbour with prefix lists, AS-path filters and route maps; communities — 32-bit tags carried with routes — let one AS signal intent to another, from the well-known no-export and no-advertise to provider-defined tags that set local preference or trigger blackholing. Every eBGP session should filter both directions, and prefix lists with le/ge are the workhorse.
  4. 04BGP Scaling: Route Reflectors, Peer Groups and ConvergenceFull-mesh iBGP scales as n(n−1)/2 sessions, so real networks use route reflectors: an RR re-advertises iBGP routes to its clients, using originator-ID and cluster-list attributes to stay loop-free. Convergence and stability come from BFD-triggered fallover, update groups, and — critically — next-hop tracking, with route dampening available for flap suppression at the edge.

Spotted something out of date? Tell us — this library is maintained by the faculty.