Configuring the MED Attribute
Context
The multi-exit discriminator (MED) helps determine the optimal route for incoming traffic of an AS. It is similar to the metric used in IGP. When a BGP device obtains multiple routes to the same destination address but with different next hops from EBGP peers, the BGP device selects the route with the smallest MED value as the optimal route.
Procedure
- Run system-view
The system view is displayed.
- Run bgp { as-number-plain | as-number-dot }
The BGP view is displayed.
- Enter
the corresponding address family view based on network type to configure
BGP devices on networks.
Run ipv4-family { unicast | multicast }
The IPv4 address family view is displayed.
Run ipv6-family [ unicast ]
The IPv6 address family view is displayed.
- Perform one of the following operations as required:
Run default med med
The default MED value is set.
By default, the MED is 0.
Run bestroute med-none-as-maximum
BGP defines the MED value as the maximum value if a route does not have the MED attribute.
By default, BGP uses the default MED value when a route does not have the MED attribute.
Run compare-different-as-med
BGP is allowed to compare the MED values of routes received from EBGP peers in any AS.
By default, BGP compares only the MEDs of the routes received from EBGP peers within the same AS.
Run deterministic-med
The deterministic-MED function is enabled.
By default, the BGP deterministic-MED function is disabled.
Run bestroute med-confederation
The MED values of routes in a confederation are compared.
By default, BGP compares only the MEDs of the routes from the same AS.