Friday, January 27, 2012

Redistribution between OSPF processes


Lets take a corner case where three OSPF processes running on a router are getting redistributed.
First a side note: A router running multiple ospf processes and learning a same from all of them, in that case router will install that route in the routing table associated with the ospf process which has least process I'd number.

R1 is directly connected with R2, R3 and R4. Loopback 0 is configured on all routers as 1.1.1.1, 2.2.2.2 , 3.3.3.3 and 4.4.4.4 respectively. 
Link between R1 and R2, and R2's loopback  are running ospf process 1 in area 0
Link between R1 and R3, and R3's loopback  are running ospf process 2 in area 0
Link between R1 and R4, and R4's loopback  are running ospf process 3 in area 0

The rule of redistribution says redistribution should happen only from the routing table. When redistribution between process 1 and process 3 takes place

1. R1 puts 2.2.2.2 from its "show ip route ospf 1" to R1's "show ip ospf 3 database" consecutively in R4's "show ip route ospf 3"
2. R1 puts 4.4.4.4 from its "show ip route ospf 3" to R1's "show ip ospf 1 database" consecutively in R2's "show ip route ospf 1"
After this redistribution R1's "show ip route ospf 1" still have same prefix i.e 2.2.2.2 (there is no change). Now if we redistribute between process 1 and process 2
1. R1 puts 2.2.2.2 from its "show ip route ospf 1" to R1's "show ip ospf 2 database" consecutively in R3's "show ip route ospf 2"
2. R1 puts 3.3.3.3 from its "show ip route ospf 2" to R1's "show ip ospf 1 database" consecutively in R2's "show ip route ospf 1"

After these two redistribution R3's "show ip route ospf 2" can not have R4's 4.4.4.4 and vice versa. Therefore we must redistribute between process 2 and process 3 in order to achieve the same.

The challege comes when we have two routers running 2 different ospf processes and redistribution is performed on both between these two processes.

In this case internal prefixes of any process say process 1 will become external to process 2, now these routers have to decide which route they should choose, if it were from same process it was easy for router to choose internal routes over external but here comparision is between internal prefixes of one process and external prefixes for another. Administrative Distance will also not help because its same for both. Here there is no way for the routers to determine which routes to take sometimes they prefer internal route from process 1 and sometimes externel from process 2 basically whichever router install last in the routing table but its not stable so condition is undetermined.