I am running a CHR instance in Vultr, and after a LOT of messing, i have a few things working, and a few things not working… But one thing i am trying to get working is removing items from AS-Paths… Vultr sends back their AS-Path with 2 private AS items (in my case, 64525 and 65534 in Amsterdam). So, i might get an AS Path of: 64515,65534,20473,13335 for 1.1.1.0/24. In reality, that should only be the last 2… Any ideas how to remove the first 2 from the list? I have a filter rule in Bird that removes the items, but I cant seem to figure out how to do the same (if possbile) on RouterOS… I can append items, but not remove… Any ideas?
From reading the documentation, it seems like bgp-as-path is an immutable property of a BGP route in RouterOS 6 and 7. In 6.x, the only AS_PATH related actions in route filters are set-bgp-prepend and set-bgp-prepend-path. In 7.x, bgp-path-peer-prepend and bgp-path-prepend are writable properties that can be used with the set action, but bgp-as-path itself is immutable.
It is very important that you mention the RouterOS version (v6 or v7) in questions about BGP because these are completely different BGP implementations.
In v7 there is a config “remove-private-as=yes” but its function seems to be limited to the use on your own export side of internally used private AS numbers: if and only if the entire path consists of private AS numbers, it is deleted (and then of course the local AS is used instead).
Maybe you can submit a feature request to have this function extended to cover the use case you have…
(where some other mode of remove-private-as would remove private AS numbers from the head of the list, and keep the others)
Of course, when you are still using v6 you would have to upgrade to v7, and that is a decision not to be made lightly when you are using BGP.