Show

2

Click here to load reader

Transcript of Show

Page 1: Show

R3 prefers the path via R4 to reach 150.1.1.0 because the shorter as path lengthR3(config)#do show ip bgp

Network Next Hop Metric LocPrf Weight Path* 150.1.1.0/24 2.2.2.2 0 2 1 ?*> 4.4.4.4 0 0 4 ?* 150.2.2.0/24 4.4.4.4 0 4 1 2 ?*> 2.2.2.2 0 0 2 ?*> 150.3.3.0/24 0.0.0.0 0 32768 ?R3(config)#

I want that R3 goes via R2 to reach 150.1.1.0/24 so i will use the med:

R4(config)#route-map med permit 10R4(config-route-map)#set metric 40R4(config)#router bgp 4R4(config-router)#neighbor 3.3.3.3 route-map med out

R2(config)#route-map med permit 10R2(config-route-map)#set metric 20R2(config)#router bgp 2R2(config-router)#neighbor 3.3.3.3 route-map med out

And by default the med value is compared if it is advertised by the same AS in this case AS 4 advertises the med 40 and AS 20 advertises the med 20 so i should configure the following command :

R3(config)#router bgp 3R3(config-router)#bgp always-compare-med

R3 still prefers the path via R4 because R3 before comparing the med ,it looks that the shorter as path length is via R4 (4) comparing with the as path length via R2(2 1) (the order preference the med comes after the shortest as path length):

R3(config-router)#do show ip bgp Network Next Hop Metric LocPrf Weight Path*> 150.1.1.0/24 4.4.4.4 40 0 4 ?* 2.2.2.2 20 0 2 1 ?* 150.2.2.0/24 4.4.4.4 40 0 4 1 2 ?*> 2.2.2.2 20 0 2 ?*> 150.3.3.0/24 0.0.0.0 0 32768 ?R3(config-router)#

How to override this behavior so R3 will use the med as the criteria in order to reach 150.1.1.0/24 via R2?

to solve this problem I will add another sequence in the route map called med and configured in R4 above in order to increase the as path length to be equal with as path length received from R2 thus R3 will use the med to decide the best path :

On R4:ip prefix-list 150-1-1-0 seq 5 permit 150.1.1.0/24!route-map med permit 10 set metric 40!route-map med permit 20 match ip address prefix-list 150-1-1-0

Page 2: Show

set as-path prepend 4

R3 chooses the med metric and ignore the prependR3(config)#do show ip bgp

Network Next Hop Metric LocPrf Weight Path*> 150.1.1.0/24 4.4.4.4 40 0 4 ?* 2.2.2.2 20 0 2 1 ?* 150.2.2.0/24 4.4.4.4 40 0 4 1 2 ?*> 2.2.2.2 20 0 2 ?*> 150.3.3.0/24 0.0.0.0 0 32768 ?

when i changes the order of sequence in route- map:

route-map med permit 20 match ip address prefix-list 150-1-1-0 set as-path prepend 4!route-map med permit 30 set metric 40

here R3 chooses the prepend and ignore the med metricR3(config-router)#do show ip bgp

Network Next Hop Metric LocPrf Weight Path*> 150.1.1.0/24 4.4.4.4 0 0 4 4 ?* 2.2.2.2 20 0 2 1 ?* 150.2.2.0/24 4.4.4.4 40 0 4 1 2 ?*> 2.2.2.2 20 0 2 ?*> 150.3.3.0/24 0.0.0.0 0 32768 ?

how to force R3 to choose the med instead of the shortest as path,in other word how to override the shortest as path and use the med?