area [id] stub
Configures an OSPF area as a stub area to reduce the size of the LSDB by blocking Type 5 LSAs and requiring a default route from the ABR.
Definition: area [id] stub is a Cisco IOS router config command. Configures an OSPF area as a stub area to reduce the size of the LSDB by blocking Type 5 LSAs and requiring a default route from the ABR.
Overview
The `area [id] stub` command is used in OSPF router configuration mode to configure an OSPF area as a stub area. A stub area is designed to reduce the size of the Link-State Database (LSDB) and the routing table within that area by blocking Type 5 Link-State Advertisements (LSAs), which carry external routes redistributed into OSPF from other routing protocols. Instead, the Area Border Router (ABR) injects a default route (Type 3 LSA) into the stub area, allowing routers in the stub area to reach external destinations via the ABR.
This command is critical for network scalability and stability, especially in large OSPF domains where external route information is not needed within certain areas. The concept behind stub areas is to limit the propagation of external routes, thereby reducing memory and CPU utilization on routers that do not require full external visibility. Network engineers reach for this command when designing OSPF networks with a hierarchical topology, typically in enterprise or service provider environments where areas are used to isolate routing domains.
For example, branch offices or remote sites that only need to reach the corporate network and the internet can be placed in a stub area, simplifying their routing tables. Alternatives include totally stubby areas (using `area [id] stub no-summary`) which also block Type 3 summary LSAs, or Not-So-Stubby Areas (NSSA) which allow limited external route injection. The choice depends on whether the area needs to receive inter-area routes or only a default route.
In the configuration workflow, the command is applied after enabling OSPF and defining the network statements. It is important to note that all routers in the same stub area must be configured with the `area [id] stub` command; otherwise, adjacency will not form. The command immediately affects the running configuration, and the router will generate a new Type 3 default LSA if it is an ABR.
Privileged EXEC mode (enable) is required to enter global configuration mode, and then router configuration mode. There is no buffered output; the command is executed instantly. Understanding stub areas is fundamental for CCNA and CCNP candidates as it demonstrates OSPF scalability and design principles.
area [id] stubWhen to Use This Command
- In a remote branch office with a single connection to headquarters, configure area 1 as stub to minimize routing table size and LSA flooding.
- When designing a hierarchical OSPF network, use stub areas for leaf areas that do not need external route knowledge.
- To simplify OSPF configuration in a small campus network where all inter-area traffic goes through a single ABR.
- When you want to prevent Type 5 external LSAs from entering an area, but still allow inter-area routes (Type 3).
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| id | A.B.C.D | <0-4294967295> | The OSPF area identifier. It can be specified as a decimal number (0 to 4294967295) or in dotted-decimal notation (e.g., 0.0.0.1). Common mistakes include using an area ID that does not match on all routers in the area, or using area 0 (backbone) which cannot be a stub area. |
Command Examples
Basic stub area configuration
area 1 stubRouter(config-router)# area 1 stub Router(config-router)#
The command is entered without any output confirmation. It configures area 1 as a stub area on this router. All routers in area 1 must also be configured as stub.
Verifying stub area with show ip ospf
show ip ospfRouting Process "ospf 1" with ID 192.168.1.1
Start time: 00:01:23.456, Time elapsed: 02:34:56
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
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
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 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm last executed 00:01:23.456 ago
SPF algorithm executed 5 times
Area ranges are
Number of LSA 3. Checksum Sum 0x00A1B2
The output shows 'Number of areas in this router is 1. 1 normal 0 stub 0 nssa' indicating that no stub areas are configured yet. After applying 'area 1 stub', the line would show '1 normal 1 stub 0 nssa' if area 1 is configured. The 'Number of external LSA 0' confirms no external LSAs are present.
Understanding the Output
The 'show ip ospf' command displays OSPF process information. The key line for stub verification is 'Number of areas in this router is X. X normal Y stub Z nssa'.
A stub area will increment the 'stub' count. Additionally, 'Number of external LSA' should be 0 in a stub area because Type 5 LSAs are blocked. In a properly configured stub area, you should see no external LSAs.
If external LSAs appear, the stub configuration is inconsistent across the area. The ABR will inject a default route (0.0.0.0/0) into the stub area, which can be verified with 'show ip route ospf'.
Configuration Scenarios
Configure a stub area for a branch office
A company has a headquarters (HQ) with multiple branch offices. The branch office routers only need to reach the HQ network and the internet via the HQ. To reduce routing table size and LSA flooding, the branch office area (area 1) is configured as a stub area.
Topology
HQ-Router(Gi0/0)---10.0.12.0/30---(Gi0/0)Branch-Router
Branch-Router(Gi0/1)---192.168.1.0/24---Branch-LANSteps
- 1.Step 1: Enter privileged EXEC mode: Router> enable
- 2.Step 2: Enter global configuration mode: Router# configure terminal
- 3.Step 3: Enter OSPF router configuration mode: Router(config)# router ospf 1
- 4.Step 4: Configure the network on the HQ router: Router(config-router)# network 10.0.12.0 0.0.0.3 area 0
- 5.Step 5: Configure the network on the branch router: Router(config-router)# network 10.0.12.0 0.0.0.3 area 1
- 6.Step 6: Configure the branch LAN network: Router(config-router)# network 192.168.1.0 0.0.0.255 area 1
- 7.Step 7: On the HQ router, configure area 1 as stub: Router(config-router)# area 1 stub
- 8.Step 8: On the branch router, configure area 1 as stub: Router(config-router)# area 1 stub
- 9.Step 9: Exit configuration mode: Router(config-router)# end
! HQ Router router ospf 1 network 10.0.12.0 0.0.0.3 area 0 area 1 stub ! ! Branch Router router ospf 1 network 10.0.12.0 0.0.0.3 area 1 network 192.168.1.0 0.0.0.255 area 1 area 1 stub
Verify: Use `show ip ospf interface` to verify that the interface is in a stub area. On the branch router, use `show ip route ospf` to see the default route (O*IA) pointing to the HQ router. Expected output includes an O*IA 0.0.0.0/0 via 10.0.12.1.
Watch out: Both the ABR (HQ) and the internal router (branch) must have the `area 1 stub` command. If only one is configured, OSPF adjacency will not form, and the neighbor state will remain stuck in EXSTART/EXCHANGE.
Convert an existing area to a stub area
An OSPF network currently has area 2 with full LSDB. To reduce overhead, the network administrator decides to convert area 2 to a stub area. This requires coordination to ensure all routers in area 2 are reconfigured simultaneously.
Topology
ABR-Router(Gi0/0)---10.0.23.0/30---(Gi0/0)Internal-Router
Internal-Router(Gi0/1)---172.16.0.0/16---Internal-LANSteps
- 1.Step 1: Enter privileged EXEC mode: Router> enable
- 2.Step 2: Enter global configuration mode: Router# configure terminal
- 3.Step 3: Enter OSPF router configuration mode: Router(config)# router ospf 1
- 4.Step 4: On the ABR, configure area 2 as stub: Router(config-router)# area 2 stub
- 5.Step 5: On the internal router, configure area 2 as stub: Router(config-router)# area 2 stub
- 6.Step 6: Exit configuration mode: Router(config-router)# end
- 7.Step 7: Verify OSPF neighbor relationships and routing tables.
! ABR Router router ospf 1 network 10.0.23.0 0.0.0.3 area 2 area 2 stub ! ! Internal Router router ospf 1 network 10.0.23.0 0.0.0.3 area 2 network 172.16.0.0 0.0.255.255 area 2 area 2 stub
Verify: Use `show ip ospf database` to confirm that Type 5 LSAs are absent in area 2. On the internal router, `show ip route ospf` should show a default route (O*IA) via the ABR. Also, `show ip ospf neighbor` should show FULL state.
Watch out: If the area was previously receiving external routes, those routes will be removed and replaced by the default route. Ensure that the default route provides reachability to all required external destinations. Also, all routers in the area must be configured as stub; otherwise, adjacency will fail.
Troubleshooting with This Command
When troubleshooting OSPF stub area issues, the primary symptom is that OSPF neighbors fail to form adjacency, often stuck in EXSTART or EXCHANGE state. This typically indicates a mismatch in stub area configuration between routers. Use `show ip ospf neighbor` to check the neighbor state.
If the state is not FULL, examine the OSPF interface with `show ip ospf interface [interface]` to verify that the interface is in the correct area and that the area is configured as stub. The output will show 'Area is STUB' if configured correctly. Another common issue is that the ABR does not generate a default route.
Verify with `show ip route ospf` on the internal router; if the default route is missing, check that the ABR has a route to the external world (e.g., a default route or external routes) and that the `area [id] stub` command is applied on the ABR. Use `debug ip ospf adj` to see adjacency negotiation details; look for 'Mismatched area options' which indicates a stub flag mismatch. Also, `show ip ospf database` on the ABR should show a Type 3 LSA for the default route (0.0.0.0/0) with link-state ID 0.0.0.0.
If not, the ABR may not have a default route to advertise. In some cases, the ABR may be configured as a stub router itself, which is not allowed; the backbone area (area 0) cannot be a stub. Ensure that the stub area is not area 0.
Additionally, if the area is configured as a totally stubby area (using `area [id] stub no-summary`), Type 3 LSAs are also blocked, so inter-area routes will be missing. Correlate with `show ip ospf border-routers` to verify ABR reachability. A step-by-step diagnostic flow: 1) Check neighbor states; 2) Verify area configuration on all routers; 3) Check for default route on internal routers; 4) Examine LSDB for Type 3 default LSA; 5) Use debug to capture option mismatches.
Understanding these troubleshooting steps is essential for network engineers to quickly resolve stub area issues.
CCNA Exam Tips
Remember that all routers in a stub area must be configured as stub; otherwise, neighbor adjacencies will not form.
Stub areas block Type 5 LSAs but allow Type 3 inter-area routes; NSSA allows Type 7 LSAs for external routes.
The backbone area (area 0) cannot be configured as a stub area.
Virtual links cannot be configured through a stub area.
Common Mistakes
Configuring stub on only one router in the area, causing OSPF neighbors to fail to form.
Confusing stub with totally stubby (which also blocks Type 3 LSAs except default route).
Attempting to configure area 0 as stub, which is not allowed.
area [id] stub vs show ip ospf
Although both commands relate to OSPF areas, they serve distinct roles: one configures an area as a stub to control LSA flooding, while the other displays OSPF process details. They are often compared because understanding OSPF area types requires both configuration and verification.
| Aspect | area [id] stub | show ip ospf |
|---|---|---|
| Function | Configures an area as stub | Displays OSPF process info |
| Mode | Router config (config-router) | Privileged EXEC (#) |
| Persistence | Survives reload when saved | Transient; no configuration change |
| Scope | Specific area | Global OSPF process |
| Typical Use | Optimize LSDB in stub area | Verify OSPF status, router ID, areas |
Use area [id] stub when you need to reduce LSDB size in a non-backbone area by preventing Type 5 LSAs and injecting a default route.
Use show ip ospf when you need to verify OSPF configuration, check router ID, or monitor area and LSA statistics.
Platform Notes
In IOS-XE, the `area [id] stub` command syntax and behavior are identical to classic IOS. However, IOS-XE may have additional features like OSPFv3 support for IPv6, where the command is `ipv6 router ospf [process-id]` and then `area [id] stub`. The output of `show ip ospf interface` includes the area type.
In NX-OS, the equivalent command is `area [id] stub` under `router ospf [instance-tag]` mode, but NX-OS uses a different configuration hierarchy; for example, you must first create the OSPF instance with `feature ospf` and then configure the router. NX-OS also supports the `no-summary` option. On ASA firewalls, OSPF is supported in multiple context mode, and the command is `area [id] stub` under `router ospf [process-id]`.
However, ASA does not support all OSPF features; for instance, stub areas are supported but totally stubby areas may not be. In IOS-XR, the command is `area [id] stub` under `router ospf [process-name]` but with a different configuration style; IOS-XR uses a hierarchical configuration with explicit area configuration blocks. For example: `router ospf 1 area 1 stub`.
The behavior is consistent across platforms, but the exact syntax and context may vary. Always verify the specific platform documentation. For CCNA and CCNP exams, the IOS syntax is the standard, but candidates should be aware of these differences for real-world scenarios.
Related Commands
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions