OSPF Route Filtering
OSPF can have route filtering applied, however, it is impossible to filter routes advertised between routers in the same area. This means we have to configure filtering on an ABR or ASBR. ABRs can filter Type 3 and Type 4 LSAs, while ASBRs can filter Type 5 and Type 7 LSAs.
When talking about filtering in OSPF, it is more appropriate to speak about LSA filtering rather than route filtering. This is because it is the advertising of the LSAs that match particular network destinations that are being filtered.
Filtering can be achieved using:
- the
filter-list
command under the OSPF configuration mode - the
distribute-list
command under the OSPF configuration mode
The reason for filtering taking place only at ABRs or ASBRs is that as a link-state protocol, every router within the same area must by definition have an identical link-state database (LSDB) for shortest path first (SPF) calculations. If you filter LSAs within an area, it would break this uniformity.
Similarly route summarization can only take place between areas.
If you need to apply some sort of route filtering within an area, this can be achieved not by filtering LSAs between OSPF routers, but by filtering the installation of routes within the routing table. This can be done using distribute-list filtering.
Links
https://networklessons.com/ospf/ospf-abr-type-3-lsa-filtering-on-cisco-ios https://networklessons.com/ospf/ospf-lsa-type-5-filtering-on-cisco-ios https://networklessons.com/ospf/ospf-distribute-list-filtering