12.21 MED Attribute

MED = “Multi-Exit Discriminator” – it is also called the “BGP Metric”

The lowest value is preferred.

It is exchanged between EBGP peers to determine which path in the local AS is preferred to the EBGP neighbor. It is an alternative to AS Path prepending. For example:

In the example, R1 in AS 65020 sets the MED to R2 at 150 and the metric to R3 at 200. R2 and R3 (in AS 65010) receive these values, and if no better attribute is available, they choose the path through R2 (lower MED) tor each R1.

This is R1’s attempt to control BGP policy in AS 65010. There is no guarantee that R2 and R3 will abide by this, as they could override the MED using weight, local preference, etc.

R2 and R3 only compare MED because (a) there is no better metric for path selection, and (b) they are members of the same AS. By default, neighbors in different ASNs do not compare MED.

MED is different than local preference because it is only exchanged between eBGP peers in connected ASNs, where local preference is only exchanged between iBGP neighbors.

By default, a MED value is zero. This default behavior can be changed for all outbound updates to neighboring ASNs using the default-metric number command.