A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

BGP: Border Gateway Protocol

Graduate Depth 99 in the knowledge graph ☐ I know this ☆ Set as goal
3topics build on this
610prerequisites beneath it
See this on the map →
Distance-Vector Routing ProtocolsOSPF: Open Shortest Path First+1 more→→BGP Route Filtering and Hijacking PreventionRouting Convergence, Flapping, and Damping+1 more
bgp egp exterior-gateway-protocol autonomous-system path-vector

Core Idea

BGP is the exterior gateway protocol used to route traffic between autonomous systems (AS) on the Internet. Unlike OSPF, BGP uses path-vector routing where routers announce the full AS path to each destination, allowing policies (e.g., business relationships, traffic engineering) to influence route selection, not just hop count.

Explainer

Interior routing protocols like OSPF optimize for a single objective: find the shortest path. That works inside a single organization's network where every router cooperates and the goal is simple efficiency. But the Internet is not a single cooperative network — it is tens of thousands of independently operated autonomous systems (AS), each with its own business interests, peering agreements, and traffic policies. BGP is the protocol that makes routing work across this landscape of competing interests, and it is fundamentally different in character from the interior protocols you have studied.

BGP uses path-vector routing, which means each route advertisement carries the complete list of autonomous systems the traffic would traverse. When AS 100 advertises a route to prefix 10.0.0.0/8, it tells its neighbor "I can reach 10.0.0.0/8 via the path [AS 100]." That neighbor (say AS 200) prepends its own AS number and advertises the path [AS 200, AS 100] to its neighbors. This full-path information serves two purposes. First, it prevents routing loops — if a router sees its own AS number already in the path, it rejects that route. Second, it provides the raw material for policy-based routing decisions. An AS can prefer a route through a paying customer over a cheaper path through a competitor, or avoid sending traffic through certain countries entirely.

The route selection process in BGP follows a multi-step decision algorithm that evaluates routes by local preference (administrator-set priority), AS path length, origin type, multi-exit discriminator, and several tiebreakers. Critically, the highest-priority criterion — local preference — is entirely under the operator's control and has nothing to do with path optimality. This means BGP routing is as much about business relationships as it is about network topology. The three main relationship types are customer-provider (the customer pays the provider for transit), peer-peer (two networks exchange traffic for free), and transit (traffic flowing through an intermediary). An AS will typically prefer customer routes (it gets paid) over peer routes (free) over provider routes (it pays).

BGP operates over TCP connections between neighboring routers, exchanging route updates incrementally rather than flooding entire topology databases. Two BGP routers establishing a session are called peers (confusingly, this is different from the business peering relationship). eBGP (external BGP) runs between routers in different autonomous systems, while iBGP (internal BGP) distributes externally learned routes within an AS. Because BGP is the protocol that literally holds the Internet together, its failure modes have outsized consequences — a single misconfigured route announcement can redirect or blackhole traffic for millions of users, which is why BGP security and route validation remain active areas of concern.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Conditional Statements → Defining and Calling Functions → Functions: Decomposing Problems → Function Parameters and Argument Passing → Return Values → Variable Scope → Introduction to Classes → Objects and Instances → Methods and Attributes → Algorithm Design Basics → Tree Structure and Node Properties → Binary Trees → Tree Traversals → Depth-First Search (DFS) → Depth-First Search: Implementation and Applications → Topological Sort → Dynamic Programming → Longest Common Subsequence (LCS) Problem → Edit Distance: Levenshtein Distance and DP → 0/1 Knapsack Problem: Bounded Capacity DP → Greedy Algorithms → Activity Selection Problem Using Greedy Algorithms → Dijkstra's Algorithm → Floyd-Warshall Algorithm for All-Pairs Shortest Paths → Bellman-Ford Algorithm → Bellman-Ford Algorithm and Distance-Vector Routing → Distance-Vector Routing Protocols → BGP: Border Gateway Protocol

Longest path: 100 steps · 610 total prerequisite topics

Prerequisites (3)

Leads To (3)