OSPF Stub Router Advertisement is documented in RFC 3137. In this blog post, you learn how this feature works in order to enable an OSPF node to inform routers in the network not to choose it as a transit node in paths to destinations in the network. Additionally, you learn how to configure and verify OSPF stub routing in Cisco IOS.
The concept of OSPF stub router advertisement has nothing to do with OSPF stub areas, if you want to learn about them, have a look at these guides:
In this tutorial, I will use this network topology. The network consists of six routers and two routing domains (OSPF and BGP). The OSPF routing domain contains three areas: area 2, area 4, and the backbone area. Besides, the OSPF cost of the serial link is 1.
R2 and R4 advertise the OSPF default route to their neighbors so that they will use it to reach BGP subnet 10.0.130.0/24. Additionally, routers R2 and R4 redistribute subnets 10.0.23.0/24 and 10.0.34.0/24, respectively, into OSPF.
The BGP routing domain consists of three routers running two BGP neighbor adjacencies: one between R3 and R2 and the other between R3 and R4.
Click the following links to download the initial router configurations.
Router R1 | Router R2 | Router R3 |
Router R4 | Router R5 | Router R6 |
What is OSPF Stub Router Advertisement?
The OSPF stub router advertisement feature allows you to add, remove, shut down, or restart an OSPF-enabled router without instantly impacting network traffic.
Basically, when you enable this feature, the router advertises with an infinite metric (equals 65535), to all neighbors, its interfaces that IP traffic passes through to reach OSPF destinations outside the current router. In fact, those interfaces get advertised at a cost of 65535 within the router’s self-originated router LSA.
Consequently, each router in the OSPF routing domain re-executes the SPF algorithm in order to produce a new SPT in which the stub router would not be a transit node in almost every OSPF path between two endpoints in the tree, except for links solely attached to the stub router.
In this network topology, we have five routers and the OSPF cost of each network link is 10. R2 is used by R1 as a transit router to routers R4 and R5.
If we configure router R2 as an OSPF stub router, R2’s transit interfaces i.e. connected to OSPF neighbors, appear with a cost of 65535, as shown in this figure.
And, R1’s SPF tree will look like the following. R2 is no longer used as a transit router by R1.
Finally, even though R2 is acting as a stub router, it continues to send and receive LSAs from all of its neighbors.
How Does OSPF Stub Router Advertisement Work?
When you enable the OSPF stub router advertisement feature using the max-metric router-lsa command, you can, for example, integrate a new router into a routing domain and instruct it not to participate in routing IP packets immediately or before a particular timer expires.
OSPF stub routing can be implemented in three scenarios:
- Adding a router to a routing domain without instantly routing IP packets through the new router.
- Gracefully shut down or remove a router without dropping the current IP packets that are using the router as a transit node.
- Gracefully reload a router without disrupting the current IP traffic that is using the router as a transit router.
In all scenarios, the router originates all non-stub links in its router LSA with a maximum metric (LSInfinity: 0xFFFF or 65535). A non-stub link is an interface over which the router has at least one OSPF neighbor relationship.
A stub link is an interface that is advertised into OSPF but does not participate in any OSPF neighbor relationships. Basically, the router sets the metric value of the router LSA entry for a particular directly-connected stub link to the output interface cost.
OSPF stub routing can be configured to override the metric in three other OSPF LSA types: summary LSAs, Type 5 external LSAs, and Type 7 external LSAs.
If the router is configured to advertise entries in summary LSAs or external LSAs (both Type 5 and Type 7) with an infinite metric, it sets their metric value to a number between 0x000001 (1) and 0xFFFFFF ( 16777215); and the infinite metric is applied to self-originated LSAs only.
When you set the cost of a particular link to LSInfinity, routers on the network consider it unreachable, and thus they would not include it as a transit network in their SPF trees. However, you can reach devices on that link.
In other words, when each router runs the Dijkstra’s algorithm to compute its SPF tree, it would find OSPF paths, going through the stub router, to almost any destination in the routing domain have the highest cost, and so the router chooses alternate paths to the destinations in which the stub router was a transit point.
In addition, by enabling the OSPF stub router advertisement feature, current traffic would not be affected by removing or reloading the router, because the other routers would update their routing tables as soon as they receive the new updated LSA(s) from the stub router.
In summary, advertising maximum metric LSA entries will cause other OSPF routers to omit the stub router from their routing decisions, except for stub networks connected to it.
Adding a router to a routing domain without instantly routing IP packets through the new router
Consider the network above. Imagine router R2 is pre-configured and it is not yet plugged into the network. The router is configured to advertise a Type 1 OSPF default route and build up a BGP adjacency with router R3.
Router R1 would use R2 as the next-hop router to forward traffic destined to R3’s loopback0 interface, configured with IP address 10.0.130.3/24, as shown in this example.
R1# show ip route omitted output O*E1 0.0.0.0/0 [110/2] via 10.0.12.2, 00:00:26, Serial1/0 10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks C 10.0.12.0/24 is directly connected, Serial1/0 L 10.0.12.1/32 is directly connected, Serial1/0 C 10.0.16.0/24 is directly connected, FastEthernet0/0 L 10.0.16.1/32 is directly connected, FastEthernet0/0 O 10.0.24.0/24 [110/2] via 10.0.12.2, 00:00:26, Serial1/0 O E2 10.0.34.0/24 [110/20] via 10.0.12.2, 00:00:26, Serial1/0 O 10.0.45.0/24 [110/3] via 10.0.16.6, 00:02:16, FastEthernet0/0 [110/3] via 10.0.12.2, 00:00:26, Serial1/0 O 10.0.56.0/24 [110/2] via 10.0.16.6, 00:02:16, FastEthernet0/0 O IA 10.0.120.0/24 [110/2] via 10.0.12.2, 00:00:26, Serial1/0 O IA 10.0.140.4/32 [110/3] via 10.0.12.2, 00:00:26, Serial1/0
Since OSPF converges faster than BGP, router R1 would get the default route from R2 and install it in the routing table because its metric is less than the metric advertised by router R4, before R2 gets routing information about subnet 10.0.130.0/24 from R3.
In this way, IP packets sent to this subnet would get dropped when they reach R2. To avoid such a case, we would enable the OSPF stub routing advertisement on router R2 and instruct it to continue transmitting the maximum metric to R1 and R4 until the BGP table converges.
In the example below, we start pinging 10.0.130.3 right after bringing router R2 into the network.
R1# ping 10.0.130.3 repeat 1000000 Type escape sequence to abort. Sending 1000000, 100-byte ICMP Echos to 10.0.130.3, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *Mar 12 14:39:48.515: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *Mar 12 14:39:50.087: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial1/0 from LOADING to FULL, Loading Done!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!.!..!..!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!
To simulate this we re-enable its interfaces connected to routers R1, R3, and R4.
R2(config)# interface serial 1/0 R2(config-if)# no shutdown R2(config-if)# R2(config-if)# interface fastEthernet 0/0 R2(config-if)# no shutdown R2(config-if)# R2(config-if)# interface fastEthernet 0/1 R2(config-if)# no shutdown
Before R1 gets the OSPF default route from router R2, R1 pings 10.0.130.3 successfully. However, once R1 starts forwarding ICMP echo requests through R2, some ICMP echo requests failed until a moment when BGP converges on router R2.
To circumvent this issue, we can enable OSPF stub routing on router R2 using the max-metric router-lsa command, wait until BGP converges, and then remove the command.
Gracefully Shut Down or Remove a Router Without Dropping The current IP Packets That Are Using The Router as a Transit Node
In this section, we assume that all the routers in the network diagram are up and running. First, we instruct R1 to ping 10.0.24.4 and repeat this 100000 times. Meanwhile, we disable R2’s serial 1/0 interface.
R2(config)# interface serial 1/0
R2(config-if)# shutdown
As you can see in the following example, because the underlying Layer 2 protocol allows it, router R1 quickly detected the failure of the link to router R2 and then started forwarding ICMP echo requests through an alternate path, router R5. However, some of these requests failed while OSPF converges on R1.
R1# ping 10.0.24.4 repeat 100000 Type escape sequence to abort. Sending 100000, 100-byte ICMP Echos to 10.0.24.4, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.. *Mar 12 15:16:22.331: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down *Mar 12 15:16:22.339: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial1/0 from FULL to DOWN, Neighbor Down: Interface down or detached .!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ICMP traffic gets interrupted for six seconds because the timeout is 2 seconds and three ICMP echo requests get timed out.
Before continuing, we re-enable R2’s Serial 1/0 interface.
R2(config)# interface serial 1/0
R2(config-if)# no shutdown
Now let’s ping 10000 times 10.0.56.5 from router R1. Meanwhile, we shut down the Gigabit Ethernet 0/1 switch port connected to R6.
SW1(config)# interface gigabitEthernet 0/1
SW1(config-if)# shutdown
As shown in the following example, since 20 ICMP requests failed and the timeout is 2 seconds, it takes router R1 40 seconds, the OSPF dead interval, to detect the new change and select a new path to the IP address in question.
R1# ping 10.0.56.5 repeat 10000
Type escape sequence to abort.
Sending 10000, 100-byte ICMP Echos to 10.0.56.5, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!....................
*Mar 12 16:36:50.750: %OSPF-5-ADJCHG: Process 1, Nbr 6.6.6.6 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Router R1 cannot detect the change we’ve made because it cannot detect the inaccessibility to the switch port associated with R6’s GigabitEthernet0/1 interface. In fact, R1 can detect only the failure of the switch port it is connected to.
As a result, it continues to send ICMP echo requests to router R6 until the OSPF neighbor relationship with R6 is declared dead.
At this point, we re-enable switch port G0/1.
SW1(config)# interface gigabitEthernet 0/1
SW1(config-if)# no shutdown
In this example, we ping 10.0.24.4 from R1, enable OSPF stub router advertisement on R2, and then disable R2’s Serial 1/0 interface.
Router R1
R1# ping 10.0.24.4 repeat 10000 Type escape sequence to abort. Sending 10000, 100-byte ICMP Echos to 10.0.24.4, timeout is 2 seconds: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *Mar 12 16:49:45.738: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down *Mar 12 16:49:45.750: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial1/0 from FULL to DOWN, Neighbor Down: Interface down or detached!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Router R2
R2(config)# router ospf 1 R2(config-router)# max-metric router-lsa R2(config-router)# exit R2(config)# R2(config)# interface serial 1/0 R2(config-if)# shutdown
Note that all ICMP echo requests did not get failed.
Before continuing, we remove the configuration made to R2.
R2(config)# router ospf 1 R2(config-router)# no max-metric router-lsa R2(config-router)# exit R2(config)# R2(config)# interface serial 1/0 R2(config-if)# no shutdown
Similarly, we ping 10.0.56.5, enable OSPF stub router advertisement on R6, and then disable switch port GigabitEthernet 0/1.
Router R1
R1# ping 10.0.56.5 repeat 10000
Type escape sequence to abort.
Sending 10000, 100-byte ICMP Echos to 10.0.56.5, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!
*Mar 12 17:58:00.814: %OSPF-5-ADJCHG: Process 1, Nbr 6.6.6.6 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Router R6
R6(config)# router ospf 1
R6(config-router)# max-metric router-lsa
Switch SW1
SW1(config)# interface gigabitEthernet 0/1
SW1(config-if)# shutdown
Another time, OSPF stub routing helps exclude R6 from being a transit router to traffic sourced from R1 and destined to subnet 10.0.56.0/24 while not dropping any IP packets, as illustrated in the previous example.
Overall, configuring routers R6 and R1 to advertise their non-stub interfaces with the infinite metric enables the other OSPF routers to compute new paths for the destinations that R1 and R6 are transit nodes on their associated OSPF paths before the stub routers become unreachable, thereby redirecting IP packets that were routed to R1 and R6 to new next-hop routers.
At this point, we remove the changes made to R6 and SW1.
Router R6
R6(config)# router ospf 1
R6(config-router)# max-metric router-lsa
Switch SW1
SW1(config)# interface gigabitEthernet 0/1
SW1(config-if)# shutdown
Gracefully reload a router without disrupting the current IP traffic that is using the router as a transit router
According to the outputs of the show ip route command, R5 uses the default route, advertised by R4, to forward traffic to subnet 10.0.130.0/24.
R5# show ip route 10.0.130.3
% Subnet not in table
R5# show ip route omitted output Gateway of last resort is 10.0.45.4 to network 0.0.0.0 O*E1 0.0.0.0/0 [110/2] via 10.0.45.4, 06:29:44, GigabitEthernet0/1 10.0.0.0/8 is variably subnetted, 10 subnets, 2 masks O 10.0.12.0/24 [110/3] via 10.0.56.6, 00:00:23, GigabitEthernet0/0 O 10.0.16.0/24 [110/2] via 10.0.56.6, 00:20:33, GigabitEthernet0/0 O 10.0.24.0/24 [110/2] via 10.0.45.4, 03:32:19, GigabitEthernet0/1 O E2 10.0.34.0/24 [110/20] via 10.0.45.4, 06:29:44, GigabitEthernet0/1 C 10.0.45.0/24 is directly connected, GigabitEthernet0/1 L 10.0.45.5/32 is directly connected, GigabitEthernet0/1 C 10.0.56.0/24 is directly connected, GigabitEthernet0/0 L 10.0.56.5/32 is directly connected, GigabitEthernet0/0 O IA 10.0.120.0/24 [110/3] via 10.0.45.4, 03:22:03, GigabitEthernet0/1 O IA 10.0.140.4/32 [110/2] via 10.0.45.4, 06:29:44, GigabitEthernet0/1
Imagine a user connected to router R5 and trying to download a huge file stored on router R3. If we reload router R4, the downloading operation will get interrupted temporarily or fail.
When router R4 finishes restarting, it would be chosen again by router R5 to route traffic to subnet 10.0.130.0/24 while R4’s BGP table does not converge yet on router R4.
If router R4 receives IP packets destined to subnet 10.0.130.0/24 while it is generating the BGP routing table, the router would ignore those IP packets.
Since there is an alternate path the IP packets in question can take to reach their destination, we can instruct router R4 to advertise its interfaces connected to routers R2 and R5 with an infinite or maximum metric before reloading and continues advertising those interfaces with that same metric until BGP converges after it starts up again.
Therefore, R5 would select the path that passes through router R6 to forward traffic to subnet 10.0.130.0/24 while the path via router R4 is not accessible yet.
OSPF Stub Router Advertisement Configuration and Verification with Examples on Cisco IOS
Basically, the max-metric router-lsa command allows you to configure an OSPF-enabled router to advertise non-stub entries in its self-generated router LSA with a maximum OSPF metric (65535) to all neighbors.
In this way, OSPF paths that pass through those links are less preferable in comparison to other paths to the same destination, and thus routers in the routing domain would not route IP packets toward the OSPF stub router, except for reaching its stub links.
Overall, you can issue the max-metric router-lsa command in order to accomplish each individual task of the following, a couple of them, or all of them combined:
- Advertising interfaces connected to neighbors with a maximum metric, i.e. 65535.
- Advertising non-stub interfaces with a maximum metric at the router start-up for a particular period of time or until BGP converges.
- Advertising stub and non-stub interfaces with a maximum metric.
- Advertising non-stub interfaces and links in summary LSAs with maximum metrics.
- Advertising non-stub interfaces and links in Type 5 and Type 7 LSAs with maximum metrics.
Note that the default maximum metric value depends on the type of LSA the command is applied to. For example, the default maximum metric for router LSA entries is 65535, while it is equal to 16711680 for summary and external LSA entries, including Type 5 and Type 7 LSA entries.
Besides, the max-metric router-lsa command does not apply to OSPF LSA types other than LSAs Type 1, 3, 5, and 7.
YOU CANNOT SET THE METRIC OF AN ENTRY OF A PARTICULAR LSA TYPE TO INFINITY WITHOUT ADVERTISING THE METRIC OF THE ROUTER’S NON-STUB LINKS WITH A MAXIMUM METRIC.
Advertising Interfaces Connected to Neighbors (Non-Stub Links) With a Maximum Metric
To override the current OSPF cost, in the self-originated router LSA, of the interfaces connecting a router to its neighbors, use the max-metric router-lsa command in router configuration mode.
This example instructs router R2 to become an OSPF stub router, and thus all traffic going to all destinations in the network does not pass through router R2 except for its loopback interface.
R2(config)# router ospf 1 R2(config-router)# max-metric router-lsa
To verify the configuration, use the show ip ospf max-metric command, as illustrated in this example.
R2# show ip ospf max-metric OSPF Router with ID (2.2.2.2) (Process ID 1) Base Topology (MTID 0) Start time: 00:08:44.845, Time elapsed: 01:16:24.690 Originating router-LSAs with maximum metric Condition: always, State: active
You can also check the OSPF stub router advertisement feature using the show ip ospf command like in this example.
R2# show ip ospf Routing Process "ospf 1" with ID 2.2.2.2 Start time: 00:08:44.845, Time elapsed: 01:19:06.413 Supports only single TOS(TOS0) routes Supports opaque LSA Supports Link-local Signaling (LLS) Supports area transit capability Supports NSSA (compatible with RFC 3101) Supports Database Exchange Summary List Optimization (RFC 5243) Event-log enabled, Maximum number of events: 1000, Mode: cyclic It is an area border and autonomous system boundary router Redistributing External Routes from, connected, includes subnets in redistribution Originating router-LSAs with maximum metric Condition: always, State: active omitted output
Finally, note that the max-metric router-lsa command does not change the local cost of the non-stub interfaces, as shown in this example.
R2# show ip ospf interface serial 1/0
Serial1/0 is up, line protocol is up
Internet Address 10.0.12.2/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64
Topology-MTID Cost Disabled Shutdown Topology Name
0 64 no no Base
Transmit Delay is 1 sec, State POINT_TO_POINT
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
omitted output
Advertising Non-Stub Links With a Maximum Metric at The Router Start-up for a Specific Period of Time or Until BGP Converges
The max-metric router-lsa on-startup tm command allows you to advertise non-stub links with a metric of 65535 at the router start-up for a period of time equal to tm, where tm is a value between 5 seconds and 86400 seconds (24 hours).
There is no default value for tm; Cisco IOS would reject the max-metric router-lsa on-startup command if you don’t supply a value for tm.
After the tm timer expires, the router begins advertising each non-stub link with the OSPF cost of the corresponding output interface.
Additionally, the max-metric router-lsa on-startup wait-for-bgp command sets the metric of non-stub links to 65535 temporarily after reloading. In this case, once the BGP table converges or a 10 minutes timer expires, the links in question get advertised with their real OSPF costs.
In this example, we configure R1 to advertise non-stub links with a maximum metric for a time period of four minutes at startup.
R2(config)# router ospf 1 R2(config-router)# max-metric router-lsa on-startup 240
To verify our configuration, we use the show ip ospf max-metric command.
R2# show ip ospf max-metric OSPF Router with ID (2.2.2.2) (Process ID 1) Base Topology (MTID 0) Start time: 00:00:36.172, Time elapsed: 04:28:22.488 Originating router-LSAs with maximum metric Condition: on startup for 240 seconds, State: inactive Unset reason: unconfigured Unset time: 03:10:30.076, Time elapsed: 01:18:28.588
Setting The Metric of Stub and Non-Stub Interfaces to Infinity
The max-metric router-lsa include-stub command sets the metric to 65535 for all entries in the router LSA originated by the current OSPF node.
In this example, we instruct router R2 to advertise all its directly connected interfaces with a maximum metric.
R2(config)# router ospf 1
R2(config-router)# max-metric router-lsa include-stub
To verify the configuration, we can use the show ip ospf command, show ip ospf max-metric command, or show ip ospf database router self-originated command.
The show ip ospf max-metric command states that our configuration has been applied successfully.
R2# show ip ospf max-metric OSPF Router with ID (2.2.2.2) (Process ID 1) Base Topology (MTID 0) Start time: 00:00:36.172, Time elapsed: 04:41:36.224 Originating router-LSAs with maximum metric Condition: always, State: active Advertise stub links with maximum metric in router-LSAs
The show ip ospf database router self-originated command output indicates that all R2’s interfaces are advertised with the infinite matric i.e. 65535.
R2# show ip ospf database router self-originate OSPF Router with ID (2.2.2.2) (Process ID 1) Router Link States (Area 0) Exception Flag: Announcing maximum link costs for topology Base with MTID 0 LS age: 653 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 2.2.2.2 Advertising Router: 2.2.2.2 LS Seq Number: 8000001D Checksum: 0x4921 Length: 60 Area Border Router AS Boundary Router Number of Links: 3 Link connected to: a Transit Network (Link ID) Designated Router address: 10.0.24.4 (Link Data) Router Interface address: 10.0.24.2 Number of MTID metrics: 0 TOS 0 Metrics: 65535 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 1.1.1.1 (Link Data) Router Interface address: 10.0.12.2 Number of MTID metrics: 0 TOS 0 Metrics: 65535 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.0.12.0 (Link Data) Network Mask: 255.255.255.0 Number of MTID metrics: 0 TOS 0 Metrics: 65535 Router Link States (Area 2) Exception Flag: Announcing maximum link costs for topology Base with MTID 0 LS age: 653 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 2.2.2.2 Advertising Router: 2.2.2.2 LS Seq Number: 8000000B Checksum: 0xC7CB Length: 36 Area Border Router AS Boundary Router Number of Links: 1 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.0.120.0 (Link Data) Network Mask: 255.255.255.0 Number of MTID metrics: 0 TOS 0 Metrics: 65535
Setting The Metric of Non-Stub Interfaces and Summary LSA Entries to Infinite Metrics
The max-metric router-lsa summary-lsa mtrc command sets the metric of non-stub links to 65535 for all entries in the router LSA originated by the current OSPF node, and sets the metric of the entries in all summary LSAs the router produces to mtrc.
mtrc is a number between 1 and 16777215 with a default value of 16711680.
In this example, we instruct router R2 to advertise all its non-stub interfaces and summary LSA entries with maximum metrics of 65535 and 16777215, respectively.
R2(config)# router ospf 1 R2(config-router)# max-metric router-lsa summary-lsa 16777215
To verify our configuration, we can use the show ip ospf command, show ip ospf max-metric command, or show ip ospf database summary self-originated command.
The show ip ospf max-metric command indicates that our configuration has been applied successfully.
R2# show ip ospf max-metric OSPF Router with ID (2.2.2.2) (Process ID 1) Base Topology (MTID 0) Start time: 00:00:36.172, Time elapsed: 05:02:33.716 Originating router-LSAs with maximum metric Condition: always, State: active Advertise summary-LSAs with metric 16777215
Setting The Metric of Non-Stub Interfaces and Type 5/7 External LSA Entries to Infinite Metrics
The max-metric router-lsa external-lsa mtrc command sets the metric of non-stub links to 65535 for all entries in the router LSA originated by the current OSPF node, and sets the metric of the entries in all self-originated Type 5 and Type 7 LSAs (external LSAs) to mtrc.
mtrc is a number between 1 and 16777215 with a default value of 16711680.
In this example, we instruct router R4 to advertise all its non-stub interfaces and self-originated external LSAs with maximum metrics of 65535 and 16711680, respectively.
R4(config)# router ospf 1
R4(config-router)# max-metric router-lsa external-lsa
To verify the configuration, we can use the show ip ospf command, show ip ospf max-metric command, show ip ospf database external/nssa-external self-originated command.
The show ip ospf max-metric command states that our configuration has been applied successfully.
R4# show ip ospf max-metric OSPF Router with ID (4.4.4.4) (Process ID 1) Base Topology (MTID 0) Start time: 00:01:36.178, Time elapsed: 08:05:24.016 Originating router-LSAs with maximum metric Condition: always, State: active Advertise external-LSAs with metric 16711680
The show ip ospf database external self-originate command output states that the metric of entries in all self-originated Type 5 LSAs is 16711680.
R4# show ip ospf database external self-originate OSPF Router with ID (4.4.4.4) (Process ID 1) Type-5 AS External Link States Exception Flag: Announcing maximum metrics for topology Base with MTID 0 LS age: 15 Options: (No TOS-capability, DC, Upward) LS Type: AS External Link Link State ID: 0.0.0.0 (External Network Number ) Advertising Router: 4.4.4.4 LS Seq Number: 80000001 Checksum: 0x35EE Length: 36 Network Mask: /0 Metric Type: 1 (Comparable directly to link state metric) MTID: 0 Metric: 16711680 Forward Address: 0.0.0.0 External Route Tag: 1 Exception Flag: Announcing maximum metrics for topology Base with MTID 0 LS age: 15 Options: (No TOS-capability, DC, Upward) LS Type: AS External Link Link State ID: 10.0.34.0 (External Network Number ) Advertising Router: 4.4.4.4 LS Seq Number: 80000001 Checksum: 0xACCB Length: 36 Network Mask: /24 Metric Type: 2 (Larger than any link state path) MTID: 0 Metric: 16711680 Forward Address: 0.0.0.0 External Route Tag: 0
Likewise, the show ip ospf database nssa-external self-originate command output indicates that the metric of the only originated Type 7 LSA by R4 is 16711680.
R4# show ip ospf database nssa-external self-originate OSPF Router with ID (4.4.4.4) (Process ID 1) Type-7 AS External Link States (Area 4) Exception Flag: Announcing maximum metrics for topology Base with MTID 0 LS age: 65 Options: (No TOS-capability, No Type 7/5 translation, DC, Upward) LS Type: AS External Link Link State ID: 10.0.34.0 (External Network Number ) Advertising Router: 4.4.4.4 LS Seq Number: 80000001 Checksum: 0x90E5 Length: 36 Network Mask: /24 Metric Type: 2 (Larger than any link state path) MTID: 0 Metric: 16711680 Forward Address: 0.0.0.0 External Route Tag: 0
Related Lessons to OSPF Stub Router
- OSPF
- OSPF Router ID
- OSPF Null Authentication
- OSPF Plain Text Authentication
- OSPF Default Route
- Basic OSPF Configuration Lab for CCNA
- OSPF Configuration
- OSPF Passive Interface
- OSPF Virtual Link
- OSPF Stub Area
- OSPF LSA Types
- OSPF Graceful Restart
- OSPF Totally Stubby Area
- OSPF Reference Bandwidth
- OSPF Cost
- OSPF DR/BDR Election
- OSPF Hello and Dead Interval
- OSPF Metric
- OSPF MD5 Authentication
- OSPF HMAC-SHA Cryptographic Authentication
- OSPF Multi-Area
- OSPF TTL Security Check
- OSPF Graceful Shutdown
- Route Redistribution between OSPF and RIP
- OSPF Network Types
- OSPF Totally NSSA Area
- OSPF NSSA Area
- OSPF Summarization
- OSPF Route Filtering
- OSPF Type 5 LSA Filtering
- OSPF ABR Type 3 LSA Filtering
- OSPF Prefix Suppression
- OSPF Path Selection
- OSPF LSA Throttling
- OSPF SPF Throttling
- OSPF Incremental SPF
- OSPF Non-Broadcast Network Type
- OSPF Point-to-Point Network Type
- OSPF Broadcast Network Type
- OSPF Point-to-Multipoint Network Type
- OSPF vs RIP
- OSPF LSA Group Pacing
- OSPF LSA Flood Pacing
- OSPF LSA Retransmission Pacing
- Troubleshooting OSPF Neighbor Adjacency
- Troubleshooting OSPF Route Installation
- Troubleshooting OSPF Route Advertisement
- OSPF Stub Router
Conclusion
I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.