9.6 BGP Attributes  
  9.6.13 MED configuration example  
In 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.

Use a route map to configure the MED attribute on a router as follows:

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. This 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. The MED attribute can also be set when configuring the redistribution of routes into BGP. For example, on RTB the static route can be injected 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.

 

Lab Activity

e-Lab Activity: MED Configuration Example

This lab configures the MED using the route map command.

    
 

Web Links

Configuring BGP

http://www.cisco.com/univercd/cc/td/doc/product/ software/ios122/122cgcr/fipr_c/ipcprt2/1cfbgp.htm