Skip to main content
  1. Router and Switch Articles/
  2. IOS-XR/

IOS XR OSPF Stub Area Configuration (stub / totally stub)

Table of Contents

How to Configure OSPF Stub Areas on Cisco IOS XR

These are the commands for configuring OSPF stub areas and totally stubby areas on Cisco IOS XR. You specify them in the area submode under router ospf. Which LSAs a stub area blocks and the default route that is injected instead are explained in OSPF Stub and Totally Stubby Areas.

IOS XR OSPF Stub Area Configuration
router ospf [PROCESS_NAME]
 area [AREA_ID]
  stub [no-summary]
  default-cost [COST]
 !
!
Field Value
no-summary With it, the area becomes a totally stubby area (Type 3 is blocked as well). Without it, a stub area
[COST] The metric of the default route the ABR injects into the area. The default is 1

The three commands go on different routers.

Command Where to configure it
stub Every router attached to the area (both ABRs and internal routers). If even one router is missing it, the adjacency does not come up
stub no-summary Only the ABRs of the area. If the area has several ABRs, configure all of them. Internal routers keep plain stub
default-cost Only the ABRs. The value can differ per ABR and per area
On IOS XE you write area [AREA_ID] stub [no-summary] and area [AREA_ID] default-cost [COST] as single lines under router ospf. IOS XR differs in that they go inside the area submode.

Cisco IOS XR Stub Area Verification Commands

Command What it shows
show ospf The type of each area (It is a stub area / It is a stub area, no summary LSA in this area). On an ABR it also shows the cost of the default route injected into that area (generates stub default route with cost)
show ospf database The LSAs in each area. Internal routers of a stub area have no Type-5 AS External Link States, and in a totally stubby area Summary Net Link States contains only 0.0.0.0
show ospf database summary 0.0.0.0 The default route (Summary-LSA) from each ABR and its Metric
show route ospf The default route O*IA 0.0.0.0/0 on internal routers and the ABR it goes through
show ospf neighbor Whether adjacencies are FULL. They do not come up unless stub is configured consistently within the area
show running-config router ospf The configured stub type and default-cost

Verification on Real Devices

Using five routers, XR1 to XR5, area 1 was made a stub area and area 2 a totally stubby area. The ABRs are XR2 and XR3, and both connect to areas 0, 1 and 2. XR1 is an ASBR that redistributes the static route 172.16.1.0/24, which is the source of the Type 5 LSA.

Router Role Stub-related configuration
XR1 Internal router in area 0, ASBR None
XR2 ABR stub in area 1, stub no-summary in area 2
XR3 ABR stub and default-cost 50 in area 1, stub no-summary in area 2
XR4 Internal router in area 1 (stub) stub
XR5 Internal router in area 2 (totally stubby) stub (without no-summary)

Configuring the Stub Areas

XR1 OSPF Configuration
router static
 address-family ipv4 unicast
  172.16.1.0/24 Null0
 !
!
router ospf 1
 router-id 1.1.1.1
 redistribute static
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
  interface GigabitEthernet0/0/0/1
  !
 !
!
XR2 OSPF Configuration
router ospf 1
 router-id 2.2.2.2
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
 area 1
  stub
  interface GigabitEthernet0/0/0/1
  !
 !
 area 2
  stub no-summary
  interface GigabitEthernet0/0/0/2
  !
 !
!
XR3 OSPF Configuration
router ospf 1
 router-id 3.3.3.3
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
 area 1
  stub
  default-cost 50
  interface GigabitEthernet0/0/0/1
  !
 !
 area 2
  stub no-summary
  interface GigabitEthernet0/0/0/2
  !
 !
!
XR4 OSPF Configuration
router ospf 1
 router-id 4.4.4.4
 area 1
  stub
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
  interface GigabitEthernet0/0/0/1
  !
 !
!
XR5 OSPF Configuration
router ospf 1
 router-id 5.5.5.5
 area 2
  stub
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
  interface GigabitEthernet0/0/0/1
  !
 !
!

