Multi-Exit Discriminator (MED)

MEDs are used when an AS has multiple connections to another AS. Routes are advertised on both connections with different MEDs to specify a preferred path, typically for purposes of load balancing. By default, the MED for routes from different Autonomous Systems to the same destination are not compared. When two routes to the same destination are received from peers in different Autonomous Systems, the MED feature allows you to specify whether to compare those MEDs. When choosing between these routes, assuming that nothing else makes one preferable to the other (such as a configured policy), the values of the differing MEDs are used to choose the route to use. In this comparison, the route with the lowest MED is preferred.

By default, BGP sorts paths based on the neighbor AS and MED so that paths are sorted the same way every time. This results in a deterministic best-path selection. BGP can be configured to not take the neighbor AS into consideration when comparing the MED for each path. In this case, BGP compares MEDs when multiple routes with differing MEDs are received from peers in different autonomous systems.

The route MED value is set using a BGP route-map applied to the route.

Routes without a configured MED are treated as having the best possible MED.

Use the bgp deterministic-med command, in BGP configuration mode, to enable the deterministic processing of MEDs based upon the neighbor AS and MED. Deterministic MED is the default behavior.

The following example disables BGP deterministic MED for BGP router 65151:

System(su-config)->router bgp 65151
System(su-config-bgp)->no bgp deterministic-med
System(su-config-bgp)->

Use the bgp always-compare-med command, in BGP configuration mode, to compare MEDs when multiple routes with differing MEDs are received from peers in different autonomous systems.

The following example enables the comparison of MEDs from different ASs:

System(su-config)->router bgp 65151
System(su-config-bgp)->bgp always-compare-med
System(su-config-bgp)->