16 Sep 2026, Wed

Multi-Exit Discriminator (MED): A Complete Guide to BGP MED

Multi-Exit Discriminator

Multi-Exit Discriminator (MED) is a BGP path attribute used to influence route selection when two autonomous systems have multiple connections between them. It allows one network to indicate which entry point it prefers for incoming traffic.

A multi exit discriminator value can help prioritize one link over another, making MED useful for traffic engineering, redundant connections, and multi-homed network designs. In general, a lower MED is preferred when the attribute is compared during BGP route selection.

However, MED is only one part of the BGP decision process. Its effectiveness also depends on the neighboring network’s routing policies and how MED comparison is configured.

What Is Multi-Exit Discriminator?

The Multi-Exit Discriminator (MED) is an optional BGP path attribute that provides information about the preferred path into an autonomous system when multiple connections exist between neighboring networks.

Consider two autonomous systems connected through two separate links:

                    AS 65020

                   /        \

              Link A        Link B

             MED 10        MED 50

                |              |

             Router A       Router B

                \              /

                 \            /

                    AS 65010

AS 65010 can advertise the same network prefix through both connections while assigning different MED values.

For example:

  • Link A → MED 10
  • Link B → MED 50

If the routes reach the MED comparison stage and the relevant routing conditions are satisfied, the lower value is preferred. Therefore, the neighboring AS can choose Link A as its preferred path toward AS 65010.

The key point is that MED influences the neighboring network’s route selection; it does not force that network to use a particular connection.

How Does MED Work in BGP?

BGP can learn multiple paths to the same destination. It then evaluates various path attributes and other routing information to select the best path.

MED is one of those attributes.

Suppose a company advertises the prefix 203.0.113.0/24 through two connections to the same ISP:

ConnectionMEDIntended Preference
Primary10Preferred
Secondary50Less preferred

When the ISP compares these routes under conditions where MED is applicable, the route with MED 10 is more attractive than the route with MED 50.

In simplified terms:

MED 10 < MED 50 → MED 10 is preferred

This makes MED useful when an organization wants to communicate which of several external links should be preferred for reaching its network.

Why Is MED Used?

Networks often maintain multiple external connections for redundancy, capacity, geographic diversity, or improved performance.

For example, an enterprise might have:

  • Two connections to the same ISP
  • Multiple data centers
  • Several IXP connections
  • Primary and backup Internet links
  • Geographically distributed network locations

Without a routing policy, the network may not use those connections in the way the administrator expects.

MED provides a way to communicate a preference to a neighboring autonomous system.

Common applications include:

Traffic Engineering

MED can help influence which external connection carries inbound traffic.

Primary and Backup Connections

A lower MED can be assigned to the preferred connection and a higher MED to the backup.

Geographic Optimization

Organizations with multiple locations can use routing policies to encourage traffic toward a more suitable entry point.

Link Utilization

Different MED values can help distribute or prioritize traffic across multiple connections.

Network Redundancy

MED can complement BGP failover strategies by establishing a preferred path while keeping another path available.

Lower MED Is Generally Preferred

One of the most important rules of multi exit discriminator is that a lower MED is generally preferred when MED values are compared.

For example:

PathMEDResult
Path A10Preferred
Path B30Less preferred
Path C100Least preferred

Therefore, an administrator who wants Path A to be preferred could assign it a lower MED.

This is different from attributes such as Local Preference, where a higher value is generally preferred.

A simple way to remember it is:

Lower MED = More preferred

However, this rule applies only when MED is actually reached and compared in the relevant BGP decision process.

Is MED a Transitive Attribute?

No. MED is a non-transitive BGP attribute.

This means MED is primarily intended to communicate routing information to a neighboring autonomous system rather than to propagate that preference throughout the Internet.

For example:

AS 65010 → AS 65020 → AS 65030

If AS 65010 sends a MED value to AS 65020, that does not mean AS 65030 will receive and use the same MED as an end-to-end routing preference.

This characteristic makes MED particularly useful for situations where neighboring autonomous systems have multiple direct connections.

