Loading learning content...
Every routing protocol is fundamentally an algorithm for computing paths through a network. The algorithm's design determines what information routers exchange, how they compute best paths, and how they handle topology changes. BGP uses a path vector algorithm—a distinct approach that differs fundamentally from both distance vector (used by RIP) and link state (used by OSPF).
Understanding path vector routing is essential for understanding BGP's behavior, limitations, and capabilities. It explains why BGP can prevent routing loops without knowing the complete network topology, why BGP policies can be so flexible, and why BGP convergence is inherently different from IGP convergence.
By the end of this page, you will understand the three major routing algorithm paradigms (distance vector, link state, and path vector), how BGP's path vector approach works mechanically, why path vector enables policy-based routing, and how AS_PATH provides elegant loop prevention. You will be able to compare these algorithms and explain why path vector was the right choice for inter-domain routing.
Before diving into path vector specifics, we need to understand the landscape of routing algorithms. Each paradigm represents a different philosophy about what information routers should share and how they should compute paths.
The Fundamental Tradeoffs:
Routing algorithms must balance several competing concerns:
Different algorithms make different tradeoffs. Let's examine each paradigm:
| Characteristic | Distance Vector | Link State | Path Vector |
|---|---|---|---|
| Information Shared | Distance (cost) to destinations | Complete link state of router | Complete path (AS sequence) to destinations |
| Topology Knowledge | None (only next-hop vectors) | Complete within domain | AS-level path, not internal topology |
| Algorithm | Bellman-Ford | Dijkstra (SPF) | Modified Bellman-Ford with path |
| Loop Prevention | Split horizon, poison reverse | Complete topology knowledge | AS_PATH inspection |
| Convergence | Slow (count-to-infinity possible) | Fast (complete information) | Intentionally slow (stability priority) |
| Scalability | Limited | Limited (O(n²) flooding) | Excellent (per-AS abstraction) |
| Example Protocols | RIP, EIGRP (hybrid) | OSPF, IS-IS | BGP |
| Primary Use | Small networks, simple topologies | Enterprise/SP internal routing | Internet inter-domain routing |
Each algorithm is optimized for different network environments. Distance vector works well for small, stable networks. Link state excels in medium-to-large single-domain networks where fast convergence matters. Path vector is designed for multi-domain networks where policy matters more than optimization and where complete topology knowledge is impossible.
Understanding distance vector is essential background for path vector, as path vector evolved to address distance vector's limitations in multi-domain environments.
How Distance Vector Works:
In distance vector routing, each router maintains a table (vector) containing:
Routers periodically exchange their entire distance vectors with directly connected neighbors. Upon receiving a neighbor's vector, routers apply the Bellman-Ford algorithm:
For each destination D in neighbor's vector:
new_distance = distance_to_neighbor + neighbor's_distance_to_D
if new_distance < current_distance_to_D:
update route: D via neighbor with new_distance
This distributed computation converges to optimal paths without any router knowing the complete topology.
Distance Vector's Critical Flaw: Count-to-Infinity
Distance vector's simplicity comes with a severe limitation: the count-to-infinity problem. When a destination becomes unreachable, the protocol can enter a loop where routers keep incrementing distances until hitting the maximum (typically 16).
Example Scenario:
Mitigations like split horizon (don't advertise a route back to where you learned it) and poison reverse (advertise infinity back to where you learned it) help but don't completely solve the problem in all topologies.
Why This Matters for Path Vector:
The count-to-infinity problem occurs because distance vector routers have no visibility into the actual path. They don't know if their 'improvement' creates a loop. Path vector addresses this directly by including the complete path in every advertisement.
Distance vector routers must trust that the distances their neighbors advertise are accurate and that routes don't loop. This trust is reasonable within a single administrative domain but problematic across organizational boundaries where operators may have incentives to manipulate metrics.
Link state routing takes a fundamentally different approach: give every router complete topology information and let each compute paths independently.
How Link State Works:
Advantages of Link State:
Why Link State Doesn't Scale for Inter-Domain Routing:
Despite its elegance, link state is unsuitable for Internet-scale inter-domain routing:
| Challenge | Link State Reality | Internet Requirement |
|---|---|---|
| Database size | Every router stores entire topology | 100,000+ ASes with millions of internal links |
| Flooding overhead | Every link change floods everywhere | Millions of link changes daily |
| Hierarchy limits | Areas/levels help but don't eliminate scaling issues | No single hierarchy can encompass all ASes |
| Trust model | Full trust in all participating routers | ASes are competitors, potentially adversarial |
| Policy | Shortest path only (metrics can be tuned) | Arbitrary policies needed (business, political) |
| Administrative diversity | Single management domain | 75,000+ independent organizations |
The fundamental problem: link state requires complete topology knowledge, which is both technically infeasible and administratively unacceptable at Internet scale. No competitive ISP wants to share its internal topology with rivals.
The solution the Internet adopted: use link state (OSPF, IS-IS) within each AS where complete topology knowledge is appropriate, and use path vector (BGP) between ASes where abstraction is necessary. Each AS appears as a single 'hop' to BGP, regardless of its internal complexity.
Path vector routing combines elements of distance vector with a crucial enhancement: instead of just advertising the distance to a destination, routers advertise the complete path (sequence of ASes) to that destination.
The Path Vector Principle:
When a BGP router advertises a route, it includes:
When a router receives this advertisement, it:
Example Path Vector Operation:
In this example:
The Power of Path Information:
The AS_PATH provides several critical capabilities:
1. Natural Loop Prevention A router discards any route that contains its own AS in the AS_PATH. This is simple, foolproof, and requires no additional mechanisms.
2. Path Length as Metric The number of ASes in the path serves as a basic metric. All else being equal, shorter AS_PATHs are preferred.
3. Policy Decisions The AS_PATH enables rich policy. You can:
4. Troubleshooting Visibility When debugging routing issues, the AS_PATH shows exactly how a route reached you—invaluable for diagnosing problems.
# BGP Route Advertisement Example Prefix: 203.0.113.0/24AS_PATH: 65003 65002 65001Next-Hop: 192.0.2.1Origin: IGPLocal Preference: 100 # This route tells us:# - The prefix 203.0.113.0/24 is being advertised# - It originated in AS 65001# - It passed through AS 65002# - It was received from AS 65003# - To reach it, send traffic to 192.0.2.1# - Path length is 3 AS hops # Loop Detection:# If I am AS 65002 and receive this route, I see 65002 in the path# --> Route is REJECTED (would create a loop)Think of AS_PATH as a cryptographic chain of custody (though without actual cryptography before BGPsec). Each AS that handles the route adds its signature. A route's pedigree is transparent: you know exactly who touched it. This visibility is fundamental to BGP's ability to enforce policy and detect anomalies.
Understanding the mathematical properties of path vector helps explain its convergence behavior and policy capabilities.
Path Vector as Modified Bellman-Ford:
The classical Bellman-Ford algorithm maintains:
dist[v] = min over all neighbors u of (dist[u] + weight(u,v))
Path vector modifies this to track the complete path:
path[v] = best_path among all neighbors u of (prepend(self, path[u]))
where self not in path[u]
The 'best_path' selection is not purely metric-based; it incorporates BGP's complex decision process (local preference, AS_PATH length, origin type, MED, etc.).
Convergence Properties:
Path vector converges because:
Unlike distance vector, there is no count-to-infinity. If a destination becomes unreachable, the path is simply withdrawn—there's no incorrect distance to propagate.
The Algebraic Perspective:
Routing can be formally modeled using algebraic path problems over semirings. This is the theoretical foundation for understanding routing algorithm properties.
For path vector in BGP, the key algebraic properties are:
1. Path Algebra
2. Isotonicity (Monotonicity) A routing protocol is isotonic if path preferences are preserved under extension. In other words, if path A is preferred over path B, then extending both through the same AS preserves the preference.
BGP is not always isotonic due to policy interactions. Different ASes may make different preference decisions. This is a feature (enabling policy) but can cause convergence problems (BGP oscillation).
3. Convergence Conditions (Gao-Rexford) If ASes follow certain policy guidelines based on their business relationships:
Then BGP is guaranteed to converge. Violations of these conditions can cause persistent routing oscillations.
Unlike IGPs, BGP is not guaranteed to converge in all configurations. Certain policy combinations can create 'BGP wedgies'—stable states that are suboptimal—or persistent oscillations. This is a consequence of the policy freedom BGP provides. Operators must design policies carefully to avoid these pathologies.
| Property | Distance Vector | Link State | Path Vector |
|---|---|---|---|
| Guaranteed Convergence | No (count-to-infinity) | Yes (complete information) | Conditional (depends on policies) |
| Convergence Speed | Slow (multiple iterations) | Fast (local computation) | Intentionally slow (stability features) |
| Convergence Trigger | Periodic + triggered updates | Immediate flooding | Triggered updates with dampening |
| Loop-Free During Convergence | No (transient loops possible) | Yes | Yes (AS_PATH rejection) |
| Metric Independence | No (distance is metric) | No (cost is metric) | Yes (policy can override path length) |
One of path vector's greatest strengths is enabling policy-based routing. Unlike IGPs that optimize for shortest path, BGP allows each AS to make routing decisions based on arbitrary criteria.
Policy Decision Points:
BGP policy can be applied at several stages:
1. Import Policy (Inbound Filtering) When receiving routes from a neighbor:
2. Best Path Selection When choosing among multiple routes to the same destination:
3. Export Policy (Outbound Filtering) When advertising routes to a neighbor:
Common Policy Patterns:
# Example: Typical Enterprise BGP Policy # INBOUND from Primary ISP (AS 65100)route-map PRIMARY-ISP-IN permit 10 match ip address prefix-list VALID-PREFIXES set local-preference 150 # High preference for primary set community 65001:100 # Tag as primary provider route # INBOUND from Backup ISP (AS 65200) route-map BACKUP-ISP-IN permit 10 match ip address prefix-list VALID-PREFIXES set local-preference 75 # Lower preference (backup) set community 65001:200 # Tag as backup provider route # OUTBOUND to Both ISPsroute-map MY-ROUTES-OUT permit 10 match ip address prefix-list MY-PREFIXES # Advertise my prefixes to both providers route-map MY-ROUTES-OUT deny 20 # Don't advertise anything else (no transit!) # Result: # - Traffic INBOUND prefers primary ISP (higher local-pref)# - Traffic OUTBOUND goes to both ISPs (they will load-balance)# - Enterprise does NOT become transit for ISP trafficPath vector's ability to carry the complete AS_PATH enables informed policy decisions. You can reject routes through known-bad ASes, prefer routes through trusted partners, or detect hijacking attempts. With only distance (as in distance vector), these decisions would be impossible—you'd just see a number with no context about how it was computed.
Path vector is not without limitations. Understanding these tradeoffs is essential for working effectively with BGP.
Information Hiding:
Path vector abstracts each AS to a single hop, regardless of internal complexity. This creates challenges:
The Shortest Path Fallacy:
BGP's default preference for shorter AS_PATHs assumes that fewer AS hops mean a better path. This is often false:
| Scenario | Short Path | Long Path | Better Choice |
|---|---|---|---|
| Geographic | 2 ASes spanning continents | 4 ASes within region | Long path (lower latency) |
| Congestion | 3 ASes, middle one overloaded | 5 ASes, all lightly loaded | Long path (better performance) |
| Reliability | 2 ASes, one unstable | 4 ASes, all stable | Long path (more reliable) |
| Cost | 3 ASes, expensive transit | 6 ASes, cheap transit | Depends on budget |
This is why operators use BGP communities, local preference manipulation, and other mechanisms to override the default path length preference.
The Convergence vs. Stability Tradeoff:
BGP deliberately converges slowly to prevent oscillations. The Minimum Route Advertisement Interval (MRAI) defaults to 30 seconds for eBGP, meaning a complete path change can take minutes to propagate globally. This is acceptable for the Internet (where stability matters more than speed) but can be problematic for real-time applications.
Many of BGP's 'limitations' are deliberate design choices. The Internet prioritizes stability over optimization. In a network of 100,000+ ASes operated by tens of thousands of organizations, a protocol that optimizes aggressively would create constant churn. BGP's conservative approach, while imperfect for any individual traffic flow, enables the Internet to function at all.
We have explored path vector routing from first principles. Let's consolidate the key insights:
What's Next:
In the next page, we will dive deep into the AS_PATH attribute—the heart of path vector routing in BGP. You will learn the detailed mechanics of AS_PATH propagation, AS_PATH manipulation for traffic engineering, AS_PATH length's role in best path selection, and how AS_PATH enables loop detection and policy enforcement.
You now understand path vector routing fundamentally—how it differs from distance vector and link state, why it was the right choice for inter-domain routing, and how it enables the Internet's policy-rich, scalable routing system. Next, we explore the AS_PATH attribute in complete detail.