BGP AS-PATH prepending

glitchlist Blog Leave a Comment

AS-PATH prepending stand for announce my prefix with a low priority. This technique, in a multihomed BGP scenario, it is used to lighten the traffic coming from a peer. The BGP route selection process prefer prefix with a short AS-PATH instead a long AS-PATH.

FIRST create an ACL to select your source prefix the traffic to prepend:

# Huawei

[~GL-R1-acl4-basic-2001]acl number 2001
[~GL-R1-acl4-basic-2001]description MyASN-Pref
[~GL-R1-acl4-basic-2001]rule 5 permit source 10.10.0.0 0.0.15.255


# Cisco

GL-R1(config)#access-list 10 permit 10.10.0.0 0.0.15.255

SECOND create a route policy to apply prepending:

# Huawei

[~GL-R1-route-policy]route-policy toMY-ISP permit node 10
[~GL-R1-route-policy]if-match acl 2001
[~GL-R1-route-policy]apply as-path 65000 65000 65000 65000 65000 65000 additive


# Cisco

GL-R1(config)#route-map toMY-ISP permit 10
GL-R1(config-route-map)#match ip address 10
GL-R1(config-route-map)#set as-path prepend 65000 65000 65000 65000

THIRD link the route policy on peer configuration:

# Huawei

[~GL-R1]bgp 65000
[~GL-R1-bgp]peer 192.168.0.5 route-policy toMY-ISP export


# Cisco

GL-R1(config)#router bgp 65000
GL-R1(config-router)#neighbor 192.168.0.5 route-map toMY-ISP out

FOURTH do some checks:

# Huawei

<GL-R1>display bgp routing-table peer 192.168.0.5 advertised-routes 
 
 BGP Local router ID is 192.168.0.2
 Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 RPKI validation codes: V - valid, I - invalid, N - not-found


 Total Number of Routes: 3
        Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>     10.10.0.0/20    192.168.0.5                            0      65000 65000 65000 65000 65000 65000 65000i


# Cisco

GL-R1#show ip bgp

done.

Happy traffic engineering!

.glitchlist crew

Leave a Reply

Your email address will not be published. Required fields are marked *