4.3.17 · D3Computer Networks

Worked examples — BGP — path vector, AS, policy routing

4,543 words21 min readBack to topic

Vocabulary this page needs (built from zero)

Every example below leans on a handful of terms and one piece of maths notation. We define them here, once, before any example uses them.


The full decision ladder (defined once, used everywhere)

Every example below walks down this exact ladder. Compare routes attribute by attribute; the first attribute that differs decides, and you stop. Each rung uses only terms defined above.


The scenario matrix

Before touching numbers, let's list every distinct situation a BGP route can be in. Think of these as the "quadrants" of BGP — miss one and you'll hit a case you never rehearsed.

Cell Case class What makes it tricky
A Decision by LOCAL_PREF (policy beats distance) longest path can win
B LOCAL_PREF tie → AS_PATH breaks it the "shortest path" intuition, but only as tie-break
C Tie down through ORIGIN, oldest route, to router-ID every early attribute equal, degenerate late tie-breaks
D Loop rejection (own ASN in path) route silently discarded — a "zero" output
E Export filtering (Gao–Rexford) a route exists but is not advertised onward
F AS_PATH prepending to lose on purpose making your own path longer deliberately
G MED compared / MED ignored → step 6 finishes it only within same neighbor AS — a "sign" trap
H Degenerate origin: empty / single-element AS_PATH the base case, path length 0 or 1
I Real-world word problem translate business relationships into a decision
J Exam twist: valley-free violation detection spot the illegal path shape

Each example below is labelled with the cell(s) it covers. Together they touch every row.


Cell A — Policy beats distance

Look at Figure s01. AS10 sits at the left as a white circle. Three arrows fan out to the right toward the three route labels R1 (top), R2 (middle), R3 (bottom). Two arrows are black (R1, R2 — the losers) and one arrow is red (R3 — the winner). Only the red arrow's label mentions "LP=300, highest", and a red caption in the top-right explains R3 wins despite being the longest path. The colour coding is: black = considered but rejected, red = the single chosen object. That red-versus-black split is the whole picture — the longest black-hop path won purely because its LOCAL_PREF sat highest on rung 1.

Figure — BGP — path vector, AS, policy routing

Cell B — Tie on policy, AS_PATH breaks it


Cell C — Everything ties, down through ORIGIN and oldest route to router-ID


Cell D — Loop rejection (the "zero" output)

Look at Figure s02. Three boxes hold the AS numbers of the path [90, 10, 4], drawn left-to-right as AS90 AS10 AS4, with origin AS4 on the right (BGP reads paths right-to-left). Black arrows point leftward between boxes, showing the direction the advertisement travelled. The middle box AS10 is drawn in red — because that number is AS10's own ASN sitting inside the very path AS10 just received. A red caption below spells out "10 is already in the path → REJECT (loop)". Colour coding: black = other ASes, red = the offending own-ASN. Seeing your own number already printed on the path is the whole loop test in one glance.

Figure — BGP — path vector, AS, policy routing

Cell E — Route exists but must NOT be exported


Cell F — Prepend to LOSE on purpose


Cell G — MED: comparable vs ignored, then step 6 finishes it


Cell H — Degenerate origin (empty / length-1 path)


Cell I — Real-world word problem


Cell J — Exam twist: spot the illegal path


Recall

Recall Which decision-ladder rung actually chose each cell's winner?

Cell A router picks by which rung? ::: Rung 1, LOCAL_PREF (policy); path length never consulted. Cell B router picks by which rung? ::: Rung 2, shortest AS_PATH, only because LOCAL_PREF tied. Cell C router picks by which rung? ::: Rung 7 (oldest route), confirmed again by rung 8 (lowest router-ID). Cell D outcome? ::: Route discarded by the loop test before the decision process even runs. Cell G: why does the smallest-MED route (R10) win, really? ::: Not on MED — R10 wins at step 6 on lowest IGP metric; MED only pruned R8 among AS70's routes. What are the three ORIGIN codes, best to worst? ::: IGP (0), then EGP (1), then INCOMPLETE (2); lower wins.

See also the parent BGP topic note, and for contrast Distance Vector and Count-to-Infinity, Hot-potato vs Cold-potato routing, and Route flap damping and BGP convergence.