cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
535
Views
5
Helpful
10
Replies

BGP remove-private-as before AS-PATH prepending

JUANNN
Level 1
Level 1

Hello,

I am running a little LAB on CML 2.7.2. I have the following topology:

JUANNN_0-1733122926437.png

 I am prepending a mix of public and private ASN on R2 towards R3:

JUANNN_1-1733123029889.png

and I am also using the command to remove all the private ASN from the AS-PATH attribute on routes advertised to R3. However, on R3 it only appears to be removed the ASN of R2, which is 64512. This means that the prepending command is taking place after the remove-private-as command. Is this how is it supposed to be, or is it a CML bug?

JUANNN_2-1733123551652.png

 

 

 

 

10 Replies 10

It override or not' there is no doc. About order BUT 

You can remove prepend remote-map and check AS in R3.

If 6451x is appear in R3 then there is other restrictions of apply remove private 

MHM

Hello,

In the screenshots you can see that I already did what you said, because the ASN of R1 (64512) is being removed, but the prepended ones not, which means that the command is working, but not in the desired way. ( is working before prepending). I would like to know if is a CML thing or if it usually works this way.

Thanks

You are studying bgp and I want to give you clear views of issue.

I send you bgp restrictions in PM.

The prepend can make remove private as not work. 

One of restrictions is"" remove private not work if as path have mix of private and public as"" 

And your prepend is do that it mix public and private AS and hence not work' 

This additional to order' which come first.

So try make prepend add only private AS and check.

MHM

Hello MHM,

Thanks for the answer. On Cisco documentation says that using the keyword “ALL” at the end of the remove-private-as command will allow the command to work when having a mix of public and private ASes. I am using the keyword “all” in the screenshots that I sent. 

Also, like I said before, you can see that the command is working for the not prepended ASN since AS 64512 is removed on R3. 

I will try tomorrow to remove the public ASN from the prepend route map like you said, but even if it works it doesn’t seem to resolve the doubt.

Thanks,

Juan

Confirm same behave in GNS3, the route-map with as-prepned is override the remove private (see below result)

what make engineer confuse ?
which come first 
from cisco doc. which I am sorry to say that it little not clear 
""

What is the order of preference of attributes when some or all are applied to one neighbor in BGP?

A.   The order of preference varies based on whether the attributes are applied for inbound updates or outbound updates.

For inbound updates the order of preference is:

  1. route-map

  2. filter-list

  3. prefix-list, distribute-list

For outbound updates the order of preference is:

  1. filter-list

  2. route-map | unsuppress-map

  3. advertise-map (conditional-advertisement)

  4. prefix-list|distribute-list

  5. ORF prefix-list (a prefix-list the neighbor sends us)

so there is no mention about as-path remove at all

BUT

you can use show ip bgp neighbor X.x.x.x

to see in which order the bgp list it and according to that you do your config 

Screenshot (894).pngScreenshot (896).pngScreenshot (893).png

I know what keyword ""all"" meaning and I use it in my lab.

Result shown when I use remove command with ""all"" keyword.

MHM

shambhu.kumar
Spotlight
Spotlight

With "remove-private-as all, This will remove all private AS numbers.

You must be referring below link, in this example it is working as expected.Only difference is, it is prepending and advertised from R1 , and in your case you are prepending and advertising from R2.  Can you check same way in the given example,

https://member.networkprofessional.net/bgp-remove-private-as-numbers/

 

M02@rt37
VIP
VIP

Hello @JUANNN 

The remove-private-as command is designed to remove private AS numbers (like 64512) from the AS-PATH attribute when advertising routes. However, this command is sensitive to the order of operations. When you're also using AS path prepending with both private and public AS numbers, the order in which these operations are applied becomes important. The remove-private-as command should ideally be applied before AS path prepending to ensure that private ASNs are removed from the path before any additional ASNs are added. Since you're seeing that only the ASN of R2 (64512) is being removed, it indicates that the prepending operation might be happening after the remove-private-as operation, causing prepended private ASNs to remain in the AS-PATH.

This behavior is expected given the restriction where the remove-private-as command may not function correctly if the AS-PATH contains a mixture of both private and public ASNs. The prepending of both private and public ASNs could be causing the issue.

So, ensure that the private ASNs are removed correctly before any prepending happens, you should modify your configuration to prepend only private ASNs, without mixing in public ASNs. This will allow the remove-private-as command to work as expected and remove the private ASNs from the path before any prepending occurs.

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

JUANNN
Level 1
Level 1

Thanks, I will try what Shambu Kumar said. Very interesting that GNS3 does the same thing. I will post the result once I try it the way Shambu mentioned, I believe is going to work that way. However, the order issue seems to be a bit more clear thanks to MHM post too. Thanks!

JUANNN
Level 1
Level 1

As expected, if prepending on R1 and removing-private-as on R2, then on R3 all I see is:

JUANNN_0-1733209964737.png

I will still have to verify if in the hardware gear the order of prepending after removing-private-as is the same as in GNS3 (as MHM posted) or CML. 

Thanks for the replies,

Juan

 

Review Cisco Networking for a $25 gift card