August 17, 2011

OSPF Graceful Shutdown

OSPF Graceful Shutdown
Erick N. Borgard CCNP


In this blog post, we are going to look at an OSPF feature called graceful shutdown.  Please consider the following diagram.


Presently, R1 is forwarding packets destined for the loopback of R4 towards R5.  All interfaces on all routers are running in OSPF area 0.  Because OSPF uses the formula Reference BW/Interface Bandwidth to calculate the cost of the link, it seem logical that R1 will, in fact, forward packets to R5 to reach the loopback of R4.  We can confirm this by examining the routing table of R1 for prefix 4.4.4.4.

R1#sh ip route 4.4.4.4
Routing entry for 4.4.4.4/32
  Known via "ospf 100", distance 110, metric 21, type intra area
  Last update from 10.0.15.5 on FastEthernet0/0, 00:05:15 ago
  Routing Descriptor Blocks:
  * 10.0.15.5, from 10.0.45.4, 00:05:15 ago, via FastEthernet0/0
      Route metric is 21, traffic share count is 1

The output above confirms that R1 is using R5 as the next hop to reach R4's loopback and is using route recursion to identify the interface to use when forwarding packets to 4.4.4.4.  That's R1's Fa0/0 interface in this case.

Now let's suppose this is the core of the production network and there is an issue with R5. R5 needs to be power cycled or possibly an IOS upgrade needs to be performed for new features or to bring it up to the same IOS level with the other routers in the OSPF routing domain.  If we just simply powered down R5, that would force the adjacent neighbors to wait for the OSPF dead timer to expire.  Furthermore, the OSPF SPF algorithm would need to be run on R1 to recalculate the SPF tree to reach R4s loopback and all of the other networks in the topology to which R5 is connected. What does that mean to us?  It means that there is a strong possibility that there will be dropped packets in the data plane while OSPF is re-converging.  That's not good.  A better option would be to use the OSPF graceful shutdown feature.  We can force R5 to advertise it's router LSAs with an infinite metric of 0xFFFF to it's neighbors.  This will force it's neighbors to use other LSAs in the database to reach networks that R5 is not directly connected to.

Here is the output of the show ip ospf command on R5 before any changes are made.  Some output will be removed for brevity.

R5#sh ip ospf 
 Routing Process "ospf 100" with ID 10.0.45.5
 Start time: 00:14:11.648, Time elapsed: 00:15:00.240
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Router is not originating router-LSAs with maximum metric
    Unset reason: unconfigured
    Unset time: 00:23:00.044, Time elapsed: 00:06:11.844
 Initial SPF schedule delay 5000 msecs

Now we can use the command max-metric router-lsa on R5.  We should see that R1 will load balance the traffic over both of the serial links towards 4.4.4.4 instead of using the fast ethernet link connected to R5.  

R5(config)#router ospf 100
R5(config-router)#max-metric router-lsa

Here is the output of R1s routing table for the 4.0.0.0 prefix.

R1#sh ip route 4.0.0.0
Routing entry for 4.0.0.0/8
  Known via "ospf 100", distance 110, metric 129, type intra area
  Last update from 10.0.12.2 on Serial0/0, 00:02:33 ago
  Routing Descriptor Blocks:
  * 10.0.13.3, from 10.0.45.4, 00:02:33 ago, via Serial0/1
      Route metric is 129, traffic share count is 1
    10.0.12.2, from 10.0.45.4, 00:02:33 ago, via Serial0/0
      Route metric is 129, traffic share count is 1

Our configuration can be further clarified by examining the router LSA for the network 10.0.45.5.  This is the network between R4 & R5. 

R5#sh ip ospf database router 10.0.45.5

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

                Router Link States (Area 0)

  Exception Flag: Announcing maximum link costs
  LS age: 404
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 10.0.45.5
  Advertising Router: 10.0.45.5
  LS Seq Number: 80000008
  Checksum: 0xD0FA
  Length: 60
  Number of Links: 3

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.45.5
     (Link Data) Router Interface address: 10.0.45.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 65535

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.15.5
     (Link Data) Router Interface address: 10.0.15.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 65535

The output above does show that R5 is advertising a metric of 65535 to reach it's connected link.  We can examine the output of the show ip ospf command on R5 again to further verify the configuration.

R5#sh ip ospf
 Routing Process "ospf 100" with ID 10.0.45.5
 Start time: 00:14:11.648, Time elapsed: 00:34:40.828
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Originating router-LSAs with maximum metric
    Condition: always, State: active
 Initial SPF schedule delay 5000 msecs

There are a few other options available to the engineer concerning OSPF graceful shutdown.
  1. Override the summary LSA metric
  2. Override the external LSA metric
  3. Set the infinite metric for stub area link
  4. Set the infinite metric after a reboot for a specific amount of time.



No comments:

Post a Comment