OSPF Stub Router Advertisement

Feature History for OSPF Stub Router Advertisement

This table provides release and platform support information for the features explained in this module.

These features are available in all the releases subsequent to the one they were introduced in, unless noted otherwise.

Release

Feature Name and Description

Supported Platform

Cisco IOS XE 17.18.1

OSPF Stub Router Advertisement: The OSPF Stub Router Advertisement is an enhancement feature that enables a device running OSPF to temporarily advertise itself as an undesirable path, also known as stub, by setting its OSPF interface metrics to maximum or infinite.

Cisco C9350 Series Smart Switches

Cisco C9610 Series Smart Switches

OSPF Stub Router Advertisement

The OSPF Stub Router Advertisement is an enhancement feature that enables a device running OSPF to temporarily advertise itself as an undesirable path, also known as stub, by setting its OSPF interface metrics to maximum or infinite.

This is useful in two main scenarios:

  • Bringing up a new device:

    Prevents immediate OSPF transit traffic through the new device until it is fully operational.

  • Graceful shutdown or reload:

    Allows a device to withdraw itself from being a transit path, preventing packet loss when the device is about to go down.

OSPF Stub Router configuration options

This feature provides three configuration options:

  • Default route only advertisement

    The device only advertises a default route with a maximum metric. All other routes are withdrawn from OSPF advertisements.

  • Maximum metric for all routes

    The device advertises all its routes, but with a maximum metric. This effectively makes the device the least preferred path for all networks.

  • Maximum metric for summary and external routes only

    Only summary and external routes (LSA Type 3, 4, and 5) are advertised with a maximum metric.

Startup maximum metric options

This options prevent neighbor routers from immediately sending traffic through a new or reloaded router, allowing time for BGP or other routing tables to fully converge. This prevents packet loss due to incomplete routing information during initial startup.

  1. Timer-Based Maximum Metric Advertisement

    When the device starts or reloads, it advertises a maximum metric for a user-configured period (timer). Neighbor devices avoid using this device as a transit path until the timer expires. After timer expiration, the device advertises normal OSPF metrics, and can be used for forwarding traffic.

  2. BGP-Dependent Maximum Metric Advertisement

    The device advertises a maximum metric at startup and continues to do so until either:

    • BGP routing tables have converged (detected via BGP protocol events)

    • The default timer expires (600 seconds), whichever comes first

    Ensures that the device does not forward transit traffic until BGP is ready, preventing packet drops. The device advertises normal OSPF metrics.

OSPF maximum metric and graceful shutdown

This enables a device to gracefully withdraw itself from being a transit path in the network before being shut down, reloaded, or taken out of service. This minimizes the risk of dropped packets and service disruptions.

Before shutdown, the device is configured to advertise a maximum metric (infinite cost) for all its OSPF links. Neighboring devices recalculate their OSPF paths and select alternate routes to avoid the device scheduled for shutdown. The device does not receive new transit traffic, so it can finish processing any local traffic before being removed from the network, minimizing packet loss. The device can be powered down, rebooted, or reconfigured without impacting end-to-end connectivity for other devices.

How OSPF Stub Router Advertisement works

Workflow

  1. The device advertises a maximum (or infinite) cost for all its OSPF routes.
  2. Other devices will avoid using this device as a transit path.
  3. Once the device is ready or has completed its shutdown, normal metrics are restored.

Configure OSPF Stub Router Advertisement

These sections provide configuration information on OSPF stub router advertisement.


Note


All tasks are optional and should be individually configured.


Configure advertisement on startup

Perform this task to configure advertisement on startup.

Procedure


Step 1

enable

Example:

Device> enable

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device# configure terminal

Enters global configuration mode.

Step 3

router ospf process-id [vrf vrf-name]

Example:

Device(config)# router ospf 15

Enables OSPF routing and enters router configuration mode.

  • process-id : The process ID is an internally used identification parameter that is locally assigned. Each OSPF process has a unique process ID.

    Process ID can be a positive integer from 1 to 65535.

  • vrf: Indicates that the OSPF process is being configured for a specific VRF.

  • vrf-name : Specifies the name of the VRF for which this OSPF process is being created.

Step 4

max-metric router-lsa on-startup announce-time

Example:

Device(config-router)# max-metric router-lsa on-startup 100

Configures OSPF to advertise a maximum metric during startup for a configured period of time.