Here is the configuration being entered on XR3. show configuration commit changes last 1 after the commit confirms what was actually applied.

XR3 Stub Area Configuration Example
RP/0/RP0/CPU0:XR3#configure
Sun Sep 13 11:56:11.369 UTC
RP/0/RP0/CPU0:XR3(config)#router ospf 1
RP/0/RP0/CPU0:XR3(config-ospf)#router-id 3.3.3.3
RP/0/RP0/CPU0:XR3(config-ospf)#area 0
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface Loopback0
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#passive enable
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#exit
RP/0/RP0/CPU0:XR3(config-ospf)#area 1
RP/0/RP0/CPU0:XR3(config-ospf-ar)#stub
RP/0/RP0/CPU0:XR3(config-ospf-ar)#default-cost 50
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface GigabitEthernet0/0/0/1
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#exit
RP/0/RP0/CPU0:XR3(config-ospf)#area 2
RP/0/RP0/CPU0:XR3(config-ospf-ar)#stub no-summary
RP/0/RP0/CPU0:XR3(config-ospf-ar)#interface GigabitEthernet0/0/0/2
RP/0/RP0/CPU0:XR3(config-ospf-ar-if)#exit
RP/0/RP0/CPU0:XR3(config-ospf-ar)#commit
Sun Sep 13 11:56:13.320 UTC
RP/0/RP0/CPU0:XR3(config-ospf-ar)#end
RP/0/RP0/CPU0:XR3#show configuration commit changes last 1
Sun Sep 13 11:56:17.096 UTC
!! Building configuration...
!! IOS XR Configuration 26.1.1
router ospf 1
 router-id 3.3.3.3
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
  !
 !
 area 1
  stub
  default-cost 50
  interface GigabitEthernet0/0/0/1
  !
 !
 area 2
  stub no-summary
  interface GigabitEthernet0/0/0/2
  !
 !
!
end

Verifying the Configuration

On the ABR XR3, show ospf lists the type of each area and the cost of the default route injected into it. Area 1 shows It is a stub area with cost 50, and area 2 shows It is a stub area, no summary LSA in this area with cost 1. The Number of areas line also shows two stub areas.

XR3 show ospf
RP/0/RP0/CPU0:XR3#show ospf
Sun Sep 13 12:01:50.563 UTC

 Routing Process "ospf 1" with ID 3.3.3.3
 Role: Primary Active
 NSR (Non-stop routing) is Enabled
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 It is an area border router
 Maximum number of non self-generated LSA allowed 500000
    Current number of non self-generated LSA 28
    Threshold for warning message 75%
    Ignore-time 5 minutes, reset-time 10 minutes
    Ignore-count allowed 5, current ignore-count 0
 Maximum number of external prefixes per router 50000 (suppress-neighbor)
  Warning threshold 75%
 Maximum Exchange time 10 Hold time 5 Max Recovery count 300
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 50 msecs
 Minimum hold time between two consecutive SPFs 200 msecs
 Maximum wait time between two consecutive SPFs 5000 msecs
 Initial LSA throttle delay 50 msecs
 Minimum hold time for LSA throttle 200 msecs
 Maximum wait time for LSA throttle 5000 msecs
 Minimum LSA interval 200 msecs. Minimum LSA arrival 100 msecs
 LSA refresh interval 1800 seconds
 Flood pacing interval 33 msecs. Retransmission pacing interval 66 msecs
 Adjacency stagger enabled; initial (per area): 2, maximum: 64
    Number of neighbors forming: 0, 3 full
 Maximum number of configured interfaces 1024
 Number of external LSA 1. Checksum Sum 0x00a539
 Number of opaque AS LSA 0. Checksum Sum 00000000
 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 3. 1 normal 2 stub 0 nssa
 External flood list length 0
 SNMP trap is enabled
 LSD not connected, revision 0
 Segment Routing Global Block default (16000-23999), not allocated
 Segment Routing Local Block, unknown
 Segment Routing prefix-sid-map, Advertise local: Disabled, Receive remote: Disabled
 Strict-SPF capability is enabled
    Area BACKBONE(0)
	Number of interfaces in this area is 2
	SPF algorithm executed 3 times
	Number of LSA 17.  Checksum Sum 0x0ad84b
	Number of opaque link LSA 0.  Checksum Sum 00000000
	Number of DCbitless LSA 0
	Number of indication LSA 0
	Number of DoNotAge LSA 0
	Flood list length 0
	Number of LFA enabled interfaces 0, LFA revision 0
	Number of Per Prefix LFA enabled interfaces 0
	Number of neighbors forming in staggered mode 0, 1 full
    Area 1
	Number of interfaces in this area is 1
	It is a stub area
	  generates stub default route with cost 50
	SPF algorithm executed 6 times
	Number of LSA 23.  Checksum Sum 0x0a699e
	Number of opaque link LSA 0.  Checksum Sum 00000000
	Number of DCbitless LSA 0
	Number of indication LSA 0
	Number of DoNotAge LSA 0
	Flood list length 0
	Number of LFA enabled interfaces 0, LFA revision 0
	Number of Per Prefix LFA enabled interfaces 0
	Number of neighbors forming in staggered mode 0, 1 full
    Area 2
	Number of interfaces in this area is 1
	It is a stub area, no summary LSA in this area
	  generates stub default route with cost 1
	SPF algorithm executed 5 times
	Number of LSA 7.  Checksum Sum 0x02cdf9
	Number of opaque link LSA 0.  Checksum Sum 00000000
	Number of DCbitless LSA 0
	Number of indication LSA 0
	Number of DoNotAge LSA 0
	Flood list length 0
	Number of LFA enabled interfaces 0, LFA revision 0
	Number of Per Prefix LFA enabled interfaces 0
	Number of neighbors forming in staggered mode 0, 1 full

Type 5 (AS External-LSA) is present on XR1 to XR3, which connect to area 0, but not on XR4, the internal router of the stub area, or on XR5, the internal router of the totally stubby area.

XR1 show ospf database external
RP/0/RP0/CPU0:XR1#show ospf database external
Sun Sep 13 12:00:38.593 UTC


            OSPF Router with ID (1.1.1.1) (Process ID 1)

		Type-5 AS External Link States

  LS age: 283
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 172.16.1.0 (External Network Number)
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x39a5
  Length: 36
  Network Mask: /24
	Metric Type: 2 (Larger than any link state path)
	TOS: 0 
	Metric: 20 
	Forward Address: 0.0.0.0
	External Route Tag: 0
XR4 show ospf database external
RP/0/RP0/CPU0:XR4#show ospf database external
Sun Sep 13 12:02:42.253 UTC


            OSPF Router with ID (4.4.4.4) (Process ID 1)
XR5 show ospf database external
RP/0/RP0/CPU0:XR5#show ospf database external
Sun Sep 13 12:03:26.438 UTC


            OSPF Router with ID (5.5.5.5) (Process ID 1)

Compare show ospf database on the internal routers. XR4 (stub) has the inter-area routes and the default route 0.0.0.0 under Summary Net Link States. On XR5 (totally stubby), Summary Net Link States holds only the two 0.0.0.0 entries from the two ABRs.

XR4 show ospf database
RP/0/RP0/CPU0:XR4#show ospf database
Sun Sep 13 12:02:36.705 UTC


            OSPF Router with ID (4.4.4.4) (Process ID 1)

		Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         331         0x80000002 0x00eb11 1
3.3.3.3         3.3.3.3         331         0x80000002 0x00c130 1
4.4.4.4         4.4.4.4         330         0x80000002 0x008c04 3

		Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
10.2.4.4        4.4.4.4         330         0x80000001 0x00639c
10.3.4.4        4.4.4.4         330         0x80000001 0x007981

		Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         2.2.2.2         391         0x80000001 0x0075c0
0.0.0.0         3.3.3.3         381         0x80000001 0x0043bd
1.1.1.1         2.2.2.2         351         0x80000001 0x0051df
1.1.1.1         3.3.3.3         341         0x80000001 0x0033f9
2.2.2.2         2.2.2.2         391         0x80000001 0x001915
2.2.2.2         3.3.3.3         341         0x80000001 0x000f19
3.3.3.3         2.2.2.2         336         0x80000001 0x00fe29
3.3.3.3         3.3.3.3         381         0x80000001 0x00cc59
5.5.5.5         2.2.2.2         320         0x80000001 0x009888
5.5.5.5         3.3.3.3         320         0x80000001 0x007aa2
10.1.2.0        2.2.2.2         391         0x80000001 0x00d058
10.1.2.0        3.3.3.3         341         0x80000001 0x00bc67
10.1.3.0        2.2.2.2         351         0x80000001 0x00cf57
10.1.3.0        3.3.3.3         381         0x80000001 0x00a77c
10.2.5.0        2.2.2.2         391         0x80000001 0x00a381
10.2.5.0        3.3.3.3         320         0x80000002 0x008d91
10.3.5.0        2.2.2.2         320         0x80000002 0x009f82
10.3.5.0        3.3.3.3         381         0x80000001 0x0079a6
XR5 show ospf database
RP/0/RP0/CPU0:XR5#show ospf database
Sun Sep 13 12:03:21.137 UTC


            OSPF Router with ID (5.5.5.5) (Process ID 1)

		Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         365         0x80000002 0x00ed0f 1
3.3.3.3         3.3.3.3         365         0x80000002 0x00e10d 1
5.5.5.5         5.5.5.5         364         0x80000002 0x000d72 3

		Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum
10.2.5.2        2.2.2.2         365         0x80000001 0x00da2a
10.3.5.5        5.5.5.5         364         0x80000001 0x007878

		Summary Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         2.2.2.2         436         0x80000001 0x0075c0
0.0.0.0         3.3.3.3         425         0x80000001 0x0057da

show ospf database summary 0.0.0.0 on XR4 shows the metric of the default route from each ABR. The one from XR3 (3.3.3.3), where default-cost 50 is configured, has Metric 50, and the one from XR2 (2.2.2.2), left at the default, has Metric 1.

XR4 show ospf database summary 0.0.0.0
RP/0/RP0/CPU0:XR4#show ospf database summary 0.0.0.0
Sun Sep 13 12:02:41.395 UTC


            OSPF Router with ID (4.4.4.4) (Process ID 1)

		Summary Net Link States (Area 1)

  Routing Bit Set on this LSA
  LS age: 395
  Options: (No TOS-capability, DC)
  LS Type: Summary Links (Network)
  Link State ID: 0.0.0.0 (Summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x75c0
  Length: 28
  Network Mask: /0
	TOS: 0 	Metric: 1 

  LS age: 385
  Options: (No TOS-capability, DC)
  LS Type: Summary Links (Network)
  Link State ID: 0.0.0.0 (Summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x43bd
  Length: 28
  Network Mask: /0
	TOS: 0 	Metric: 50 

In the routing table, XR4 has a single default route through XR2, which has the lower metric. On XR5 the two ABRs have the same cost, so the default route has two paths (ECMP), and it is XR5’s only OSPF route.

XR4 show route ospf
RP/0/RP0/CPU0:XR4#show route ospf
Sun Sep 13 12:02:31.547 UTC

O*IA 0.0.0.0/0 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 1.1.1.1/32 [110/3] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
                [110/3] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
O IA 2.2.2.2/32 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 3.3.3.3/32 [110/2] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
O IA 5.5.5.5/32 [110/3] via 10.2.4.2, 00:05:14, GigabitEthernet0/0/0/0
                [110/3] via 10.3.4.3, 00:05:14, GigabitEthernet0/0/0/1
O IA 10.1.2.0/24 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 10.1.3.0/24 [110/2] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
O IA 10.2.5.0/24 [110/2] via 10.2.4.2, 00:05:24, GigabitEthernet0/0/0/0
O IA 10.3.5.0/24 [110/2] via 10.3.4.3, 00:05:24, GigabitEthernet0/0/0/1
XR5 show route ospf
RP/0/RP0/CPU0:XR5#show route ospf
Sun Sep 13 12:03:16.177 UTC

O*IA 0.0.0.0/0 [110/2] via 10.2.5.2, 00:05:58, GigabitEthernet0/0/0/0
               [110/2] via 10.3.5.3, 00:05:58, GigabitEthernet0/0/0/1

Traffic to 172.16.1.0/24 (the route XR1 redistributes), which does not arrive as a Type 5 LSA, leaves through the default route. The first hop of the traceroute from XR4 is XR2 (10.2.4.2). XR1 points 172.16.1.0/24 to Null0, so there is no response from the second hop onward.

XR4 show route 172.16.1.1 / traceroute 172.16.1.1
RP/0/RP0/CPU0:XR4#show route 172.16.1.1

Sun Sep 13 12:04:50.856 UTC

Routing entry for 0.0.0.0/0
  Known via "ospf 1", distance 110, metric 2, candidate default path, type inter area
  Installed Sep 13 11:57:07.338 for 00:07:43
  Routing Descriptor Blocks
    10.2.4.2, from 2.2.2.2, via GigabitEthernet0/0/0/0
      Route metric is 2
  No advertising protos. 
RP/0/RP0/CPU0:XR4#traceroute 172.16.1.1 source 4.4.4.4 maxttl 4 timeout 1

Sun Sep 13 12:04:51.160 UTC

Type escape sequence to abort.
Tracing the route to 172.16.1.1

 1  10.2.4.2 5 msec  4 msec  5 msec 
 2   *  *  * 
 3   *  *  * 
 4   *  *  * 

The Backbone Cannot Be a Stub Area

Area 0 (the backbone) cannot be made a stub area. Configuring stub in area 0 on the ABR XR2 is rejected at commit. show configuration failed shows the rejected configuration and the error.

XR2 show configuration failed after configuring stub in area 0
RP/0/RP0/CPU0:XR2(config-ospf-ar)#show configuration failed
Sun Sep 13 12:05:32.418 UTC
!! SEMANTIC ERRORS: This configuration was rejected by 
!! the system due to semantic errors. The individual 
!! errors with each failed configuration command can be 
!! found below.


router ospf 1
 area 0
  stub
!!% 'OSPF' detected the 'warning' condition 'Error: Backbone area cannot be configured as a stub or NSSA'
 !
!
end

The rejected configuration is not applied, so the area 0 configuration stays unchanged.

Test Configuration and show Output

The following kinds of output were collected from all five routers, split per router. The test configuration is the ..._run.txt files.

File Contents
..._show.txt show version / show interface description / show route / show route ospf / show ospf / show ospf interface / show ospf interface brief / show ospf neighbor / show ospf neighbor detail / show ospf database / show ospf database router / show ospf database network / show ospf statistics interface / show ospf database summary / show ospf database summary 0.0.0.0 / show ospf database external / show ospf routes / show router-id / show running-config router ospf
..._log.txt show logging, taken by inserting a marker with logmsg just before entering the configuration and passing its timestamp to show logging start
..._run.txt show running-config (that is, the test configuration)
..._trace.txt show ospf trace events
..._ping.txt ping / traceroute (from XR1–XR3 to the Loopback0 of XR4 and XR5, and from XR4 and XR5 to the Loopback0 of XR1)
..._commit.cfg What was committed when the configuration was entered (show configuration commit changes last 1)
Router show output syslog running-config trace ping commit
XR1 show log run trace ping commit
XR2 show log run trace ping commit
XR3 show log run trace ping commit
XR4 show log run trace ping commit
XR5 show log run trace ping commit

The traceroute to 172.16.1.1 over the default route is in XR4 / XR5, and the rejected configuration from configuring stub in area 0 on XR2 is here.

Related Articles

For how stub areas work, see OSPF Stub and Totally Stubby Areas; for NSSA, see OSPF NSSA and Totally NSSA; for basic OSPF configuration, see IOS XR OSPF Basic Configuration.