Configuring OSPF to filter received routes

As a link state-based routing protocol, OSPF is different from a distance-vector (D-V) algorithm routing protocol and ensures consistent topological relationship. This is an important condition for loop-free OSPF routing. You can run the filter-policy import command to filter routes in OSPF configuration. The link-state advertisement (LSA) of a route filtered out exists in the OSPF database. OSPF simply does not add the route to the routing table of the route manager. In addition, the LSA of the route is still advertised. That is, the neighbors still have this route. Note that the filter-policy export command can be used to filter routes when external routes are redistributed for advertisement.

Perform as follows to configure OSPF to filter received routes:
1. Run the system-view command to access the system view.
2. Run the ospf [ process-id ] command to access the OSPF process view.
3. Run the filter-policy { acl-number | ip-prefix ip-prefix-name } import command to configure the filtering of received routes.

Perform as follows to configure OSPF to filter imported routes:
1. Run the system-view command to access the system view.
2. Run the ospf [ process-id ] command to access the OSPF process view.
3. Run the import-route { limit limit-number | { bgp [ permit-ibgp ] | direct | unr | rip [ process-id-rip ] | static | isis [ process-id-isis ] | ospf [ process-id-ospf ] } [ cost cost | type type | tag tag | route-policy route-policy-name ] * } command to import routing information of other protocols.
(Optional) Run the filter-policy { acl-number | ip-prefix ip-prefix-name | route-policy route-policy-name } export [ direct | static | unr | bgp | { rip | isis | ospf } [ process-id ] ] command to configure the filtering of routes imported in step 3. Only filtered routes can be advertised.
You can specify direct, static, unr, bgp, rip [ process-id ], isis [ process-id ], and ospf [ process-id ] to filter routing information of a specific protocol or process. If you do not specify direct, static, unr, bgp, rip [ process-id ], isis [ process-id ], or ospf [ process-id ], OSPF filters all imported routing information.

Scroll to top