The announce-time argument is a configurable timer that must follow the on-startup keyword to be configured. The configurable time range is from 5 to 86,400 seconds. There is no default timer value.

Step 5

end

Example:

Device(config-router)# end

Returns to privileged EXEC mode.


Configure advertisement until routing tables converge

Perform this task to configure advertisement until routing tables converge.

Procedure


Step 1

enable

Example:

Device> enable

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device# configure terminal

Enters global configuration mode.

Step 3

router ospf process-id [vrf vrf-name]

Example:

Device(config)# router ospf 15

Enables OSPF routing and enters router configuration mode.

  • process-id : The process ID is an internally used identification parameter that is locally assigned. Each OSPF process has a unique process ID.

    Process ID can be a positive integer from 1 to 65535.

  • vrf: Indicates that the OSPF process is being configured for a specific VRF.

  • vrf-name : Specifies the name of the VRF for which this OSPF process is being created.

Step 4

max-metric router-lsa on-startup wait-for-bgp

Example:

Device(config-router)# max-metric router-lsa on-startup 100

Configures OSPF to advertise a maximum metric until BGP routing tables have converged or until the default timer has expired. The wait-for-bgp keyword must follow the on-startup keyword to be configured. The default timer value is 600 seconds.

Step 5

end

Example:

Device(config-router)# end

Returns to privileged EXEC mode.


Configure advertisement for a graceful shutdown

Perform this task to configure advertisement for a graceful shutdown.

Procedure


Step 1

enable

Example:

Device> enable

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device# configure terminal

Enters global configuration mode.

Step 3

router ospf process-id [vrf vrf-name]

Example:

Device(config)# router ospf 15

Enables OSPF routing and enters router configuration mode.

  • process-id : The process ID is an internally used identification parameter that is locally assigned. Each OSPF process has a unique process ID.

    Process ID can be a positive integer from 1 to 65535.

  • vrf: Indicates that the OSPF process is being configured for a specific VRF.

  • vrf-name : Specifies the name of the VRF for which this OSPF process is being created.

Step 4

max-metric router-lsa

Example:

Device(config-router)# max-metric router-lsa

Configures OSPF to advertise a maximum metric until the router is shut down.

Step 5

end

Example:

Device(config-router)# end

Returns to privileged EXEC mode.

Step 6

show ip ospf

Example:

Device# show ip ospf

Use the show ip ospf command to verify that the max-metric router-lsa command has been enabled before the device is shut down or reloaded.


Configuration examples of OSPF Stub Router Advertisement

This section provides configuration example of OSPF stub router advertisement.

Example: Advertisement on startup

In the following example, a device that is running OSPF is configured to advertise a maximum metric at startup for 300 seconds:

Device> enable
Device# configure terminal
Device(config)# router ospf 100
Device(config-router)# max-metric router-lsa on-startup 300
Device(config-router)# end

Example: Advertisement until routing tables converge

In the following example, a router that is running OSPF is configured to advertise a maximum metric until BGP routing tables converge or until the default timer expires (600 seconds):

Device> enable
Device# configure terminal
Device(config)# router ospf 100
Device(config-router)# max-metric router-lsa on-startup wait-for-bgp
Device(config-router)# end

Example: Graceful shutdown

In the following example, a device that is running OSPF is configured to advertise a maximum metric until the device is shut down:

Device> enable
Device# configure terminal
Device(config)# router ospf 100
Device(config-router)# max-metric router-lsa
Device(config-router)# end

Example: Verify the advertisement of a maximum metric

To verify that the advertisement of a maximum metric has been configured correctly, use the show ip ospf or show ip ospf database command.

The output of the show ip ospf command will display the condition, state, and remaining time delay of the advertisement of a maximum metric, depending on which options were configured with the max-metric router-lsa command.

The following sample output is similar to the output that will be displayed when the on-startup keyword and announce-time argument are configured with the max-metric router-lsa command:
Device# show ip ospf
Routing Process "ospf 1998" with ID 10.18.134.155
     Supports only single TOS(TOS0) routes
     Supports opaque LSA
     It is an area border and autonomous system boundary router
     Redistributing External Routes from,
        static, includes subnets in redistribution
     Originating router-LSAs with maximum metric, Time remaining: 00:01:18
        Condition: on startup for 300 seconds, State: active
     SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
     Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
     Number of external LSA 7. Checksum Sum 0x47261 
     Number of opaque AS LSA 0. Checksum Sum 0x0     
     Number of DCbitless external and opaque AS LSA 0
     Number of DoNotAge external and opaque AS LSA 0
     Number of areas in this router is 2. 1 normal 0 stub 1 nssa
     External flood list length 0
        Area BACKBONE(0)
           Number of interfaces in this area is 1
           Area has no authentication
           SPF algorithm executed 3 times
           Area ranges are
           Number of LSA 8. Checksum Sum 0x474AE 
           Number of opaque link LSA 0. Checksum Sum 0x0 

