BGP AS-PATH Filtering Examples
For example, a common use case is to prevent router from becoming a transit router (between ISPs), but ensuring that we will only advertise locally originated prefixes.
MyRouter(config)#ip as-path access-list 10 permit ^$
MyRouter(config-router)#neighbor 10.50.2.2 filter-list 10 out
MyRouter(config-router)#neighbor 10.60.2.2 filter-list 10 out
Code language: PHP (php)
Another, example, you can restricts the acceptance of certain prefixes only from specific ASNs.
We will not accept any routes going through ASN 100:
MyRouter(config)#ip as-path access-list 10 deny _100_
MyRouter(config-router)#neighbor 10.50.2.2 filter-list 10 in
MyRouter(config-router)#neighbor 10.60.2.2 filter-list 10 in
Code language: CSS (css)