On this post, I will be going through another BGP attributes to influence incoming routes to an AS… In my topology, I have R1 in AS100 which are both connected to both R2 and R3 in AS 200 which are both advertising Prefix 23.23.23.0/24…

What I want to show is to set up metric to allow traffic towards my AS 100 to take R3 instead of R2…


So here’s my topology for this laboratory…




So here’s my router configurations:

R1#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 100
 bgp log-neighbor-changes
 network 23.23.23.0 mask 255.255.255.0
 neighbor 172.16.12.2 remote-as 200
 neighbor 172.16.13.3 remote-as 200


R2#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 200
 bgp log-neighbor-changes
 network 23.23.23.0 mask 255.255.255.0
 neighbor 172.16.12.1 remote-as 100


R3#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 200
 bgp log-neighbor-changes
 network 23.23.23.0 mask 255.255.255.0
 neighbor 172.16.13.1 remote-as 100



As expected, we can see that R2 will be the next HOP router to reach 23.23.23.0/24 network..This is due to the fact the all the attributes are the same except for the router ID…

R1#sh ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found


     Network          Next Hop            Metric LocPrf Weight Path
 *   23.23.23.0/24    172.16.13.3              0             0 200 i
 *>                   172.16.12.2                     0             0 200 i


 Let me create a route-map in R1 to set a metric to 500 towards R2 so that R3 will be the preferred routes..

R1#sh run | sec route-map

route-map SET-METRIC permit 10
 set metric 500

Now, applying this in BGP policy, here is the configs….

 R1#sh run | sec bgp
 router bgp 100
 bgp log-neighbor-changes
 network 23.23.23.0 mask 255.255.255.0
 neighbor 172.16.12.2 remote-as 200
 neighbor 172.16.12.2 route-map SET-METRIC in
 neighbor 172.16.13.3 remote-as 200



Let’s check the new BGP Table in R1..

R1#sh ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found


     Network          Next Hop            Metric LocPrf Weight Path
 *>  23.23.23.0/24    172.16.13.3              0             0 200 i
 *                    172.16.12.2                       500             0 200 i



By applying a metric of 500 on R2…it becomes less preferred than R3..

 R1#show ip route bgp
Codes: L – local, C – connected, S – static, R – RIP, M – mobile, B – BGP
       D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
       N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
       E1 – OSPF external type 1, E2 – OSPF external type 2
       i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
       ia – IS-IS inter area, * – candidate default, U – per-user static route
       o – ODR, P – periodic downloaded static route, H – NHRP, l – LISP
       + – replicated route, % – next hop override

Gateway of last resort is not set

      23.0.0.0/24 is subnetted, 1 subnets
B        23.23.23.0 [20/0] via 172.16.13.3, 00:03:46


***************************END OF LAB***************************************

Leave a comment

Quote of the week

"People ask me what I do in the winter when there's no baseball. I'll tell you what I do. I stare out the window and wait for spring."

~ Rogers Hornsby