Genie's Tech Blog

Where knowledge has no dimensions

OSPF Local-RIB

Hello Friends,

Today, I will be sharing an interesting issue which we noticed during one of our migration projects. The feature that i am going to discuss today is the OSPF Local-RIB feature. In order to understand the feature, lets try to create the problematic condition. Consider the below topology:

In the above topology, Rx router has the Loopback address of x.x.x.x/32 (ex. R1 has a loopback of 1.1.1.1/32). All the nodes are running basic OSPF configuration which is advertising the physical interface and the loopback interface. Thus we have a end to end reachability. Lets have a look at the routing table of R1, R2 and R3.

 

Output on R1:
=========
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 12.12.12.2, 1d11h, Ethernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/21] via 12.12.12.2, 1d11h, Ethernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.12.12.0 is directly connected, Ethernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
O       13.13.13.0 [110/20] via 12.12.12.2, 1d11h, Ethernet0/0
R1#

R1#ping 3.3.3.3 so lo0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/10/12 ms
R1#

Output on R3:
=========
R3#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/21] via 13.13.13.1, 1d11h, Ethernet1/0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 13.13.13.1, 1d11h, Ethernet1/0
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
O       12.12.12.0 [110/20] via 13.13.13.1, 1d11h, Ethernet1/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, Ethernet1/0
R3#

R3#ping 1.1.1.1 so lo0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
R3#

Thus from the above logs we can see that we have end to end reachability. We shall now do the testing for failure.

Testing for failure

Reload R1 to remove the route from both R2 and R3 routing table. Lets check the events on the router R3.

Output on R3 before reload:
==================
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/21] via 13.13.13.1, 00:03:39, Ethernet1/0  <<<<<<<<<<<
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 13.13.13.1, 00:03:39, Ethernet1/0  <<<<<<<<<<<
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
O       12.12.12.0 [110/20] via 13.13.13.1, 00:03:39, Ethernet1/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, Ethernet1/0
R3#
R3#
R3#sh ip ospf stat

            OSPF Router with ID (3.3.3.3) (Process ID 100)

  Area 0: SPF algorithm executed 2 times

  Summary OSPF SPF statistic

  SPF calculation time
Delta T   Intra D-Intra Summ    D-Summ  Ext     D-Ext   Total   Reason
00:03:55   0    0       0       0       0       0       0       R, N, 
00:03:45   0    0       0       0       0       0       0       R, N,  <<<<<<<<<<<

  RIB manipulation time during SPF (in msec):
Delta T     RIB Update    RIB Delete
00:03:55    0             0             
00:03:45    0             0             
R3#

Output on R3 after reload:
=================
R3#sh ip ospf stat

            OSPF Router with ID (3.3.3.3) (Process ID 100)

  Area 0: SPF algorithm executed 3 times

  Summary OSPF SPF statistic

  SPF calculation time
Delta T   Intra D-Intra Summ    D-Summ  Ext     D-Ext   Total   Reason
00:05:17   0    0       0       0       0       0       0       R, N, 
00:05:07   0    0       0       0       0       0       0       R, N, 
00:00:00   0    0       0       0       0       0       0       R, N,   <<<<<<<<<<<

  RIB manipulation time during SPF (in msec):
Delta T     RIB Update    RIB Delete
00:05:17    0             0             
00:05:07    0             0             
00:00:00    0             0             
R3#sh ip route    
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/11] via 13.13.13.1, 00:00:03, Ethernet1/0  <<<<<<<<<<<<<
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
O       12.12.12.0 [110/20] via 13.13.13.1, 00:00:03, Ethernet1/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, Ethernet1/0
R3#

In the above logs, we can see that before the reload, the route in the RIB was for over 3 min for both R1 and R2 loopback address. As soon as we reloaded the R1 router, we see the SPF was run but the bigger problem was the routes in the RIB got reinstalled and the uptime for the route was refreshed. Now consider a network where we have 100's of routers in OSPF domain and if they have say 10000 routes in the RIB and any network event occurs, every router in the network will refresh its routing table which is not a feasible thing as it will consume a lot of CPU cycles and there may be a traffic loss due to this event. We can also run a debug to see why this happened.

Output on R3 when R1 is reloaded:
======================
R3#debug ip ospf monitor
OSPF spf monitoring debugging is on
R3#
00:10:52: OSPF: Schedule SPF in area 0
      Change in LS ID 1.1.1.1, LSA type R, , spf-type Full
00:10:52: OSPF: reset throttling to 5000ms
00:10:52: OSPF: schedule SPF: spf_time 00:10:52.360 wait_interval 5000ms
R3#
00:10:56: OSPF: Schedule SPF in area 0
      Change in LS ID 2.2.2.2, LSA type R, , spf-type Full
00:10:56: OSPF: Schedule SPF in area 0
      Change in LS ID 12.12.12.2, LSA type N, , spf-type Full
00:10:57: OSPF: Begin SPF at 657.368ms, process time 16ms
00:10:57:       spf_time 00:10:52.360, wait_interval 5000ms
00:10:57: OSPF: wait_interval 10000ms next wait_interval 10000ms
00:10:57: OSPF: End SPF at 657.368ms, Total elapsed time 0ms
00:10:57:       Schedule time 00:10:57.368, Next wait_interval 10000ms
00:10:57:       Intra: 0ms, Inter: 0ms, External: 0ms
00:10:57:       R: 2, N: 1, Stubs: 3
00:10:57:       SN: 0, SA: 0, X5: 0, X7: 0
R3#
00:10:57:       SPF suspends: 0 intra, 0 total

