WHEN RTA GETS AN UPDATE FROM RTB WITH METRIC 50, HE CAN NOT COMPA...
200. When RTA gets an update from RTB with metric 50, he can not compare
it to 120 because RTC and RTB are in different ASs (RTA has to choose
based on some other attributes).
In order to force RTA to compare the metrics we have to add
bgp always-compare-med to RTA. This is illustrated in the configs below:
RTA#
router bgp 100
neighbor 2.2.2.1 remote-as 300
neighbor 3.3.3.3 remote-as 300
neighbor 4.4.4.3 remote-as 400
RTC#
router bgp 300
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 route-map setmetricout out
neighbor 1.1.1.2 remote-as 300
route-map setmetricout permit 10
set metric 120
RTD#
neighbor 3.3.3.2 remote-as 100
neighbor 3.3.3.2 route-map setmetricout out
neighbor 1.1.1.1 remote-as 300
set metric 200
In order to have RTB included in the metric comparison, we have to
configure RTA as follows:
neighbor 2.2.21 remote-as 300
bgp always-compare-med
In this case RTA will pick RTB as the best next hop in order to reach
network 180.10.0.0.
Metric can also be set while redistributing routes into BGP, the command
is:
default-metric
number
Assume in the above example that RTB is injecting a network via static
into AS100 then the following configs:
RTB#
router bgp 400
redistribute static
default-metric 50
ip route 180.10.0.0 255.255.0.0 null 0
will cause RTB to send out 180.10.0.0 with a metric of 50.