Friday, June 10, 2011

Influence BGP path selection - as-path prepend

As you know, by default BGP prefers shortest as path which comes as the 4th selection criteria for path selection.



Router R4 advertise 172.16.104.0/24 into bgp. By default R2 prefers the direct link between R2 -R4 to reach the network 172.16.104.0/24.



The bgp table shows R3 advertise the network with As 40 along with its own AS 13 whereas R4 advertise the same network with AS 40, hence shortest AS path and best route.

Now we will make R4 to prepend its own AS no. multiple times, for R2, its looks like network is reachable via a longer AS paths.

Step1:
ip prefix-list AS_PATH seq 5 permit 172.16.104.0/24

- define a prefix list that matches our network of interest.

Step2:
route-map AS_PATH permit 10
match ip address prefix-list AS_PATH

set as-path prepend 40 40

route-map AS_PATH permit 20


-define a route map to prepend AS path

step3:
R4(config-router)#neighbor 10.1.24.2 route-map AS_PATH out

-Apply route-map to neighbor



AS path prepend forces R4 to advertise its own AS no three times (40,40,40). This makes R4 the least preferred path. Now the best route is via R3 with two AS path (13.40)

configuration Files

No comments:

Post a Comment