When redistributing between different OSPF processes in multiple points on a network, it is possible to enter into situations of suboptimal routing or even worse, a routing loop.
The figure above shows a sample OSPF redistribution network. Both RT2 and RT3 are running 2 OSPF processes and redistributing from OSPF process 1 into OSPF process 2.
RT1 is an ABR that advertises 172.16.2.0/24 as an inter-area (IA) OSPF route to RT2 and RT3. RT2 and RT3 are redistributing this route from OSPF process 1 into OSPF process 2. Therefore, both RT2 and RT3 will learn about 172.16.2.0/24 as IA route via OSPF process 1 and as E2 route via OSPF process 2.
Since IA routes are always preferred over E1/E2 routes, the routing tables of RT2 and RT3 should show 172.16.2.0/24 as an IA route with RT1 as the next hop. However, there are chances that the route will be installed into the routing table as an E2 route.
RT2#sh ip route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 2 subnets C 172.16.1.0 is directly connected, FastEthernet0/0 O IA 172.16.2.0 [110/2] via 172.16.1.1, 00:00:36, FastEthernet0/0 C 192.168.1.0/24 is directly connected, FastEthernet1/0 O 192.168.2.0/24 [110/2] via 192.168.1.4, 00:01:06, FastEthernet1/0 RT2# ====================================================================== RT3#sh ip route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 2 subnets C 172.16.1.0 is directly connected, FastEthernet0/0 O E2 172.16.2.0 [110/2] via 192.168.1.2, 00:00:58, FastEthernet1/0 C 192.168.1.0/24 is directly connected, FastEthernet1/0 O 192.168.2.0/24 [110/2] via 192.168.1.4, 00:01:08, FastEthernet1/0 RT3#
Why does this problem occur?
When enabling multiple OSPF processes on a router, the processes are independent from the software perspective. When OSPF runs as in a single OSPF process, it always prefers internal routes over external routes. However, OSPF does not perform route selection between processes. For instance, OSPF metrics and route types are not being considered when deciding the route from which process should be installed into the routing table. There is no interaction between different OSPF processes, and the tie-breaker is administrative distance. Since both OSPF processes have a default AD of 110, the first process that installs the route into the routing table will succeed against another process.
The 1st solution is define different AD values for routes from different OSPF processes, so that the routes of certain OSPF processes are preferred over the routes of other processes by human intention, and not a matter of chance or luck. By implementing the distance ospf external 115 OSPF router subcommand under the OSPF process 2 on both routers, which increase the AD of the external routes in OSPF process 2, internal routes learnt via OSPF process 1 will always be preferred over external routes redistributed from OSPF 1 into OSPF 2.
If the main reason of implementing the different OSPF processes is to filter certain routes, the OSPF ABR Type-3 LSA Filtering feature should be considered to archive the same result. Instead of implementing a second OSPF process, the routers and links reside in OSPF process 2 as in the sample network, could be configured as another area in the OSPF process 1, followed by implementing Type-3 LSA filtering on RT2 and RT3, the ABRs.