bestroute compare-med
Use bestroute compare-med to enable MED comparison for routes on a per-AS basis.
Use undo bestroute compare-med to restore the default.
Syntax
bestroute compare-med
undo bestroute compare-med
Default
MED comparison for routes on a per-AS basis is disabled.
Views
BGP instance view
BGP-VPN instance view
Predefined user roles
network-admin
Usage guidelines
By default, BGP does not compare MEDs for routes from the same AS. When a router learns a new route, it compares the route with the optimal route in its BGP routing table. If the new route is more optimal, it becomes the optimal route in the BGP routing table. In this way, route learning sequence might affect optimal route selection.
To solve the selection problem, the router puts routes received from the same AS into a group when the bestroute compare-med command is configured. The router then selects the route with the lowest MED from the same group, and compares routes from different groups.
Examples
# In BGP instance view, enable MED comparison for routes on a per-AS basis.
<Sysname> system-view [Sysname] bgp 100 [Sysname-bgp-default] bestroute compare-med