Filter out private AS on import


I have a peer that uses private ASN and I would like to filter it out. I know I can filter out private ASNs when exporting routes but can it be done when importing?


You can use:-
set policy route-map xxx rule yyy set as-path-exclude ‘64511 64512’

and use that route-map as the import on the peer’s session.

Yup, that worked. I saw this option before but the description threw me off - I interpreted it as if routes containing any of the ASs in the list will be removed. After some trial and error, it seems it removes ANY ASs mentioned in the list from the route path.