Uploaded by Constantin Ani

BGP Pre-bestpath Cost

advertisement
R9 is running IOS-XE in this topology, but you can do this lab using a regular IOS. The rest of the routers
are running regular IOS 15.6(2)T.
R9, R1 and R2 are running in AS 100, and R3 is running in AS 300.
R3 in AS 300 is advertising network 3.0.0.0.
To see R9's neighbors:
On R9:
R9#sh ip bgp summ | b Nei
Neighbor
19.1.1.1
29.1.1.2
V
4
4
AS MsgRcvd MsgSent
100
12
11
100
12
11
TblVer
2
2
InQ OutQ Up/Down State/PfxRcd
0
0 00:06:43
1
0
0 00:06:58
1
To see the paths to 3.0.0.0/8 on R9:
R9#sh ip bgp | b Net
*>i
* i
Network
3.0.0.0
Next Hop
19.1.1.1
29.1.1.2
Metric LocPrf Weight Path
0
100
0 300 i
0
100
0 300 i
To see why R9 is choosing 19.1.1.1 (R1) as its best path to reach 3.0.0.0/8:
R9#sh ip bgp 3.0.0.0 best-path-reason
BGP routing table entry for 3.0.0.0/8, version 2
Paths: (2 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 1
300
19.1.1.1 from 19.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
rx pathid: 0, tx pathid: 0x0
Updated on Mar 7 2022 20:32:59 UTC
Best Path Evaluation: Overall best path
Refresh Epoch 1
300
29.1.1.2 from 29.1.1.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, valid, internal
rx pathid: 0, tx pathid: 0
Updated on Mar 7 2022 20:32:44 UTC
Best Path Evaluation: Higher router ID
The above show command is only available in IOS-XE.
Let's configure Weight attribute on R9 such that it prefers R2 instead of R1:
R9(config)#ip prefix-list 123 permit 3.0.0.0/8
R9(config)#route-map tst per 10
R9(config-route-map)#match ip addr prefix 123
R9(config-route-map)#set weight 22222
R9(config)#route-map tst per 90
R9(config)#router bgp 100
R9(config-router)#neigh 29.1.1.2 route-map tst in
R9#clear ip bgp * in
To verify the configuration:
R9#sh ip bgp | b Netw
Network
Next Hop
* i 3.0.0.0
19.1.1.1
*>i
29.1.1.2
Metric LocPrf Weight Path
0
100
0 300 i
0
100 22222 300 i
What if we wanted R9 to take the path through R1 and NOT R2 without manipulating the Weight attribute?
Is there an attribute with more preference than the Weight attribute? YES, it's called the "pre-bestpath cost extended
community". We covered it in my Saturday class last week.
To configure BGP pre-bestpath cost extended community:
On R1:
R1(config)#ip prefix-list 123 per 3.0.0.0/8
R1(config)#route-map tst per 10
R1(config-route-map)#match ip addr prefix 123
R1(config-route-map)#set extcommunity cost pre-bestpath 1 1000
R1(config)#route-map tst per 90
R1(config)#router bgp 100
R1(config-router)#neigh 19.1.1.9 send-community both
R1(config-router)#neigh 19.1.1.9 route-map tst out
R1#cle ip bgp * out
On R9:
R9#sh ip bgp | b Netw
*>i
* i
Network
3.0.0.0
Next Hop
19.1.1.1
29.1.1.2
Metric LocPrf Weight Path
0
100
0 300 i
0
100 22222 300 i
R9#sh ip bgp 3.0.0.0 best-path-reason
BGP routing table entry for 3.0.0.0/8, version 4
Paths: (2 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 3
300
19.1.1.1 from 19.1.1.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
Extended Community: Cost:pre-bestpath:1:1000
rx pathid: 0, tx pathid: 0x0
Updated on Mar 7 2022 21:37:46 UTC
Best Path Evaluation: Overall best path
Refresh Epoch 4
300
29.1.1.2 from 29.1.1.2 (2.2.2.2)
Origin IGP, metric 0, localpref 100, weight 22222, valid, internal
rx pathid: 0, tx pathid: 0
Updated on Mar 7 2022 20:49:20 UTC
Best Path Evaluation: Higher cost community
The BGP Cost extended community attribute is a non-transitive extended community attribute that is exchanged
between iBGP and confederation peers.
The first value that is configured (1) is called the community ID. The lowest community ID value is preferred. The
tie-breaker is the second configured value (1000), which is called the community value, and the lowest value will
be the bestpath.
I hope this was beneficial to you all.
Download