BGP AS Path Filtering and Manipulation

BGP AS Path Filtering allows you to control which routes are advertised based on the BGP AS_PATH attribute. To advertise only routes with a single AS in their AS Path, you can use AS Path filtering techniques. This is commonly done using regular expressions and AS Path access lists on Cisco routers.

Directly modifying the AS Path of a route is not straightforward and generally discouraged in order to maintain BGP stability. While you can prepend certain AS numbers using a Route-map and the set as-path command, changing the actual AS Path directly is not directly possible as there is no direct command in Cisco IOS to replace or remove AS numbers from the AS path.

For most scenarios, it's recommended to use AS Path filtering to control route advertisements rather than attempting to modify the AS Path itself. This approach helps maintain the integrity of BGP routing information while still allowing you to control which routes are propagated based on AS Path criteria.

https://networklessons.com/bgp/how-to-configure-bgp-as-path-prepending

https://networklessons.com/bgp/bgp-attributes-and-path-selection