AS path manipulation


as-override

replace incoming AS# >>> with local AS#

https://www.juniper.net/documentation/en_US/junos/topics/reference/configuration-statement/as-override-edit-protocols-bgp.html


remove-private AS#

set neighbor 192.168.20.1 remove-private

https://www.juniper.net/documentation/en_US/junos/topics/example/bgp-remove-private-as.html



limit the route based on community count:

https://www.juniper.net/documentation/en_US/junos/topics/example/policy-community-count.html


community-count
set policy-options policy-statement too_far_too_communities term 10 from protocol bgp
set policy-options policy-statement too_far_too_communities term 10 from community-count 2 orlower
set policy-options policy-statement too_far_too_communities term 10 then accept
set policy-options policy-statement too_far_too_communities term default then reject

Apply:
delete protocols bgp group IPCLOS_eBGP import IPCLOS_BGP_IMP
set protocols bgp group IPCLOS_eBGP import [ too_far_too_communities IPCLOS_BGP_IMP ]