586
The configurations of SwitchA:
SwitchA(config)#router bgp 100
SwitchA(config-router-bgp)#neighbor 2.2.2.1 remote-as 300
SwitchA(config-router-bgp)#neighbor 3.3.3.2 remote-as 300
SwitchA(config-router-bgp)#neighbor 4.4.4.3 remote-as 400
The configurations of SwitchC:
SwitchC(config)#router bgp 300
SwitchC (config-router-bgp)#neighbor 2.2.2.2 remote-as 100
SwitchC (config-router-bgp)#neighbor 2.2.2.2 route-map set-metric out
SwitchC (config-router-bgp)#neighbor 1.1.1.2 remote-as 300
SwitchC (config-router-bgp)#exit
SwitchC (config)#route-map set-metric permit 10
SwitchC (Config-Router-RouteMap)#set metric 120
The configurations of SwitchD
SwitchD (config)#router bgp 300
SwitchD (config-router-bgp)#neighbor 3.3.3.3 remote-as 100
SwitchD (config-router-bgp)#neighbor 3.3.3.3 route-map set-metric out
SwitchD (config-router-bgp)#neighbor 1.1.1.1 remote-as 300
SwitchD (config-router-bgp)#exit
SwitchD (config)#route-map set-metric permit 10
SwitchD (Config-Router-RouteMap)#set metric 200
The configurations of SwitchB
SwitchB (config)#router bgp 400
SwitchB (config-router-bgp)#neighbor 4.4.4.4 remote-as 100
SwitchB (config-router-bgp)#neighbor 4.4.4.4 route-map set-metric out
SwitchB (config-router-bgp)#exit
SwitchB (config)#route-map set-metric permit 10
SwitchB (Config-Router-RouteMap)#set metric 50
SwitchA(config-router-bgp)# bgp always-compare-med
After the configuration above, SwitchB, SwitchC and SwitchD are assumed to send a
route 12.0.0.0 to SwitchA. According to the comparison of BGP route strategy; there is an
assumption that the routes sent by the three switches above have the same attribute
value before the comparison of metric attribute. At this time, the route with lower value is
the better route. But the comparison of metric attribute will only be done with the routes
from the same AS. For SwitchA, the routes passed SwitchC are preferable to the one