The Multi-Exit Discriminator (MED) is a BGP attribute used to influence the routing decisions between different Autonomous Systems (ASes). It’s specifically useful when an AS has multiple exit points or connections to another AS, and it wants to indicate to the neighboring AS which of these exits is preferred.
MED is an optional, non-transitive BGP attribute that is used to suggest to neighboring ASes the preferred route into the advertising AS.
It helps to convey to external neighbors which path should be preferred for traffic entering the AS. It does not affect routing within the AS but influences how external neighbors choose among multiple paths to reach the AS.
MED in Path Selection
When BGP evaluates multiple routes to the same destination, it considers MED after other criteria, such as weight and local preference. Here’s how MED fits into the BGP path selection process:
- Highest Weight: Preferred.
- Highest Local Preference: Preferred.
- Shortest AS Path: Preferred.
- Lowest Origin Type: Preferred.
- Lowest MED: Preferred.
- eBGP over iBGP: Preferred.
- Lowest IGP Metric to BGP Next Hop: Preferred.
- Oldest Route: Preferred if all other criteria are equal.
- Lowest Router ID: Preferred if all other criteria are equal.
