BGP Path Attributes - AS Path - :
Content Protection by

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.

bgp path attribute, as path, as path prepending

BGP Path Attribute, AS Path

For the above example, the network is advertised by RouterB. It adds its own AS number to the AS Path list. After that, all the ASs adds their AS numbers to the AS Path list. And when this route reach to RouterA, the AS Path list is like 10 20 30. This is basically the AS Path of that BGP route.

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:

bgp path attribute, as path, as path prepending

AS Path Prepending

In this topolog, we want to manuplate the AS Path attribute and make the route go through another way that is longer in real. Think about the route announcement Router C announces this route to Router A through Router B without any AS Path manulation. And AS Path is 30 20 10. As you can see there are 3 hops (three ASs). The other way which is through Router D and Router E, is not selected. Because this route is 4 hops (four ASs), 30 40 50 10.


• C-B-A (30 20 10) (Shortest, so Best Path)
• C-D-E-A (30 40 50 10)

Now, with AS Path Prepending, we will manuplate this AS Path and we will make the router to select long way as BGP Best Path. We will use Route Maps for AS Path Prepending configuration.

RouterC (config)# route-map PrependManuplate 
RouterC (config-route-map)# set as-path prepend 60 60
RouterC (config-route-map)# exit
RouterC (config-router)# router bgp 30
RouterC (config-router)# network
RouterC (config-router)# neighbor remote-as 20
RouterC (config-router)# neighbor remote-as 40
RouterC (config-router)# neighbor route-map PrependManuplate out

After this configuration, the AS Paths become like below:

• C-B-A (60 60 30 20 10)
• C-D-E-A (30 40 50 10) (Shortest, so Best Path)

With additional two AS number, the first AS Path became longer (we can do this with one AS number also). So, the new BGP Best Path is the second, through C-D-E-A (30 40 50 10).

You can find other BGP Path Attribute Articles below:

BGP Path Attributes – Weight
BGP Path Attributes – Local Preference
BGP Path Attributes – AS Path
BGP Path Attributes – Origin
BGP Path Attributes – MED

Main BGP Article Series :

BGP – Part 1
BGP – Part 2 (BGP Peers, BGP Sessions, BGP Messages)
BGP – Part 3 (IBGP, IBGP Topologies and EBGP)
BGP – Part 4 (BGP Administrative Distance and BGP Path Attributes)
BGP – Part 5 (Packet Tracer BGP Configuration Example)

Youn can join OUR Facebook Group with the below links!!!

About the Author
Gokhan Kosem is a telecommunation and network engineer. His ambition to IP networks and end-to-end system installation made him to prepare this web-site. By sharing his experiences about various networking protocols beside different system installation experiences and Cisco, Juniper, Alcatel-Lucent devices configurations, he is aimed to be helpful for his collegues in all over the world. He is currently lives in Istanbul, Turkey.

Leave a Reply

Copy Protected by Chetan's WP-Copyprotect.