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
The BGP-IPv4 unicast address family view is displayed.
Run ipv4-family multicast
The BGP-IPv4 multicast address family view is displayed.
Run ipv4-family vpnv4 [ unicast ]
The BGP-VPNv4 address family view is displayed.
Run ipv4-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv4 address family view is displayed.
Run ipv6-family [ unicast ]
The BGP-IPv6 unicast address family view is displayed.
Run ipv6-family vpnv6 [ unicast ]
The BGP-VPNv6 address family view is displayed.
Run ipv6-family vpn-instance vpn-instance-name
The BGP-VPN instance IPv6 address family view is displayed.
- Perform any of the following operations as required:
The bestroute med-none-as-maximum and compare-different-as-med commands cannot be executed in the BGP-VPNv4 address family view or BGP-VPNv6 address family view.
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 bestroute med-plus-igp [ igp-multiplier igp-multiplier | med-multiplier med-multiplier ] *
The sums of MED multiplied by a MED multiplier and IGP cost multiplied by an IGP cost multiplier are compared.
By default, the MED and IGP cost of each route are used as separate route selection criteria.
- Run commit
The configuration is committed.