Rewritting AS path

Unanswered Question
Sep 16th, 2010

Dear all,

Though its unsafe to start tampering with AS path, I am in a situation where I need to get rid of a private AS that is appended right behind a public AS.

IOS see this as a config error and remove-private-as becomes obsolete ( junos does not).

I came across few posts with the command "set as-path exclude" but cannot seem to find any more info about it on

Any thoughts or pointers ?



I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3.5 (2 ratings)
milan.kulik Thu, 09/16/2010 - 03:35


AFAIK, once you are receiving a mixture of public and private AS numbers within the AS-PATH, the only way to remove the private one(s) is to remove the AS-PATH completely by redistributing to an IGP and manipulate the AS-PATH when redistributing back from IGP to BGP.

Which is quite complicated and requires multiple routers (or VRFs) involved.



francisco_1 Thu, 09/16/2010 - 03:52

The command to perform AS_PATH striping is "neighbor remove-private-as". All BGP updates sent over this sesssion are inspected to have a sequence of private  AS numbers in the beginning of the AS_PATH. All private numbers are removed and the local AS number is prepended.

By the way are you using the private AS number? you ISP should remove that when they advertise your prefixes!!


milan.kulik Thu, 09/16/2010 - 04:02


neighbor remove-private-as" command fails in a case of the AS-PATH containing a mixture of private and public AS numbers :-(



cisco_lad2004 Wed, 09/22/2010 - 05:42

Thank you both for the replies !

I considered BGP>IGP>BGP redistribution which a workaround...but opted for a cleaner design which was to simply redesign my set up and avoid a mix of Private and public ASs.




This Discussion

Related Content