BGP Path Selection in Dual-Homed WANs: Why Deterministic MED Prevents Oscillation
How non-deterministic BGP MED comparisons cause route oscillation across dual-homed enterprise WAN links, and why bgp deterministic-med stabilizes inbound traffic.
βWhen two upstream providers advertise identical prefixes with different MED values, the order in which BGP learns those routes should never dictate where your traffic exits.β
The Failure Mode: Order-Dependent Best-Path Selection
In dual-homed enterprise edge topologies, engineers routinely use Multi-Exit Discriminator (MED) to influence inbound path preference across two links to the same Autonomous System. Without bgp deterministic-med enabled, classic BGP implementations compare routes in chronological arrival order rather than grouping candidates by neighboring AS first.
If an upstream peer flaps, the arrival order changes. A route from AS 65001 that previously lost to AS 65002 can suddenly win, triggering asymmetric routing and intermittent TCP drops across stateful edge firewalls.
Architectural Fix
- Enable
bgp deterministic-medglobally on every border router so paths are grouped by neighbor AS before MED evaluation. - Avoid
bgp always-compare-medunless both upstream ISPs explicitly coordinate their internal IGP metrics (which is rare in multi-carrier WANs). - Pair with Local Preference for outbound determinism: Use
LOCAL_PREFinside your AS for outbound steering and reserve MED strictly for inbound hints to a single carrier.
Verification
- Run
show ip bgp <prefix>before and after a controlled peer soft-reset (clear ip bgp <peer> soft in). - Confirm the best-path selection remains identical regardless of peer session uptime.
π€ Interrogate This Field Note in Digital Twin
Click a prompt below to immediately stream an architectural analysis from Virtual Sachin's RAG cognitive twin:
Sachin Kumar Sharma
Director (Cloud & Infrastructure Architecture) | Principal Agentic AI Architect | 20+ Yrs Exp
Architecting resilient multi-cloud enterprise landing zones, SDN overlay fabrics, DevSecFinOps automation pipelines, and autonomous Agentic AI platforms.
π‘ Related Engineering Articles
Azure ExpressRoute & BGP: Multi-Region Hybrid Routing Architecture
How we fixed asymmetric routing drops across multi-region Azure ExpressRoute circuits using BGP Local Preference and AS-Path Prepending.
I Learned BGP on a Delhi Rooftop, Not in a Lab
How aligning WiMAX antennas at -82 dBm in 45Β°C heat taught me more about network fundamentals than any certification course ever did β and why infrastructure engineers are better prepared for AI than they think.
BGP as a FinOps Tool: Optimizing Cloud Data Egress Costs
How we turned BGP Local Preference and MED attributes into financial steering levers, cutting an enterprise cloud data egress bill by 70%.
π¬ Stay Updated on Tech Releases
Sign up to get notified when I publish new production war stories, agentic AI architecture blueprints, or open-source infrastructure tools.