When Does BGP Compare MED?

MED is not simply the first factor BGP examines.

BGP uses a sequence of decision criteria to determine its best path. Depending on the platform and configuration, attributes such as weight, local preference, locally originated routes, AS_PATH, origin, MED, and other factors can influence the decision.

This means a lower MED does not automatically win against every other route.

For example, suppose two routes exist:

Route A

Local Preference: 200

MED: 100

Route B

Local Preference: 100

MED: 10

The router may prefer Route A before MED becomes the deciding factor because Local Preference is evaluated earlier in common BGP implementations.

Therefore:

MED should always be evaluated in the context of the complete BGP path-selection process.

Is MED Compared Between Different Autonomous Systems?

This is an important operational consideration.

In many BGP implementations, MED is compared by default between paths learned from the same neighboring autonomous system.

For example:

Path A → AS 65020 → MED 10

Path B → AS 65020 → MED 50

These routes can be candidates for MED comparison.

But consider:

Path A → AS 65020 → MED 10

Path B → AS 65030 → MED 20

The router may not compare those MED values under its default behavior.

Some platforms provide configuration options that change MED comparison behavior.

For this reason, network engineers should check the specific router platform and configuration rather than assuming that all MED values are always directly comparable.

Multi-Exit Discriminator Example

Consider an organization with two BGP connections to the same ISP.

                       ISP

                     /     \

                    /       \

               Link A       Link B

               MED 10       MED 100

                  |             |

              Router A      Router B

                  \             /

                   \           /

                  Enterprise AS

The organization advertises the same prefix through both links.

Link A

Prefix: 198.51.100.0/24

MED: 10

Link B

Prefix: 198.51.100.0/24

MED: 100

If the ISP honors MED and the paths reach MED comparison without another attribute determining the winner, Link A is preferred.

The organization can therefore use:

MED 10 → Primary

MED 100 → Secondary

If Link A fails, the associated BGP route can be withdrawn, allowing the alternative connection to remain available.

Using MED for Primary and Backup Links

One of the simplest applications of MED is establishing a preferred and backup connection.

For example:

Primary Link   → MED 10

Backup Link    → MED 200

The lower MED makes the primary route more attractive when MED is considered.

This can be useful for:

  • Enterprise Internet connections
  • Data-center interconnections
  • ISP peering
  • Cloud connectivity
  • IXP connections

However, MED should not be considered a standalone failover mechanism. BGP session status, route advertisements, filtering policies, timers, and the neighbor’s routing policies also affect failover behavior.

MED and Inbound Traffic Engineering

MED is primarily useful for influencing inbound traffic.

Suppose a company has two links to the same provider:

                   ISP

                  /   \

                 /     \

          Connection A Connection B

             MED 10       MED 80

                 \         /

                  \       /

                  Company

The company can advertise its prefixes with different MED values.

If the provider honors MED and no other policy override the decision, the provider may prefer Connection A.

This can help an organization influence:

  • Which link receives traffic
  • Which data center handles traffic
  • Which geographic location is preferred
  • Which connection acts as a backup
  • How traffic is distributed between links

But there is an important limitation:

The receiving AS controls its own BGP policy.

Therefore, MED is a routing preference rather than a guaranteed command.

MED Does Not Guarantee Inbound Traffic Control

It is tempting to think that setting MED to 10 automatically forces all incoming traffic through that connection.

That is incorrect.

The neighbouring autonomous system may:

  • Ignore MED
  • Modify MED
  • Set its own Local Preference
  • Apply routing policies
  • Prefer another path
  • Use communities or other traffic-engineering mechanisms

Consequently, MED should be viewed as a signal of preference, not an absolute instruction.

This is particularly important when working with large ISPs or complex Internet Exchange environments.

MED vs. Local Preference

MED and Local Preference are often confused because both influence BGP route selection.

The easiest way to distinguish them is to ask:

Who is making the routing decision?

Local Preference

Local Preference is normally used inside an autonomous system to influence outbound traffic.

