Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Cloud Security Tips Cloud Security Tips

What is cloud security

Cloud Security Tips Cloud Security Tips

What is cloud security

  • Home
  • About us
  • Contact us
  • Home
  • About us
  • Contact us
Subscribe
Close

Search

Network diagram with multiple routing paths between routers — multi-exit discriminator BGP
Security Tips

Multi-Exit Discriminator (MED): How It Controls BGP Inbound Traffic

By admin
November 3, 2026 7 Min Read
0

When two networks connect at more than one place, a simple question becomes hard: which door should traffic use? The multi-exit discriminator, usually shortened to MED, is the Border Gateway Protocol (BGP) attribute that answers it. It lets one autonomous system (AS) tell its neighbor which entry point it prefers for traffic coming into its network. Used well, MED balances load, avoids congested links, and makes failover predictable. Used carelessly, it can be ignored or overridden, leaving operators wondering why traffic still takes the wrong path.

This guide explains what MED is, how it influences inbound traffic between two autonomous systems connected at multiple points, where it sits in BGP path selection, how it differs from local preference, and how to configure it safely. It also includes a worked two-link example with numbers.

Table of Contents

Toggle
  • What Is the Multi-Exit Discriminator?
  • How MED Influences Inbound Traffic Between Two Autonomous Systems
  • Worked Example: A Two-Link Decision With Numbers
  • Where MED Sits in the BGP Path-Selection Order
  • MED vs. Local Preference: Opposite Directions
    • Configuration Examples
  • Common MED Pitfalls and Security Considerations
  • Frequently Asked Questions
    • What is the multi-exit discriminator in BGP?
    • Does a lower or higher MED win?
    • Does MED control outbound or inbound traffic?
    • Why is my MED value being ignored?
    • Can MED load-balance traffic across two links?

What Is the Multi-Exit Discriminator?

The multi-exit discriminator is an optional, non-transitive BGP path attribute, also called MULTI_EXIT_DISC. It is a numeric hint attached to a route advertisement. The advertising AS sets the value, and the receiving AS uses it when it has more than one path to the same destination from the same neighboring AS. A lower MED value is preferred. If no MED is set, BGP treats it as zero, the lowest possible value.

MED is non-transitive, so it is not passed on to a third AS. If AS 100 advertises a route to AS 200 with MED 50, AS 200 may use that value to choose between its links to AS 100, but it does not forward the original MED to AS 300. MED is also optional, so a neighbor is not required to honor it, and other BGP attributes examined earlier in path selection can override it entirely.

How MED Influences Inbound Traffic Between Two Autonomous Systems

Imagine AS 65001 connects to provider AS 65000 at two points: a fast link in New York and a slower, cheaper link in Chicago. Both can carry traffic to your prefixes, but you want most inbound traffic to enter through New York, because that path has lower latency to your main data center. You cannot directly control routing inside the provider’s network, but you can influence its choice by advertising your routes with different MED values on each link.

On the New York link, advertise your prefix with MED 10. On the Chicago link, advertise the same prefix with MED 100. When the provider compares the two paths, and if all earlier selection steps are equal, it prefers the lower MED and sends traffic through New York. Chicago remains as a backup. If New York fails, the provider withdraws that path and Chicago becomes the best remaining path.

The key point is that MED influences inbound traffic, not outbound traffic. It is set on routes you advertise outward, but its effect is felt on traffic coming back in. For outbound control, use local preference inside your own AS. Confusing those directions is one of the most common MED mistakes.

Worked Example: A Two-Link Decision With Numbers

Consider AS 65001 advertising 203.0.113.0/24 to AS 65000 over two links. The provider receives both advertisements. Weight, local preference, AS path length, and origin are all equal. The only difference is MED.

Link Advertised MED Provider’s choice
New York, 10 Gbps 10 Best path
Chicago, 1 Gbps 100 Backup path

