I am trying to gather our transit customer routes dynamically into a prefix list or similar so i can apply inbound filters on peering to automatically prevent routing traffic back to them over peering. Currently we add bgp community to the learned routes to manipulate outgoing traffic OK but how do people filter inbound?
Thanks for the reply! That works fine most of the time In this case I am learning these prefixes via peering as asxxxx as they are peered direct, but they are a customer of our customer so I’m learning them asbbbbb asxxxx etc. So basically all traffic I route to them is back via peering which is fine obviously technically but just makes stuff messy. If it was one prefix here or there I just manually filter inbound from peering but this is quite a number of changing prefixes. Cheers!
Apologies, I read your initial post again and realised that you’re actually wanting to filter out customer prefixes from peers, internet exchanges and upstreams. An issue we once had was a down stream customer advertising a /20 via us and more specific /24 prefixes only on an exchange we also peer on. Traffic would flow in from our upstream and then route to the client via the exchange, instead of the customer’s rate limited port.
Wrote a script which updates route filters, will try post it tomorrow. Load shedding in SA so can’t use my workstation right now…
The referenced script automatically builds prefix filters for customers that we provide IP transit for, to avoid us picking up more specific prefixes via trusted peers or route reflectors.
This way we simply need to maintain prefix filters on routers customer sessions connect on and then reference everything else using BGP communities which we attach to the accepted prefixes.
Other routers generate customer prefix filters automatically and jump to this chain as part of their filters, for example: