BGP local-as no-prepend

BGP local-as no-prepend

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 100.1.1.0/24 with R1 being .1 and R2 being .2., the configuration would look like this.

R1

router bgp 65111

neighbor 100.1.1.2 remote-as 200

neighbor 100.1.1.2 local-as 100

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

From R2

From R1

With Just the local-as applied we can see in R2’s BGP table the path for 1.0.0.0 is 100, 65111, i. R1’s BGP table the path for 2.0.0.0 is 100, 200, i. R1 is prepending the AS100 number before advertising 1.0.0.0 to R2. What I was not understanding before is that R1 is prepending “100” to the 2.0.0.0/8 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 100.1.1.2 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