BGP local-as no-prepend

BGP local-as no-prepend

Warning: Undefined variable $match_no_and in /home/kennie/www/www/wordpress/wp-content/plugins/crp-taxonomy/includes/filters.php on line 245

Sharing is caring!

So it is amazing how something will finally just click. I have done several different labs working with the local-as, no-prepend, replace-as, dual-as and the no-prepend was something I just was not understanding.

The purpose of these strings is to allow for conversion of a BGP AS number with clients where you can modify or hide the changes being made. This allows for a phased approach when there are a lot of clients connected.

The first portion “local-as” is pretty simple. It just adds the AS number after the local-as command in the BGP messages making eBGP neighbors think it is in a different AS then what is configured under “router bgp (AS)“.

R1 can be running BGP AS # 65111 but tell R1’s eBGP neighbor that it is actually 100.

Assuming R1 to R2’s network was with R1 being .1 and R2 being .2., the configuration would look like this.


router bgp 65111

neighbor remote-as 200

neighbor local-as 100

Simple enough. R2 would just have the command “neighbor remote-as 100“.

From R2

From R1

With Just the local-as applied we can see in R2’s BGP table the path for is 100, 65111, i. R1’s BGP table the path for is 100, 200, i. R1 is prepending the AS100 number before advertising to R2. What I was not understanding before is that R1 is prepending “100” to the prefix advertised by R2. R2 is NOT doing this. It is because the local-as command is being utilized. Any prefixes being advertised by eBGP neighbors that have the local-as command applied will automatically have the local-as value added to R1’s BGP table UNLESS we add the “no-prepend” onto the local-as command on R1.

Change R1 to have this configuration:

router bgp 65111

neighbor local-as 100 no-prepend

Now R1 will have this

So in summary the “no-prepend” command is used to modify the default behavior of the router utilizing “local-as” to not add the AS number following the local-as command to BGP prefixes advertised by that neighbor.

Leave a Reply

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