Unit 4 · Networks · Lesson 9 of 10
BGP and routing policy
Step 1: Learn the ideas
- Autonomous systems and AS numbers
- Path-vector routing and AS_PATH loop prevention
- BGP decision process and local preference
- Customer, peer and provider relationships (valley-free export)
- More-specific prefixes, prepending and anycast
- Route leaks versus hijacks
- Prefix filtering, RPKI origin validation and MANRS
- BGP convergence behavior
Why it matters
Network-facing roles and networking research expect you to explain how Internet routing actually works, read an incident report about a leak or hijack, and reason about anycast, multi-homing and cloud interconnects. In general infrastructure work, BGP misconfigurations cause some of the most visible outages.
Core ideas
Autonomous systems and path vectors. The Internet is a collection of autonomous systems (ASes), each a network under one administration with its own AS number. BGP speakers exchange routes for prefixes over TCP sessions; each route carries attributes including the AS_PATH, the list of ASes it has traversed. A router discards routes that already contain its own AS (loop prevention) and selects among the rest. Unlike link-state protocols inside a network (OSPF, IS-IS), no router has a global map.
Policy before path length. Route selection applies local preference first (set by the operator, usually from business relationships), then AS-path length, then tie-breakers such as MED and the internal cost to the exit. Export policy decides which routes are announced to whom. The common model: an AS prefers routes from customers (who pay it), then from peers (settlement-free), then from providers (whom it pays); it exports customer routes to everyone but peer and provider routes only to customers. These rules keep paths "valley-free" and stop networks from carrying traffic they are not paid for.
More-specific wins in forwarding. Forwarding uses longest-prefix match, so a more-specific announcement attracts traffic even when a legitimate less-specific route exists. Traffic engineering uses this deliberately (announcing more-specifics, or prepending one's own AS to make a path look longer); mistakes and attacks exploit it.
Leaks and hijacks. A route leak is an announcement propagated beyond its intended scope, for example a customer re-announcing one provider's routes to another provider, which can pull traffic through a network unable to carry it. A hijack is the announcement of someone else's prefix, or a more-specific of it, as if one originated it. Defenses include prefix filters built from registry data, maximum-prefix limits on sessions, RPKI route origin validation (signed statements of which AS may originate a prefix) and baseline practices promoted by initiatives such as MANRS. Origin validation checks only the origin AS, not the rest of the path.
Common misconceptions
- "BGP picks the shortest path." Local preference and export policy come first; AS-path length only breaks ties among equally preferred routes.
- "RPKI stops all hijacks." It rejects announcements from the wrong origin AS, but not leaks or forged paths that keep the correct origin.
- "BGP converges quickly." Path exploration and timers can take seconds to minutes, during which traffic may be dropped or misrouted.
- "Anycast gives automatic failover." Only if a failing site withdraws its routes; a broken site that keeps announcing keeps attracting traffic.
How to approach it
Learn the decision order and the export rules, then explain one public leak or hijack post-mortem in those terms. Look up real AS paths for a prefix you know in a public route collector.
Suggested order
- 1Read Computer Networks: A Systems Approach Section 4.1 (Global Internet), focusing on interdomain routing with BGP.
- 2Read RFC 4271 Section 9.1 (Decision Process) to see the order in which preference and tie-breakers apply.
- 3Read RFC 7908 Sections 2 and 3 for the definition and classification of route leaks.
- 4Read the MANRS site for the baseline routing-security actions (filtering, anti-spoofing, coordination, validation).
- 5Look up the AS path of a prefix you know in a public route collector and explain why each AS on the path accepted and re-announced it.
Step 2: Check off what you can do
Tap each one you can genuinely do or explain. Each earns 10 XP.
Step 3: Go deeper
Computer Networks: A Systems ApproachStart here
Systems Approach (open online edition)Section: 4.1 Global Internet
Main reading: routing areas and interdomain routing with BGP.
Open(opens in a new tab)Link responded, 5 Oct 2026RFC 4271: A Border Gateway Protocol 4 (BGP-4)
IETF (RFC Editor)Section: Section 9.1: Decision Process
Authoritative order of route preference and tie-breaking.
Open(opens in a new tab)Not checkable automatically, 5 Oct 2026RFC 7908: Problem Definition and Classification of BGP Route Leaks
IETF (RFC Editor)Section: Section 3: Classification of Route Leaks Based on Documented Events
Leak types expressed in terms of customer, peer and provider relationships.
Open(opens in a new tab)Not checkable automatically, 5 Oct 2026MANRS: Mutually Agreed Norms for Routing Security
MANRS initiativeBaseline actions networks take against leaks, hijacks and spoofing.
Open(opens in a new tab)Link responded, 5 Oct 2026
Step 4: Practice
Use a public route collector or looking glass (for example the RIPE RIS or RouteViews services) to view the AS paths for a prefix of a network you know, and explain each hop with the customer, peer and provider export rules. Then read one public post-mortem of a route leak or hijack, decide which it was (for a leak, which type in RFC 7908 Section 3), and state which filter or validation would have stopped it.
No external problems are linked; follow the guidance above.
Record attempts on each problem’s page (+15 XP, +10 more when solved on your own).
Step 5: Test yourself
Answer each one out loud or on paper before you finish the lesson.
- Question 1Why would an AS prefer a longer path through a customer over a shorter one through a provider?
- Question 2How does BGP prevent routing loops between ASes?
- Question 3Why does announcing a /24 inside someone else's /16 attract their traffic?
- Question 4Which export rule does a customer break when it leaks one provider's routes to another provider?
- Question 5What does AS-path prepending do, and why is it only a hint to other networks?
You’re done when you can
- Predict which of three candidate routes a BGP router selects, given local preference and AS-path lengths, and justify the choice.
- Explain the difference between a route leak and a hijack with one example each, in under two minutes.
- Explain what RPKI origin validation prevents and what it does not.


