|
In the figure, AS 100 receives updates
regarding network 180.10.0.0 from RTB, RTC, and RTD. RTC and RTD are
in AS 300, and RTB is in AS 400.
You can use a route map to configure
the MED attribute on a router:
RTB(config)#route-map setmedout
permit 10
RTB(config-route-map)#set metric 50
RTB(config)#router bgp 400
RTB(config-router)#neighbor 4.4.4.4 route-map setmedout out
By default, BGP compares only the MED
attributes of routes coming from neighbors in the same external AS
(such as AS 300 in the example), which means that RTA will compare
the MED attribute coming from RTC (120) only to the MED attribute
coming from RTD (200). Even though the update coming from RTB has the lowest
MED value, RTA will choose RTC as the best path for reaching network
180.10.0.0. To force RTA to include updates for network 180.10.0.0
from RTB in the comparison, use the bgp
always-compare-med router
configuration command.
RTA will choose RTB as the best next
hop for reaching network 180.10.0.0 (assuming that all other
attributes are the same). You can also set the MED attribute when
you configure the redistribution of routes into BGP. For example, on
RTB you can inject the static route into BGP with a MED of 50. The
preceding configuration causes RTB to send out updates for
180.10.0.0 with a MED attribute of 50.
|