BGP Attribute: AS-PATH Manipulation- AS-PATH Prepend

Today I am going to talk about the incoming traffic flow control where we are going to manipulate the BGP attribute AS-Path so that the alternate path will be followed for the traffic to come inside.

What is AS-Path ?
AS-Path is the BGP attribute which knows all the prefixes between the source and the destination which is connected via BGP. So if you have source and destination with 5 Hops and all these hops are under different AS values all these AS values are added to the route for reaching the destination.

In other words, i can say that When a BGP router sends out an update to a neighbor in a different autonomous system with eBGP neighbor it adds its own AS number to the front (left side) of the AS path. So the AS path lists all the AS's that need to be traversed to reach the location where the prefix that the path is attached to is advertised from. As such, a trace route should encounter those same AS's

So now you know what AS-Path is and how it works. Let us jump on the AS-Path Prepend now.

What is AS-Path Prepend ?
AS-Path prepending is a method to manipulate the AS-Path attribute of a BGP route. It allows prepending multiple entries of AS to a BGP route. This can come as a workaround if a specific path is required to be followed, and other means like Multi-Exit Discriminator (MED) is not supported. By the help of AS-Path Prepend you are going to add the virtual AS's between your path so that BGP will again look for the best path and re-route the traffic from the other reachability path.

Below is just a demo topology showing the connectivity between AS 1000 and AS 2000 via AS 500. The IP's are the interfaces uses here are only for the demo purposes and has no relevance with any of the enterprise networks.

Fig 1.1- AS-Path Prepend

You can configure AS-Path Prepend as inbound and outbound with the route-maps. I am taking the below example of the configuration showing the AS-Path Prepend configuring for inbound and outbound ports

Below is the configuration putting the AS-Path Prepend on the outbound interface on the AS 2000.

   Configuring AS-Path Prepend for the outbound Interface

   Configuring AS-Path Prepend for the inbound interface at other end