OSPF supports route import and export policies, controlling routing information that is added in the routing table with an import routing policy and advertised from the routing table with an export routing policy.
OSPF route import and export can be applied in the following scenarios:
The OSPF export operation introduces routes learned by other routing protocols from the RIB into OSPF routing table. Meanwhile, you can also configure the routing policy to introduce certain routes that only meet the filter conditions.
OSPF export can be configured to filter routing information advertised from the routing table in RIB to neighbors; OSPF import can be used to filter routing information received from the neighbors by configuring filter rules before adding to the routing table in RIB.
OSPF can configure route import or export a routing policy in which route parameters can be modified when meet the filter conditions, so as to change the properties and priority of the received route or the route to be advertised.
Figure 1. Definition of OSPF route import and export
When we refer to OSPF import and export, it is from the point of view of the routing table in RIB. This means importing route from OSPF protocol into RIB using a routing policy, and advertising route from RIB to OSPF protocol by exporting a routing policy.
The OSPF import operation is defined as filtering and modifying the OSPF route received from the neighbors by configuring the routing policy before adding to the routing table in RIB.
OSPF export consists of two types of applications:
set policy policy-statement <policy-name> term <term-name> from protocol <bgp | connected | ospf4 | ospf6 | rip | static>
You can also refer to 1.4 Example for Configuring OSPF Introducing Route by Using Export to see the configuration example.
Figure 2. Definition of OSPF route import and export with VRF
Currently, only OSPF route import and export support VRF, while route import and export of other routing protocols such as RIP and BGP do not support VRF.
Figure 2 depicts how OSPF import and export support VRF. Each routing protocol has a separate routing table which is isolated by different VRFs (Note that, currently, only OSPF and static routing support VRF). Besides, the system has a whole routing table in RIB including the route entries of all the routing protocols which are divided by VRF.
OSPF import and export operations can only be performed on routes within the same VRF in the OSPF routing table and the RIB. Routes between different VRFs are not supported for route import and export.