OSPF is one of the most popular routing protocols for enterprise networks. It has been around since the 1980s and has been continually updated and revised to conform to the requirements of modern IP networks.
As such, it is an extremely mature and robust routing protocol that can be tweaked and fine-tuned in many ways to enhance its performance.
A couple of features in particular that help to improve its performance are the graceful restart and graceful shutdown capabilities.
In this article, we’ll explain what these are, why they are beneficial, and how to configure them on Cisco routers.
OSPF Convergence Mechanism
Like all routing protocols, OSPF requires some time to exchange routing information and achieve a converged network.
When there is a change or a failure in the network topology, this causes OSPF to reconverge, resulting in a temporary disruption to the network, until it is able to complete its reconvergence to achieve a stable routing topology once again.
Maintenance may require an OSPF shutdown or restart
Sometimes it’s necessary to restart the OSPF process in a router or to shut it down completely when performing maintenance, requiring OSPF to reconverge after such actions.
Although reconvergence will typically take place relatively quickly, even such a reconvergence may cause problems on mission-critical production networks.
For this reason, when performing such tasks, it is best practice to use OSPF’s graceful restart and graceful shutdown features to minimize the disruption to routing on the network.
Graceful OSPF Features
These two related features allow you to restart or shut down the OSPF process in an OSPF router without disrupting the routing process.
Although the processes are related, they differ only in the mechanism by which OSPF is brought back to its stable operating state. An explanation of each follows:
OSPF Graceful Restart
OSPF’s graceful restart feature is a mechanism that allows an OSPF router to undergo a restart without causing its neighbors to perceive such a restart as a link-state change.
This feature is able to maintain traffic flow without major interruptions during such restarts. This is why it is sometimes called OSPF’s “non-stop forwarding” or NSF feature.
When an administrator performs a graceful restart on an OSPF router, the router notifies its neighbors of its intention to restart.
It does this by sending Hello packets with the “Restart” bit set. The router also sends out Link-State Advertisements (LSAs) called “Grace LSAs”.
These LSAs contain the grace period, which indicates the number of seconds the neighbors should wait without receiving OSPF hellos before considering the restarting router as down. Cisco routers have a default of 120 seconds for this value.
The router then undergoes the restart phase, during which it retains its forwarding table, so data can still be forwarded. The control plane, however, where OSPF operates, will become inactive during this time. This means that no new OSPF packets of any type are sent or processed during this time.
For a maximum duration of the configured grace period, all neighboring OSPF routers maintain their OSPF adjacencies with the restarting router. Similarly, the restarting router will maintain its forwarding tables and routing tables unchanged and will continue to forward traffic normally.
Once the restart is completed, the router begins reinitializing OSPF adjacencies with its neighbors. It attempts to synchronize its OSPF database with its neighbors without causing a full OSPF adjacency reset.
If the synchronization is successful, the OSPF process returns to normal. If not, it may trigger a regular OSPF adjacency initialization and synchronization.
OSPF Graceful Shutdown
An OSPF graceful shutdown is almost identical in its operation to the graceful restart feature. It only differs in that the end result is that the OSPF process on the router in question remains shut down. This is the case until it is manually brought back up again.
For this reason, administrators must ensure that the configured grace period is large enough to ensure that all scheduled maintenance tasks can be completed before manually bringing the OSPF process.
If this is not the case, and the grace period elapses, OSPF adjacencies will fail, and forwarding and routing tables will begin to be modified.
How to Perform Graceful Restart & Shutdown
On a Cisco device, the graceful restart and shutdown functions can be performed with specific commands issued on the CLI.
Graceful Restart on Cisco Router
Performing a graceful OSPF restart on a Cisco IOS router involves enabling the OSPF graceful restart feature and then conducting the restart operation.
To enable and initiate the feature, issue the following commands:
Router#configure terminal
Router(config)#router ospf 1
Router(config-router)#graceful-restart
Router(config-router)#exit
Router(config)#exit
Router#clear ip ospf 1 process
In the above series of configuration commands, the graceful-restart command essentially enables the feature. It ensures that when the OSPF process is cleared, it is done so gracefully. The clear ip ospf 1 process command then gracefully resets the OSFP process.
Graceful Shutdown on Cisco Router
An OSPF graceful shutdown can be performed on the global OSPF process, or on a particular interface. When applied to an interface, it shuts down the operation of OSPF only for adjacencies established through that interface.
For the global graceful shutdown procedure, issue the following commands:
Router(config)#router ospf 1
Router(config-router)#shutdown
For the interface graceful shutdown procedure, issue the following commands on the interface in question:
Router(config)# interface FastEthernet 0/0
Router(config-if)# ip ospf shutdown
To bring the OSPF process back up in both cases, prefix the keyword no before each command like so.
Router(config)#router ospf 1
Router(config-router)#no shutdown
and
Router(config)# interface FastEthernet 0/0
Router(config-if)# no ip ospf shutdown
Adjusting the Grace Period
If you want to specify a grace period different from the default value, you can do so with the following command:
Router(config-router)# graceful-restart grace-period 240
The above command sets the grace period to 240 seconds. This command sets the grace period for both graceful shutdown and restart procedures.
Additional Configuration Considerations
The following should be kept in mind whenever using these features:
- The graceful restart and shutdown capabilities must be supported and enabled on both the restarting router and its neighbors.
- The grace period should be set carefully. It should be long enough to allow the router to restart but not too long to delay network convergence in the event of actual failures. When using the graceful shutdown feature, the OSPF process should be manually restarted well before the expiry of the grace period.
- If the network topology changes during the grace period (like a link failure), the graceful restart might not complete successfully. Neighbors might not wait for the full grace period if they detect such changes.
Conclusion
OSPF’s graceful restart and shutdown features are very useful, especially in situations where a production network requires changes to its OSPF configuration, but requires as little disruption as possible.
These features provide a balance between network stability and the need for regular maintenance and updates.
They are valuable tools for network operators seeking to minimize disruptions during planned outages. However, they should always be applied carefully taking into consideration all of the best practice guidelines provided by network equipment vendors such as Cisco and others.
Related links:
- https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/configuration/15-s/iro-15-s-book/iro-nsf-ospf.html
- https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/configuration/15-sy/iro-15-sy-book/iro-ttl.html#GUID-67D983A0-377F-442F-9DFC-A67A1915923B
Related Posts
- Explanation and Comparison of OSPF E1 vs E2 Routes
- Explanation and Configuration of OSPF MD5 Authentication on Cisco Networks
- Explanation of BGP Neighbor Adjacency States on Cisco Devices
- Comparison of Static vs Dynamic Routing in TCP/IP Networks
- How to Configure Static Routing on Cisco IOS Routers (Examples)