MED and IGP Cost on Two Unequal ISP Exits
AS 65000's Nokia PE router has two eBGP exits for prefix 203.0.113.0/24. Path A is from ISP-A (AS 64500): next-hop 192.0.2.1, MED 50, AS_PATH 64500 64496, local-preference 100, IGP cost to next-hop 10. Path B is from ISP-B (AS 64501): next-hop 198.51.100.1, MED 10, AS_PATH 64501 64496, local-preference 100, IGP cost to next-hop 100. Both paths are eBGP, origin is IGP, and all other attributes are equal. The router uses default BGP best-path behavior; always-compare-med is not configured. A change ticket proposes enabling always-compare-med to make ISP-B primary because its MED is lower. Operations is concerned because ISP-B's link is a lower-bandwidth backup and its MED is set by the ISP, not by AS 65000. The prefix is currently active via one of the two paths, and traffic volumes are asymmetric. The design requires deterministic primary/backup behavior without relying on the ISP's MED.
1. Which path is selected under default behavior? Walk through the decision steps.
Read the worked answer
Local-preference is 100 on both. AS_PATH length is 2 on both. Origin is IGP on both. MED is compared only among paths from the same neighboring AS by default, and ISP-A and ISP-B are different neighbor ASes, so MED 50 versus 10 is not compared. Both paths are eBGP, so the eBGP-over-iBGP step ties. The IGP cost to next hop decides: 10 for ISP-A versus 100 for ISP-B. Path A wins. This is independent of the lower MED on Path B.
2. If the operator enables always-compare-med, which path wins and what operational risks follow?
Read the worked answer
With always-compare-med, MED is compared across different neighbor ASes. ISP-B's MED 10 is lower than ISP-A's MED 50, so Path B wins. Risks: MED is non-transitive and controlled by the ISP, so ISP-B can change it and cause unexpected failover; the setting changes decisions for all prefixes, not just this one; and traffic may move to the lower-bandwidth backup. The cleaner design is to leave default MED comparison and set local-preference 200 on Path A, or use a prefix-specific policy. Verify with show router bgp routes 203.0.113.0/24 detail.
3. If Path A were received via iBGP from a route reflector and Path B remained eBGP, how would that change the result?
Read the worked answer
BGP prefers eBGP over iBGP before considering IGP cost. If Path A is iBGP and Path B is eBGP, with equal local-preference and AS_PATH length, Path B wins even though Path A has IGP cost 10 and Path B has 100. To keep Path A primary, add a higher local-preference on the iBGP path or use a policy; do not rely on IGP cost. The iBGP next-hop must still be reachable, but reachability is not the tie-breaker once the eBGP preference applies.