The OSPF Stub Router Advertisement feature is used to gracefully shut down or reload an OSPF-enabled router without dropping packets using the router as transit to reach other networks.
This feature is also used to bring a new OSPF-enabled router to the network without immediately start routing traffic through it.
The way it works is that when Stub Router Advertisement is configured, the router will originate LSAs with the max-metric set through all transit links. This cause the OSPF neighbors assign a higher cost to the router; therefore, they will use alternate paths to reach networks passing through the router.
OSPF Stub Router Advertisement at Startup:
Configuring this feature when the router is started or reloaded is used to force neighbor routers to use alternate paths while a defined timer expires. This is helpful because it allows the routing table to converge before traffic is sent through the router. This improves the stability of the network.
To configure OSPF Stub Router Advertisement on Startup use the max-metric router-lsa on-startup <announce-time> OSPF process command. The announce-time parameter is a configurable timer which goes from 5 to 86,400 seconds.
This feature can also be used in situations where the router to be reloaded also receive routes from BGP. IGPs converge very quickly, and most of the times before BGP, therefore, if an OSPF neighbor router forwards traffic through the recently reloaded router before BGP has converged, these packets may be dropped.
To configure OSPF Stub Router Advertisement in situations where is required waiting for BGP convergence, use the max-metric router-lsa wait-for-bgp OSPF process command. By using this feature, OSPF will advertise max-metric through all transit links until BGP routing table has converged or until the default timer has expired. The default timer is 600 seconds.
OSPF Stub Router Advertisement for Graceful Shutdown:
This feature is used in situations where is necessary removing a router from the network. Without using this feature, if a non-directly connected OSPF-enabled router is removed from the network, the OSPF neighbors will wait for the dead timers to expire before the adjacency and the routing tables reconverge. Some packets may be dropped while the routing tables reconverge. Therefore, advertising max-metric before shutdown allows other neighbors to use alternate paths before the transit router becomes inaccessible.
To configure OSPF Stub Router Advertisement for Graceful Shutdown use the max-metric router-lsa OSPF process command. Keep in mind not to save the configuration after Graceful Shutdown was configured because the router will continue advertising max-metric after the router was turn on.
Let’s use the following topology for the examples:
Here you can download the diagram and configuration files: OSPF-Stub-RA
About the topology:
All routers have loopback0 interface configured (not shown in the diagram) as follows: Lo0 in R1 has 126.96.36.199/33, R2 has 188.8.131.52/32, and R3 has 184.108.40.206/32 and so on. The loopback interfaces are advertised into OSPF. R4 has OSPF Stub Router Advertisement configured with a timer set to 300 seconds (5 minutes) with the command max-metric router-lsa on-startup 300.
Before R4 was shut down, the OSPF process is showing the Stub Router Advertisement feature inactive as shown next:
From the perspective of R5, the route to the transit network 192.168.12.0/24 it’s been load balanced between R3 and R4.
Ok, it’s time to turn on R4 and let’s see what happens.
First, let’s check the OSPF process:
As can be viewed in the above output, the OSPF Stub Router Advertisement is now active; it also shows the timer with 4 minutes and 40 seconds left before the router start advertising the LSAs without the maximum metric value.
Now let’s take a look to the router LSAs (Type-1) in R4. Let’s use the show ip ospf database router self-originate command for this purpose.
As can be seen in the output, the Type-1 LSAs corresponding to the transit networks in R4 have the max-metric set. This is also known as LSInfinity. Also, note the metric of the loopback0 interface remain as 1. This is because stub router advertisement only affects to non-stub networks. Despite the transit networks have the metric set to LSInfinity; the stub networks still have reachability to the rest of the network as shown next:
Finally from the perspective of R5, the previous load balanced path to the segment 192.168.12.0/24 is now only via R3 as shown next.
After the timer had ended, the transit routes through R4 were advertised to the neighbors with normal LSAs and the OSPF Stub Router Advertisement feature went to the inactive state.
Now it is practically the same example when is required waiting for BGP routes to converge using the command max-metric router-lsa wait-for-bgp. The difference is that this feature will go to the inactive state if BGP fully converges and start redistributing routes into OSPF or the default timer of 600 seconds expires, whichever comes first.
Now, let’s configure OSPF Graceful Shutdown in R3.
router ospf 1
Immediately after the command was entered, the OSPF Stub Router Advertisement was triggered with the condition set to always as shown next:
Now it’s possible to turn off the router without much problem because transit traffic no longer passes through R3. Other neighbors are receiving the LSAs with the LSInfinity set. Remember not to save the configuration after this feature was configured because the router will continue advertising max-metric after the router was turn on.
To confirm the configuration let’s take a look to the Type-1 LSAs in R3:
As can be seen in the above output, the self-originated Type-1 LSAs in R3 have the metric of the transit networks set to LSInfinity. The cost of the stub networks remains the same.
In newer IOS version, is possible to extend this behavior to stub networks using the command max-metric router-lsa include-stub.
It is time to close this post. In the next one, we will discuss OSPF LSA & SPF Throttling.
Thank you for visiting.