BGP Remove Private AS

This topic is to discuss the following lesson:

hi Rene,

couple of doubts on this concept :

You said :
"Removing the private AS number(s) will only work if there are no public AS numbers in the AS path. "
but we have “2” which is public AS in the path right ? so why did privateAS 64512 got removed after applying the remove-priv-as command.

   Network          Next Hop            Metric LocPrf Weight Path
*&gt;                           0 <strong>2 64512</strong> i
  1. should ping work from R3 to using config you gave ?


Hi Abhishek,

It’s about the updates that R2 receives from R1, in this AS path you shouldn’t see any public AS numbers.

If you do have any public AS numbers there then the router won’t remove them unless you use the remove-private-as all command.

The ping will not work unless you advertise network on R2 or R3 so that R1 can learn it. Otherwise, R1 doesn’t know how to reach


Hello Rene,
Great lesson however, I have a question if R3 learns about from R1 then why do we need to remove private AS# command at R2. Please clarify.


Hello Hamood

R3 learns about from R2. This can be seen in the output from the show ip bgp command executed on R3. The next hop IP is which is that of R2. Also, when BGP neighbour relationships are configured, R3 and R2 are configured to be neighbours.

So the remove private-as command that’s implemented at R2 will have the result of removing the private AS’s from BGP updates from R2 to R3.

As a general rule, the remove private-as command is implemented on the router that is in a public AS but is directly connected to a router in a private AS. This way, private AS’s will not be propagated to the Internet.

I hope this has been helpful!


why we remove the private as ? it create any problem ?

Hi Shiva,

Imagine an ISP that is connected to the Internet that has some customers that use private AS numbers. We don’t want to advertise those private AS numbers to other ASes on the Internet, which is why we should remove them.



What below point means?

If the AS path contains the AS number of the eBGP neighbor then it won’t be removed.

In example given, all are EBGP neighbors only. So For eg : if R2 gets a route with AS path as 64512,65000 , it will not remove private AS?

Siji Babu

Hello Siji

Yes, that is correct. This is done so that connectivity will not be lost between a directly connected private and public AS. In the same example, if R3 has an AS path of 2, 64512, 65000, the private AS would be removed since that AS is not of an eBGP neighbor because R3 and R1 are not eBGP neighbors.

I hope this has been helpful!


Hi Rene,

As you mentioned:
“Cisco IOS routers support the remove-private-as command to achieve this”

I though that the cisco routers will automatically remove the private AS from the AS Path attribute as mentioned in the Private-AS lesson.

was it wrong and it only remove the private as path by using that command “remove-private-as”?