8.6 BGP Attributes
8.6.7
Manipulating routes with AS_Path
AS_Path information is manipulated to affect interdomain routing behavior. Because BGP prefers a shorter path over a longer one, system operators are tempted to change the path information by including dummy AS path numbers that would increase the path length and influence the traffic trajectory one way or the other. Cisco's implementation enables a user to insert AS numbers at the beginning of an AS_Path to make the path length longer. The following example shows how this feature can be used (see Figures and ).

Because BGP prefers a shorter path over a longer one, system operators can add to the AS_Path length by prepending extra path entries and can influence the preferred route used by other autonomous systems. The following example shows how this feature can be used.

In Figure , AS 50 is connected to two providers, AS 200 and AS 100. AS 100 is directly connected to an Internet network access point (NAP), while AS 200 must go through an extra hop via AS 300 to reach the Internet. Figure shows the AS path of prefix 192.213.1.0/24 as it traverses the autonomous systems on its way to the NAP. When the 192.213.1.0/24 prefix reaches the NAP via AS 300, it has an AS_Path of 300 200 50. If the same prefix reaches the NAP via AS 100, it has an AS_Path of 100 50, which is shorter. Autonomous systems upstream from the NAP prefer the shorter AS_Path length and direct their traffic toward AS 100 at all times for destination 192.213.1.0/24.

AS 50's network administrator is not too happy about this behavior because she prefers Internet traffic to come in via the higher bandwidth T3 link to AS 200, rather than through the slower link to AS 100. AS 50's network administrator can resolve this by manipulating the AS_Path information, inserting extra AS hops when sending routing updates to AS 100. One common practice is for AS 50 to repeat its AS number as many times as necessary to tip the balance and make the path via AS 200 appear to become the shorter route.

In Figure , AS 50 will insert two AS numbers 50 50 at the beginning of the AS_Path of prefix 192.213.1.0/24. When the prefix 192.213.1.0/24 reaches the NAP via AS 100, it has the AS_Path 100 50 50 50, which is longer than the AS_Path 300 200 50 via AS 300. Autonomous systems upstream of the NAP prefer the shortest path and thus direct the traffic toward AS 300 for destination 192.213.1.0/24.

The bogus number should always be a duplicate of the AS announcing the route or the neighbor that the route is learned from (in case an AS is increasing the path length for incoming updates). Adding any other number is misleading and could potentially lead to routing loops.

To configure the prepending of dummy AS numbers, a route map is used in a BGP neighbor statement:

RTX(config)#router bgp 100
RTX(config-router)#neighbor 172.16.20.2 remote-as 300
RTX(config-router)#neighbor 172.16.20.2 route-map AddASnumbers out
RTX(config-router)#exit
RTX(config)#route-map AddASnumbers permit
RTX(config-route-map)#set as-path prepend 100 100