Because 10 is lower than 100, the provider installs New York as best and forwards inbound traffic for 203.0.113.0/24 through New York. Now suppose New York traffic grows to 9 Gbps and latency rises. Change the New York MED from 10 to 200, while Chicago stays at 100. On the next update, the provider compares 200 against 100 and moves the best path to Chicago. No link failed and no prefix was withdrawn; only MED changed, yet the inbound flow moved.

Note that MED alone cannot create a 70-30 split for a single prefix, because BGP selects one best path per prefix. To split traffic, advertise different prefixes with different MED values, or combine MED with other traffic-engineering tools.

Where MED Sits in the BGP Path-Selection Order

BGP works through an ordered list of criteria and stops at the first one that distinguishes the paths. The widely used Cisco order below shows why MED is often weaker than operators expect.

Step Criterion Preferred value
1 Weight (Cisco-specific) Highest
2 Local preference Highest
3 Locally originated route Locally originated first
4 AS path length Shortest
5 Origin code IGP, then EGP, then Incomplete
6 Multi-exit discriminator (MED) Lowest
7 eBGP over iBGP eBGP first
8 Lowest IGP metric to next hop Lowest
9 Oldest eBGP path, then lowest router ID Oldest, then lowest

Weight, local preference, AS path length, and origin are all checked before MED. If your neighbor sets a different local preference for one link, your MED will never be reached. Likewise, if one path has a shorter AS path, MED cannot rescue the longer path. MED only decides when everything before it is tied.

By default, BGP compares MED only among paths from the same neighboring AS. Some routers offer a command to compare MED across all paths, often called bgp always-compare-med, but enabling it can produce surprising results and should be tested carefully.

MED vs. Local Preference: Opposite Directions

MED and local preference are often confused because both influence path choice, but they work in opposite directions. Local preference is set inside your own AS and controls outbound traffic: which exit your routers prefer when sending traffic out. It is not sent to external neighbors. MED is set on routes advertised to a neighbor and controls inbound traffic: which entry point that neighbor prefers when sending traffic to you.

A useful memory aid: local preference is your voice inside your house, while MED is a polite suggestion to your neighbor about which of your doors to knock on. You control local preference directly, but you only influence your neighbor with MED, because your neighbor’s own policies still come first.

Treat the two as a pair and document them together. If outbound traffic leaves through Chicago while inbound traffic returns through New York, asymmetric routing can occur. That is not always harmful, but it can confuse firewalls and troubleshooting, so it should be a deliberate choice, not an accident.

Configuration Examples

On Cisco IOS, a route map can set MED on advertised routes. The example below sets MED 10 on the preferred link and MED 100 on the backup link. Replace the neighbor addresses with your own values and apply the route map outbound to the correct neighbor.

route-map MED-PREFERRED permit 10
set metric 10
route-map MED-BACKUP permit 10
set metric 100

After applying the configuration, verify on the receiving router. Check that both paths are present, that the MED values match your intent, and that the best path is the one you expected. If the best path does not change, check the earlier selection steps first, especially local preference and AS path length, before assuming MED is broken.

Common MED Pitfalls and Security Considerations

MED can be ignored, and that is by design. A neighbor may strip it, reset it on import, or override it with its own policy. Never assume that setting MED guarantees a traffic pattern. Monitor actual traffic on each link after a change, and keep a rollback plan.

Deterministic MED is another subtlety. Without deterministic comparison, the order in which paths arrive can affect the result. The bgp deterministic-med command makes comparison order-independent and is recommended when you rely on MED for predictable behavior.

From a security perspective, MED is a hint, not an authentication mechanism. The greater risk is operational: an accidental MED change can shift large volumes of traffic onto a link that cannot carry them, causing congestion or an outage. Protect BGP sessions with authentication and prefix filtering, and monitor link utilization after any MED change.

Continuity also matters. When a control plane restarts, forwarding should not collapse while BGP reconverges. Related resilience techniques help, such as non-stop forwarding, which keeps packets flowing during a control-plane restart. When traffic shifts unexpectedly, inspecting actual flows helps too, as explained in this guide to what packet capture is and how it works.

