Routing Policy and Filtering · Lesson 01 of 01
Filtering and route-maps
Prefix-lists decide which prefixes; filter-lists decide which AS paths; route-maps do both and set attributes. Order of operations matters.
Written lesson
The right tool per job
A prefix-list matches network and length — 'permit 10.0.0.0/8 le 24' means any 10-prefix up to /24. A filter-list matches an AS-path access-list, filtering by who a route came through rather than what it is. A route-map is the general instrument: it can match either of those (and communities), permit or deny, and set attributes on what it permits. Use the narrow tool when a narrow tool fits; reach for the route-map when you need to set as well as match.
Configuration
Inbound policy on one session
ip prefix-list CUST seq 5 permit 198.51.100.0/24
!
route-map FROM-CUST permit 10
match ip address prefix-list CUST
set local-preference 200
route-map FROM-CUST deny 20
!
router bgp 65001
address-family ipv4 unicast
neighbor 203.0.113.9 route-map FROM-CUST inChanging inbound policy needs a refresh
A new inbound policy only affects routes received after it is applied unless you trigger a soft refresh: clear bgp ipv4 unicast 203.0.113.9 soft in. With route-refresh capability (default on modern IOS) this re-requests the routes without tearing down the session.
Order of operations
- Inbound: route-map/filter is applied as routes arrive, before best-path.
- A route-map's implicit deny drops anything not explicitly permitted.
- `soft in` re-applies inbound policy without a hard reset.
- Outbound policy shapes the Adj-RIB-Out per neighbour.