For example:

Your AS

 /    \

ISP A ISP B

If your organization wants its routers to prefer ISP A, Local Preference is typically an appropriate mechanism.

MED

MED is normally used to communicate a preference to a neighboring AS about how that AS should reach your network.

A simplified comparison:

AttributeMain Purpose
Local PreferenceControl preferred outbound path
MEDInfluence preferred inbound entry point
AS_PATHInfluence path selection through AS-path length
BGP CommunitiesCommunicate routing-policy information
WeightLocal/vendor-specific path preference

MED vs. AS-Path Prepending

AS-path prepending is another commonly used method for influencing BGP route selection.

With MED:

Link A → MED 10

Link B → MED 100

With AS-path prepending, an administrator artificially lengthens the AS_PATH of a less-preferred route:

Preferred:

AS 65010

Less preferred:

AS 65010 → AS 65010 → AS 65010

The longer path can become less attractive.

Key differences

CharacteristicMEDAS-Path Prepending
Main purposeSignal preferred entry pointMake a path less attractive
DirectionPrimarily neighboring ASCan influence routes beyond direct neighbor
Lower/higherLower is generally preferredShorter AS_PATH is generally preferred
TransitiveNon-transitiveAS_PATH is transitive
ControlDepends strongly on neighbor policyAlso depends on routing policy

Neither mechanism is universally better. The appropriate choice depends on the topology, provider policies, and traffic-engineering objective.

MED in Multi-Homed Networks

Multi-homed networks often have several external connections.

For example:

                       ISP

                    /       \

                   /         \

             Connection 1 Connection 2

                MED 10       MED 50

                    |           |

                 Router 1     Router 2

                    \           /

                     \         /

                    Enterprise

The enterprise can advertise its prefixes through both routers while assigning different MED values.

A common policy might be:

Connection 1 → MED 10 → Preferred

Connection 2 → MED 50 → Secondary

This can encourage the ISP to use Connection 1 when both paths are available.

For more sophisticated designs, MED can be combined with BGP communities, Local Preference, AS-path prepending, prefix filtering, and other routing policies.

MED and Internet Exchange Points

Internet Exchange Points (IXPs) can create additional routing options for organizations with multiple peering connections.

For example:

                    IXP

                  /     \

             Location A Location B

                 |          |

              Router A    Router B

                  \          /

                   \        /

                   Your AS

An organization might prefer one location because it offers:

  • Lower latency
  • Higher capacity
  • Better connectivity
  • Lower internal routing cost
  • Greater reliability

MED can be part of a policy designed to communicate that preference to a neighboring network.

However, route-server environments require careful analysis because the treatment of BGP attributes depends on the route-server architecture and configuration.

MED and Route Servers

Route servers are commonly used at Internet Exchange Points to simplify the exchange of routes between participants.

A route server can distribute routes between multiple peers while remaining outside the actual forwarding path.

This creates an important consideration for MED.

Traditional eBGP behavior can modify certain BGP attributes, while route-server configurations may use specific mechanisms to preserve attributes between participants.

Therefore, if MED is being used across an IXP route server, network operators should verify:

  1. How MED is received.
  2. Whether the route server preserves the attribute.
  3. Whether the receiving participant compares MED.
  4. Whether local routing policies modify the route.
  5. Whether another BGP attribute takes precedence.

Never assume that a MED value will behave identically in every peering environment.

MED and IGP Metrics

In larger networks, external route preferences may need to reflect internal network costs.

An organization may have several BGP-speaking routers connected to different external locations. The preferred external path could depend on how efficiently the internal network can reach that router.

Some routing platforms support mechanisms that allow MED values to be influenced by internal IGP metrics.

For example:

External Path A

      |

   Router A

      |

 IGP Cost: 10

External Path B

      |

   Router B

      |

 IGP Cost: 50

A network might want the external routing policy to reflect those internal costs.

This approach can be useful but should be designed carefully because changes in the IGP can affect BGP policy and, consequently, traffic patterns.

How to Configure MED

MED configuration is vendor- and platform-specific. Network engineers commonly use routing policies, route maps, policy statements, or equivalent mechanisms to assign MED values.

A simplified Cisco-style example might look conceptually like:

route-map PRIMARY permit 10

 set metric 10

A secondary policy could use:

route-map BACKUP permit 10

 set metric 100

The policies are then applied to the appropriate BGP neighbor or outbound route advertisements.

On other platforms, MED may be configured using different policy mechanisms.

Because BGP configuration syntax varies by vendor and software version, production deployments should be based on the documentation for the exact router platform rather than copied directly from a generic example.

Advantages of Multi-Exit Discriminator

MED offers several practical benefits.

Simple Path Preference

It provides a straightforward way to communicate a preferred entry point to a neighboring AS.

Useful for Multiple Connections

It is particularly valuable when two networks have more than one interconnection.

Supports Primary/Backup Designs

Different MED values can establish a preferred path and a secondary path.

Helps With Traffic Engineering

MED can contribute to inbound traffic-engineering strategies.

Works Alongside Other BGP Attributes

MED can be integrated into a broader routing policy rather than being used independently.

Multi-Exit Discriminator vs. Other BGP Attributes

The following comparison provides a quick overview:

AttributePrimary FunctionTypical Preference
MEDSuggest preferred inbound path to a neighborLower
Local PreferenceSelect preferred outbound path within an ASHigher
AS_PATHInfluence path selection based on AS-path lengthShorter
WeightLocal path preference on supported platformsHigher
BGP CommunityCommunicate routing-policy informationPolicy-dependent

The best attribute depends on the routing objective.

If you want to influence how your network sends traffic, Local Preference is often more relevant.

If you want to communicate which connection a neighbor should prefer for reaching your network, MED may be appropriate.

Final Takeaway

Multi-Exit Discriminator (MED) is a valuable BGP attribute for networks with multiple connections to the same neighboring autonomous system. It allows an organization to communicate which external entry point it would prefer a neighbor to use.

The basic principle is straightforward:

Lower MED is generally preferred when MED is compared.

But effective BGP routing requires looking beyond that single rule. MED operates alongside other attributes such as Local Preference, AS_PATH, origin, IGP metrics, and routing policies. The receiving autonomous system can also modify or ignore MED.

For this reason, the best way to use a multi exit discriminator is to treat it as a policy signal within a broader traffic-engineering design. When properly configured and monitored, MED can help organizations manage primary and backup connections, optimize multiple interconnections, and build more predictable BGP routing behavior.

Frequently Asked Questions

Q: What is Multi-Exit Discriminator in BGP?

A. Multi-Exit Discriminator, or MED, is a BGP path attribute that allows a network to communicate a preference for one entry point over another when neighboring autonomous systems have multiple connections.

Q: What does a lower MED mean?

A. A lower MED generally indicates a more preferred path when MED is compared during BGP route selection.

Q: Is MED transitive?

A. No. MED is a non-transitive BGP attribute.

Q: What is the purpose of MED?

A. MED is mainly used to influence how a neighboring autonomous system selects between multiple routes or connections toward your network.

Q: Does MED control inbound traffic?

A. It can influence inbound traffic, but it does not guarantee the path. The neighboring AS ultimately controls its own routing policy.

Q: Does MED control outbound traffic?

A. Not directly. Local Preference is generally used to influence outbound route selection within an autonomous system.

Q: Is MED compared between different ISPs?

A. Under common default behavior, MED is generally compared between paths learned from the same neighboring AS. Specific router configurations can modify this behavior.

Q: Can MED be used with AS-path prepending?

A. Yes. Network operators can combine MED with AS-path prepending and other BGP policies when more sophisticated traffic engineering is required.

Q: Is MED the same as Local Preference?

A. No. Local Preference is primarily used to influence outbound path selection within an AS, while MED is used to communicate a preference to a neighboring AS.

Read More:

Understanding Any Time Interrogation in Modern Security Systems

Leave a Reply

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