The following sample output is similar to the output that will be displayed when the on-startup and wait-for-bgp keywords are configured with the max-metric router-lsa command:

Device# show ip ospf
Routing Process "ospf 1998" with ID 10.18.134.155
     Supports only single TOS(TOS0) routes
     Supports opaque LSA
     It is an area border and autonomous system boundary router
     Redistributing External Routes from,
        static, includes subnets in redistribution
     Originating router-LSAs with maximum metric, Time remaining: 00:01:18
        Condition: on startup while BGP is converging, State: active
     SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
     Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
     Number of external LSA 7. Checksum Sum 0x47261 
     Number of opaque AS LSA 0. Checksum Sum 0x0     
     Number of DCbitless external and opaque AS LSA 0
     Number of DoNotAge external and opaque AS LSA 0
     Number of areas in this router is 2. 1 normal 0 stub 1 nssa
     External flood list length 0
        Area BACKBONE(0)
           Number of interfaces in this area is 1
           Area has no authentication
           SPF algorithm executed 3 times
           Area ranges are
           Number of LSA 8. Checksum Sum 0x474AE 
           Number of opaque link LSA 0. Checksum Sum 0x0 

The following sample output is similar to the output that will be displayed when the max-metric router-lsa command is configured without any keywords or arguments:

Device# show ip ospf
Routing Process "ospf 1998" with ID 10.18.134.155
     Supports only single TOS(TOS0) routes
     Supports opaque LSA
     It is an area border and autonomous system boundary router
     Redistributing External Routes from,
        static, includes subnets in redistribution
     Originating router-LSAs with maximum metric
        Condition: always, State: active
     SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
     Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
     Number of external LSA 7. Checksum Sum 0x47261 
     Number of opaque AS LSA 0. Checksum Sum 0x0     
     Number of DCbitless external and opaque AS LSA 0
     Number of DoNotAge external and opaque AS LSA 0
     Number of areas in this router is 2. 1 normal 0 stub 1 nssa
     External flood list length 0
        Area BACKBONE(0)
           Number of interfaces in this area is 1
           Area has no authentication
           SPF algorithm executed 3 times
           Area ranges are
           Number of LSA 8. Checksum Sum 0x474AE 
           Number of opaque link LSA 0. Checksum Sum 0x0 

The output of the show ip ospf database command will display information about OSPF LSAs and indicate if the router is announcing maximum cost links. The following sample output is similar to the output that will be displayed when any form of the max-metric router-lsa command is configured:

Device# show ip ospf database
      Exception Flag: Announcing maximum link costs
      LS age: 68
      Options: (No TOS-capability, DC)
      LS Type: Router Links
      Link State ID: 172.18.134.155
      Advertising Router: 172.18.134.155
      LS Seq Number: 80000002
      Checksum: 0x175D
      Length: 60
      Area Border Router
      AS Boundary Router
      Number of Links: 3
 
        Link connected to: a Transit Network
        (Link ID) Designated Router address: 192.168.1.11
        (Link Data) Router Interface address: 192.168.1.14
         Number of TOS metrics: 0
          TOS 0 Metrics: 65535 (metric used for local calculation: 10)
 
        Link connected to: a Transit Network
        (Link ID) Designated Router address: 10.1.145.11
        (Link Data) Router Interface address: 10.1.145.14
         Number of TOS metrics: 0
          TOS 0 Metrics: 65535 (metric used for local calculation: 10)
 
        Link connected to: a Stub Network
        (Link ID) Network/subnet number: 10.11.12.0
        (Link Data) Network Mask: 255.255.255.0
         Number of TOS metrics: 0
          TOS 0 Metrics: 1 

Monitor and maintain OSPF Stub Router Advertisement

Command

Purpose

show ip ospf

Displays general information about OSPF routing processes and provides information about the configuration settings and status of the OSPF Stub Router Advertisement feature.

show ip ospf database router

Displays information about device LSAs, and indicates if a device is announcing maximum link costs.