BGP Path Attributes – AS Path
AS Path is another Well-Known and Mandatory BGP Path attribute. Here, as we have discusssed before, Well-Known means “it is supported by every BGP implementation” and Mandatory means “it must be included in every route entry”.
In AS Path mechanism, whenever a route pass a AS (Autonomous System), it adds the number of AS it passed. So, AS Path attribute is a list of AS numbers, that the router traverse.With this mechanism AS Path attribute is also used for loop detection and loop avoidance. Because, if a router sees its Autonomous Number in the list of AS Path, it rejects that update.
The shortest AS Path is selected as the route in the BGP Path algorithm. This is like RIP hop count. Less hops are more preferable beceuse of the ease of going throught.
Sometimes additional hops are added manually for as path manuplation. By doing this, the path that is determined by network admin, is selected as BGP Best path.
AS Path Prepending
Sometimes network admins decide the BGP paths and according to this decision, they changes the BGP paths. One of the way of this change that is related with AS Path is AS Path Prepending. AS Path Prepending is basically manuplating the AS Paths.
In AS Path Prepending, you can add additional AS numbers to the route, and the AS Path become longer after this addition. In other words, by manuplating AS Path List, the shortest path becomes longer.
We can use Route Maps to do AS Path Prepending.
Let’s explain this with an example. Think about the below topology: