Route filtering needs to match both address and mask length — ACLs don’t. Prefix-lists do:
ip prefix-list PL seq 20 permit 10.0.0.0/8 ge 16 le 24
Matches any 10/8 subnet with mask between /16 and /24. Exact match = no ge/le. 0.0.0.0/0 le 32 = everything. Top-down, sequential numbers, implicit deny at the bottom.
The tool stack for OSPF specifically
- prefix-list = matching only (used by route-maps, filter-lists, distribute-lists).
- distribute-list filters the local RIB only — LSAs still flood. The trap.
- area filter-list (ABR) really touches type 3 LSAs.
- route-maps with
match ip address prefix-listgate redistribution.
Rule of thumb: prefix-lists for routes, ACLs for packets — and never let the implicit deny surprise you.