R3#
00:11:01: OSPF: Schedule SPF in area 0
      Change in LS ID 2.2.2.2, LSA type R, , spf-type Full
R3#
00:11:06: OSPF: Schedule SPF in area 0
      Change in LS ID 1.1.1.1, LSA type R, , spf-type Full
00:11:06: OSPF: Schedule SPF in area 0
      Change in LS ID 12.12.12.2, LSA type N, , spf-type Full
00:11:07: OSPF: Begin SPF at 667.368ms, process time 16ms
00:11:07:       spf_time 00:10:57.368, wait_interval 10000ms
00:11:07: OSPF: wait_interval 10000ms next wait_interval 10000ms
00:11:07: OSPF: End SPF at 667.368ms, Total elapsed time 0ms
00:11:07:       Schedule time 00:11:07.368, Next wait_interval 10000ms
00:11:07:       Intra: 0ms, Inter: 0ms, External: 0ms
00:11:07:       R: 3, N: 2, Stubs: 3
00:11:07:       SN: 0, SA: 0, X5: 0, X7: 0
R3#
00:11:07:       SPF suspends: 0 intra, 0 total

From the above debugs we can see that as soon as the R1 was rebooted, the Full SPF was run on both the R1 as well as for the R2. But due to the absence of the OSPF Local-Rib feature, the complete OSPF RIB got refreshed (including for R2). With OSPF Local-RIB enabled, each OSPF instance maintains its own OSPF RIB and it only does incremental updates to the RIB which has occurred due to a network event. Thus all the routes wont get refreshed. The global RIB is not updated with intermediate results during the SPF.

Now lets see what happens when we run one of the latest releases say 12.2(33)SB6b or you can take any other releases for that matter.

Output on R3 before R1 is rebooted:
=======================
R3#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, + - replicated route

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/21] via 13.13.13.1, 00:00:32, Ethernet1/0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/11] via 13.13.13.1, 00:00:32, Ethernet1/0
      3.0.0.0/32 is subnetted, 1 subnets
C        3.3.3.3 is directly connected, Loopback0
      12.0.0.0/24 is subnetted, 1 subnets
O        12.12.12.0 [110/20] via 13.13.13.1, 00:00:32, Ethernet1/0
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        13.13.13.0/24 is directly connected, Ethernet1/0
L        13.13.13.2/32 is directly connected, Ethernet1/0
R3#

Output on R3 after R1 is reloaded:
======================
R3#
00:02:45: OSPF: Schedule SPF in area 0, topology Base with MTID 0
      Change in LS ID 1.1.1.1, LSA type R, , spf-type Full
00:02:45: OSPF: reset throttling to 5000ms next wait-interval 10000ms
00:02:45: OSPF: schedule SPF in topology Base with MTID0: spf_time 00:02:45.488 wait_interval 5000ms
R3#
00:02:49: OSPF: Schedule SPF in area 0, topology Base with MTID 0
      Change in LS ID 2.2.2.2, LSA type R, , spf-type Full
00:02:49: OSPF: Schedule SPF in area 0, topology Base with MTID 0
      Change in LS ID 12.12.12.2, LSA type N, , spf-type Full
00:02:50: OSPF: Begin SPF for topology Base with MTID 0 at 170.492ms, process time 8ms
00:02:50:       spf_time 00:02:45.488, wait_interval 5000ms
00:02:50: OSPF: Setting next wait-interval to 10000ms 
00:02:50: OSPF: End SPF for topology Base with MTID 0 at 170.492ms, Total elapsed time 0ms
00:02:50:       Schedule time 00:02:50.492, Next wait_interval 10000ms
00:02:50:       Intra: 0ms, Inter: 0ms, External: 0ms
R3#
00:02:50:       R: 2, N: 1, Stubs: 3
00:02:50:       SN: 0, SA: 0, X5: 0, X7: 0
00:02:50:       SPF suspends: 0 intra, 0 total

R3#

R3#sh ip ospf stat

            OSPF Router with ID (3.3.3.3) (Process ID 100)

  Area 0: SPF algorithm executed 6 times

  Summary OSPF SPF statistic

  SPF calculation time
Delta T   Intra D-Intra Summ    D-Summ  Ext     D-Ext   Total   Reason
00:03:59   0    0       0       0       0       0       0       R, N, 
00:03:49   0    0       0       0       0       0       0       R, N, 
00:01:59   0    0       0       0       0       0       0       R, N, 
00:01:49   0    0       0       0       0       0       0       R, N, 
00:01:17   0    0       0       0       0       0       0       R, N, 
00:01:07   0    0       0       0       0       0       0       R, N, 

R3#
R3#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, + - replicated route

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/21] via 13.13.13.1, 00:01:17, Ethernet1/0
     2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/11] via 13.13.13.1, 00:04:00, Ethernet1/0  
     3.0.0.0/32 is subnetted, 1 subnets
C        3.3.3.3 is directly connected, Loopback0
      12.0.0.0/24 is subnetted, 1 subnets
O        12.12.12.0 [110/20] via 13.13.13.1, 00:04:00, Ethernet1/0
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        13.13.13.0/24 is directly connected, Ethernet1/0
L        13.13.13.2/32 is directly connected, Ethernet1/0
R3#

In the above output we can see that once the R1 was reloaded, there was on change in the RIB of R3 for the R2 loopback address.

Hope the above testing helped clear the concept of OSPF Local-RIB.

Feel free to reach out to me for any questions.

Cheers...!!!

Genie
www.codergenie.com 

Comments are closed