Today’s Question
Try to answer before scrolling to the reveal. This is the kind of question that appears on CCNA 200-301, CompTIA Network+ N10-009, and AWS ANS-C01 exams:
A router running BGP has two paths to the same destination prefix. Both paths have identical Local Preference and AS Path length. Which BGP attribute is evaluated first — before Local Preference — to select the best path?
C. Weight is evaluated first. Weight is a Cisco-proprietary attribute that is local to the router only — it is never advertised to peers. The higher the Weight, the more preferred the path. Because it never leaves the local router it is the easiest knob to pull for traffic engineering without affecting the rest of the network.
The Full BGP Best-Path Algorithm
BGP compares candidate paths in a fixed order. The moment two paths differ on an attribute, the comparison stops and a winner is declared. Here is the standard Cisco IOS order — worth memorising as a sequence, not just a list:
| # | Attribute | Prefer | Scope |
|---|---|---|---|
| 1 | Weight | Higher | Local router only (Cisco) |
| 2 | Local Preference | Higher | Within the AS |
| 3 | Locally originated | Local wins | network/redistribute vs iBGP learned |
| 4 | AS Path length | Shorter | Exchanged between ASes |
| 5 | Origin code | IGP > EGP > ? | How the prefix entered BGP |
| 6 | MED | Lower | Hint to neighbouring AS |
| 7 | eBGP over iBGP | eBGP wins | — |
| 8 | IGP metric to next-hop | Lower | Interior path cost |
| 9 | Router ID | Lower | Last tiebreaker |
A common mnemonic taught in CCNA bootcamps is We Love Oranges As Oranges Mean Pure Refreshment (Weight, Local-pref, Originated, AS-path, Origin, MED, Paths-eBGP/iBGP, Router-ID). Use whichever helps it stick.
Why Each Attribute Exists
Weight — The Local Override
Weight defaults to 32768 for routes originated by the local router and 0 for routes learned from peers. Because it is never propagated, a network engineer can set Weight on a single router to steer traffic out a preferred link without touching route policies on any other device. It is powerful precisely because its blast radius is zero.
Local Preference — The AS-Wide Signal
Local Preference travels with routes inside an Autonomous System via iBGP. The default value is 100. Raising it on routes received from a preferred upstream provider tells every router in the AS to exit there. This is how large networks implement primary/backup ISP policies: primary uplink gets local-pref 200, backup gets local-pref 100.
AS Path — The Distance Proxy
AS Path lists every AS a route has traversed. BGP prefers shorter paths, which usually (but not always) means fewer hops. AS Path prepending — artificially appending your own AS number multiple times — is the standard way to make a link look less attractive to remote peers without changing any attribute on their side.
MED — The Polite Suggestion
MED (Multi-Exit Discriminator) is only compared between paths from the same neighbouring AS by default. It is a hint from one AS to another saying “please enter our network here rather than there.” Remote ASes are free to ignore it. Because it is only compared within the same peer AS, MED trips up many candidates who expect it to behave like a universal metric.
Where Exam Questions Go Wrong
Most incorrect answers on this topic fall into three traps:
- Confusing Weight and Local Preference. Both prefer higher values, but Weight is router-local while Local Preference spans the AS. On a Juniper device, Weight does not exist — the equivalent is
local-preference. Exam questions that specify Cisco IOS expect Weight first. - Thinking shorter AS Path always wins. AS Path is step 4. Weight and Local Preference override it. A 10-hop path with Weight 50000 beats a 2-hop path with Weight 0.
- Misplacing MED. MED feels like it should be early in the list because it sounds like a metric. It is actually step 6, after Origin, and is only compared when the competing paths come from the same AS.
Real-World Example: Dual-ISP Design
Imagine a company with two upstream providers — ISP-A (primary, 10 Gbps) and ISP-B (backup, 1 Gbps). Both advertise a default route into the company’s eBGP session. Here is how each attribute layer is used in practice:
- Local Preference 200 is set on routes from ISP-A, 100 on ISP-B. Every router in the AS prefers ISP-A without any further config.
- If ISP-A goes down, Local Preference drops out of the picture and ISP-B’s routes win by default.
- For inbound traffic, the company sets AS Path prepend on ISP-B advertisements, making ISP-A look shorter to the rest of the internet.
- If ISP-A and ISP-B are both multihomed customers of a transit provider, MED can signal which link the transit provider should prefer for inbound delivery.
This layered approach is exactly what AWS ANS-C01 tests when it asks about hybrid connectivity, Direct Connect with VPN failover, and BGP route preferences in Transit Gateway routing tables.
Relevant Certifications
BGP path selection shows up across multiple certification tracks at different depths:
- CCNA 200-301 — Conceptual understanding of BGP attributes and path selection order; expect 1–3 questions.
- CompTIA Network+ N10-009 — BGP as an exterior routing protocol, eBGP vs iBGP distinction, and basic attribute awareness.
- AWS ANS-C01 — Deep scenario questions on BGP over Direct Connect, VPN failover, local_preference vs AS prepend for route manipulation in AWS hybrid architectures, and BGP communities.
If you want to test yourself with more questions at this depth, the CCNA practice pack on CertQuests has 110 questions covering routing protocols, switching, and automation. The AWS ANS-C01 pack goes deeper on BGP in hybrid cloud scenarios.