Content

| 5.7 |  | Troubleshooting OSPF |
| 5.7.8 |  | SPF calculation and route flapping |

Whenever there is a change in topology, OSPF runs the SPF algorithm to compute the Shortest Path First tree again. Unstable links existing within the OSPF network could cause constant SPF calculations.

Some of the most common reasons for SPF running constantly are:

- Interface flaps within the area
- Neighbor interface flaps within the area
- Duplicate router ID

Topology changes in an OSPF network cause SPF calculations within that area. The SPF is not recalculated if the topology change is in another area. Actually, OSPF distributes interarea (between areas) topology information using a distance-vector method. The ABRs forward routing information between areas using a distance vector technique similar to that of RIP or IGRP.

The following is an example of SPF running constantly due to an interface flap within the network. This is a common problem in OSPF. Whenever there is a link flap in an area, OSPF runs SPF within that area. So, if a network has unstable links, it can cause constant SPF calculations. SPF itself is not a problem because OSPF is just adjusting to the change in the database through calculating SPF. The real problem occurs if there are small routers in the area and a constant SPF run might cause a CPU spike in a router.

Because R1 is also included in area 0, any link flap in area 0 causes all routers in area 0 to run SPF.

Debugs and Verification
A link flap in an area causes SPF to run. If a link is flapping constantly, this can increase the number of SPF calculations in an area. A constant number of SPF calculations in not a problem, but if the number is incrementing constantly, it is an indication of a problem.

The output of show ip ospf, shows that there is a huge counter for SPF in area 0.

The easiest way to find out which particular LSA is flapping is to turn on debug ip ospf monitor. This debug command in Figure shows that a router LSA is flapping in area 0.

The next step is to determine which router LSA is flapping and check the log for any interface flap. The show log command in Figure shows the log of the router with router ID 192.168.1.129, the ID displayed in the output of the debug ip ospf monitor command. The log shows that a serial link keeps going up and down. Whenever there is an interface flap, it causes SPF to run.

Solution
There are two solution to this problem:

1. Fix the link that is flapping.
2. Redefine the area boundaries.

Sometimes, the first solution might not be manageable because the link is flapping as the result of a telco outage that is outside the network boundary. One way to fix this temporarily is to manually shut down the interface.

The second solution requires some redesigning. If the link flap is happening too often, it might be possible to redefine the area, exclude this router from the area, and make it a member of a totally stubby area. Sometimes, this is also difficult to implement, depending upon the physical location of this link.

In short, link flaps are realities; if there are too many link flaps, the number of routers in an area should be decreased so that fewer routers are affected.