Frequently Asked Questions

What is the multi-exit discriminator in BGP?

It is an optional, non-transitive BGP attribute that lets an AS suggest which of several links a neighboring AS should prefer for inbound traffic. A lower MED value is preferred.

Does a lower or higher MED win?

A lower MED wins. A missing MED is treated as zero, so it beats any positive MED value when the comparison reaches the MED step.

Does MED control outbound or inbound traffic?

MED controls inbound traffic. You set it on routes you advertise outward, and your neighbor uses it to choose how traffic enters your network. Local preference controls outbound traffic inside your own AS.

Why is my MED value being ignored?

Usually because an earlier path-selection step already decided the winner, such as local preference or AS path length, or because your neighbor resets MED on import. MED is also compared only among paths from the same neighboring AS by default.

Can MED load-balance traffic across two links?

Not by percentage for a single prefix, because BGP picks one best path per prefix. You can split traffic by advertising different prefixes with different MED values, or by combining MED with other traffic-engineering methods.

In short, the multi-exit discriminator is a small number with a large operational effect. It does not override your neighbor’s policy, it does not travel beyond the neighboring AS, and it only matters when earlier criteria are tied. Within those limits, it is a precise, reversible tool for steering inbound traffic and keeping a backup link ready. Set it deliberately, verify it on the receiving router, monitor the traffic that follows, and document the values you advertise.

Author

admin

Follow Me
Other Articles
Security professional reviewing an application security dashboard — application security manager
Previous

Application Security Manager: What the Role Does and How to Become One

BigCommerce Solutions — Learn. Grow. Thrive. Find quality solutions and USA-based project support
Next

BigCommerce Multi-Storefront: Running Multiple Brands, Regions, and B2B/B2C Channels from One Account

No Comment! Be the first one.

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Recent Posts

    • Compliance Risk Assessment: A Complete Guide for 2026
    • SX SFP Module: What It Is, How It Works, and When to Use It
    • Hotspot 2.0 (Wi-Fi Passpoint): What It Is and How It Works
    • Volume Boot Record (VBR): What It Is, How It Works, and How to Fix It
    • Can Website Owners See Who Visits Their Website? What They Can (and Cannot) See

    Recent Comments

    1. Compliance Risk Assessment: A Complete Guide for 2026 on ISO 27001 Compliance: What It Is, How to Get Certified, and How to Stay Compliant
    2. SX SFP Module: What It Is, How It Works & When to Use It on Network Access Control: What It Is, How It Works, Types and Examples
    3. Hotspot 2.0 (Wi-Fi Passpoint): What It Is & How It Works on WIPS: What Is a Wireless Intrusion Prevention System?
    4. Volume Boot Record (VBR): What It Is & How to Fix It on Hypervisor: What It Is, Types, Security Risks and How to Harden It
    5. Can Website Owners See Who Visits? What They See & Can't See on California Consumer Privacy Act (CCPA): What It Is, Your Rights, and How to Comply in 2026

    Archives

    • November 2026
    • October 2026
    • September 2026
    • August 2026
    • July 2026
    • June 2026
    • May 2026
    • February 2026

    Categories

    • Blog
    • Business
    • Security Tips
    • Tech
    • Travel
    • Uncategorized
    Copyright 2026 — Cloud Security Tips. All rights reserved. Blogsy WordPress Theme

    Powered by CookieAdmin
    Necessary cookies enable essential site features like secure log-ins and consent preference adjustments. They do not store personal data.
    None
    Functional cookies support features like content sharing on social media, collecting feedback, and enabling third-party tools.
    None
    Analytical cookies track visitor interactions, providing insights on metrics like visitor count, bounce rate, and traffic sources.
    None
    Advertisement cookies deliver personalized ads based on your previous visits and analyze the effectiveness of ad campaigns.
    None
    Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.
    None
    Powered by CookieAdmin