Rule: accept ⟺X∈/P. Here X=AS34 and the path is P=[56,34,90].
Since 34∈P, AS34 rejects it — accepting would create a loop (the route already went through AS34 once).
What we do: since LOCAL_PREF (step 1) ties, we fall to step 2 — shortest AS_PATH.
∣Ra∣=3, ∣Rb∣=2.
Fewer AS hops wins → R_b (2 hops) is chosen.
Why this step matters: AS_PATH length is a tie-breaker, used only because policy (LOCAL_PREF) didn't already decide. Here it did the job because policy was a tie. (MED — the lower-is-better neighbor hint defined above — was equal, so it did not intervene either.)
R3 has the highest LOCAL_PREF (300). Decision made at step 1 — R3 wins. We never even reach step 2.
Why: sending traffic toward a customer means the customer pays AS100 for transit, so it's the most profitable exit. AS100 prefers it even though R3 is the longest path (4 hops vs 2). This is policy routing in one line: money first, distance second. ✔
First, the shape of a valley-free path. In the figure, each circle is an AS and its height shows its tier: customers sit low, providers sit high. Follow the route left-to-right: it climbs UP on customer→provider hops (green labels), may take at most one PEER hop across the top (coral label), then descends DOWN on provider→customer hops (lavender labels). The red arrow marks the one thing that is forbidden — going up again after you have already gone down, which digs a "valley."
What "valley-free" means (from the picture): you may go up (customer→provider) zero or more times, then take at most one peer hop, then go down (provider→customer) zero or more times. Never up again after you've gone down. A "down then up" is a valley — it means some AS in the dip is giving free transit to two parties who don't pay it, which no AS does.
Now classify the given sequence:
customer→provider = UP ✅
provider→customer = DOWN (we have now started descending)
customer→provider = UP again ❌ — this is up after down = a valley.
Verdict: NOT valley-free. The illegal step is the third hop: after the route already went downhill in step 2, step 3 goes back uphill, forming a valley. The AS at the bottom of that valley (the customer in step 2 = provider in step 3) would have to carry traffic between two networks that don't pay it — Gao–Rexford export rules (see the table above) forbid advertising the route that way, so this path can't exist. ✔
AS400 (customer of AS100) receives from its customer AS70, prepends: [400,70]
AS100 receives from its customer AS400, prepends: [100,400,70]
So AS100 holds [100, 400, 70].
(b) Export to provider AS200? The route was learned from a customer (AS400). Gao–Rexford table (row "learned from Customer"): a customer-learned route may be exported to everyone — customers, peers, and providers. So yes, AS100 may advertise [100,400,70] up to AS200. It becomes [200,100,400,70] at AS200 after AS200 prepends.
Why AS100 is happy to do this: the route reaches AS100's own customers (AS400, AS70), and advertising it upward lets the whole internet reach those paying customers — more traffic to customers = more money.
(c) AS200 advertises back toward AS100: the path arriving at AS100 would be [200,100,400,70]. AS100 runs the loop test: is 100∈[200,100,400,70]? Yes. → AS100 rejects it. The AS_PATH is its own proof of non-loopiness; no global map needed. ✔
(Here LP is just shorthand for LOCAL_PREF, the policy number defined above — higher wins.)
Requirement: customer > peer > provider in preference, and this must dominate path length. Since LOCAL_PREF is step 1 and AS_PATH is step 2, any assignment with
LPcustomer>LPpeer>LPprovider
achieves this — path length can never override it.
Step 1 compares LOCAL_PREF first: 300>100 → customer route wins immediately. BGP never reaches step 2, so the 9-vs-1 hop difference is irrelevant. ✔
Why it works: the decision process is strictly lexicographic (dictionary order) — it fully resolves at the first step where values differ. Since LOCAL_PREF differs here, nothing below it matters.
Apply the six steps in order; drop losers at each step.
Step 1 — Highest LOCAL_PREF. Values: W=100, X=200, Y=200, Z=200. W (100) is lowest → eliminate W. Survivors: X, Y, Z (all 200).
Step 2 — Shortest AS_PATH. Lengths: X=5, Y=5, Z=4. Z=4 is strictly shortest → eliminate X and Y, leaving Z.
Only one route survives step 2 → Z is the best path.
Sanity note on the trap: X and Y (peers, LP 200, 5 hops) had equal LOCAL_PREF to Z, so step 1 did not eliminate them. It was step 2 (shortest AS_PATH) that decided, because Z's path (4) is shorter than X/Y's (5). MED, eBGP/iBGP, IGP cost, and Router-ID were never consulted — the process halted at step 2.
Now X and Y are tied through step 2. Continue down the ladder:
Step 3 — Lowest MED. MED is compared here only because both routes came from the same neighbor AS (AS20) — that is the condition for MED to be comparable. Both MED = 10 → tie.
Step 4 — eBGP over iBGP: both are learned over eBGP (directly from another AS) → tie.
Step 5 — Lowest IGP cost to egress (hot-potato): X's internal cost to its exit = 8, Y's = 3. Y is lower → Y wins.
This is hot-potato routing: among otherwise-equal exits, dump the traffic out the nearest egress (cheapest internal cost) to get it off your network fast. Winner: Y. ✔
(Step 6, lowest Router-ID, would only trigger if IGP costs also tied.)
Q: In what order does BGP break ties? ::: 1 LOCAL_PREF (policy/money), 2 shortest AS_PATH, 3 lowest MED (same-neighbor only), 4 eBGP over iBGP, 5 lowest IGP cost (hot-potato), 6 lowest Router-ID.
Recall The single most-tested fact
Q: Why can a longer AS_PATH win? ::: Because LOCAL_PREF (step 1) outranks AS_PATH length (step 2); a customer route (high LOCAL_PREF, earns money) beats a shorter provider route (low LOCAL_PREF).
See also:Distance Vector and Count-to-Infinity (why path vector exists), Autonomous Systems and ASN allocation, IP addressing and CIDR prefixes, Internet topology — Tier-1, transit, peering, OSPF and link-state routing (the intra-domain contrast).