Adjusting OSPF Timers

Adjusting OSPF Timers

Problem

You want to change the default OSPF timers to improve stability or convergence behavior.

Solution

You can improve the convergence time of OSPF on a particular interface by reducing the hello and dead timers:

Router1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#interface Serial0/1
Router1(config-if)#ip ospf hello-interval 5
Router1(config-if)#ip ospf dead-interval 20
Router1(config-if)#exit
Router1(config)#end
Router1#

If you make this change on one router, you must make it on all of the other routers sharing the same network segment:

Router2#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#interface Serial0/0
Router2(config-if)#ip ospf hello-interval 5
Router2(config-if)#ip ospf dead-interval 20
Router2(config-if)#exit
Router2(config)#end
Router2#

Discussion

OSPF uses two timers. The hello timer controls how often the router sends routine messages to its neighbors simply by indicating that it is still up. If the neighbors don't hear any hello messages for a length of time defined by the dead-interval, they assume that the router is no longer reachable and drop it from the adjacency table.

The default values are 10 seconds for the hello time, and 40 seconds for the dead time. The usual rule of thumb with OSPF is to keep the dead time value four times the hello interval. However, this is not a strict rule. EIGRP, for example, uses a dead time that is only three times its hello interval. So if you wanted OSPF to have convergence times that more closely matched those of EIGRP, you could set the OSPF hello time to 5 seconds, and the dead interval to 15 seconds. Bear in mind that shortening the hello timer will increase the amount of traffic on the link. And shortening the dead interval increases the chances of losing adjacency just because of network congestion or link errors.

It is important to adjust the timers on all routers on the network segment together. Unlike EIGRP, which allows every router to use a different set of timers, in OSPF, the routers cannot establish adjacencies if their timers do not match exactly. But you can adjust the timers separately on different interfaces on a router. So you can use slower timers on low bandwidth links, and faster timers on faster links. In general, we don't recommend increasing the timers from their default values, but it can be useful to decrease them to improve convergence on important high-speed segments.

You can see the new timers with the show ip ospf interface command:

Router2#show ip ospf interface Serial0/0
Serial0/0 is up, line protocol is up
Internet Address 10.1.1.1/30, Area 2
Process ID 12, Router ID 192.168.30.1, Network Type POINT_TO_POINT, Cost: 130
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5
Hello due in 00:00:04
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 172.25.25.1
Suppress hello for 0 neighbor(s)
Simple password authentication enabled
Router2#

Looking at the neighbor table, you can see that the dead time reflects the configuration change. Note that the time indicated in this output is the actual time remaining before OSPF declares this neighbor invalid. So if everything is working properly, this value show count down from the configured dead time value until the hello interval expires. Then another hello packet will be sent, and the dead timer will start over at its maximum value:

Router2#show ip ospf neighbor 

Neighbor ID Pri State Dead Time Address Interface
172.25.25.1 1 FULL/ - 00:00:19 10.1.1.2 Serial0/0
Router2#

See Also