Network Requirements
- Configure OSPF for all devices, and divide the devices into three areas: Area 0, Area 1, and Area 2. Configure Area 1 as a totally Stub area.
- On Device4, redistribute a static route to OSPF. After the configuration is completed, the totally Stub area cannot learn inter-area routes and external routes, while the devices of other areas can learn inter-area routes and external routes.
Network Topology
![Networking for Configuring an OSPF Totally Stub Area](/storage/images/Document/Maipu/unicast-routing/config-ospf-totally-stub-area.jpg)
Figure 7-8 Networking for Configuring an OSPF Totally Stub Area
Configuration Steps
Step 1: Create VLANs, and add ports to the required VLANs. (Omitted)
Step 2: Configure IP addresses for the ports. (Omitted)
Step 3: Configure an OSPF process and let the interfaces cover the related areas.
#Configure Device1.
Configure Area 1 to a Stub area.
Device1#configure terminal
Device1(config)#router ospf 100
Device1(config-ospf)#router-id 1.1.1.1
Device1(config-ospf)#area 1 stub
Device1(config-ospf)#network 10.0.0.0 0.0.0.255 area 1
Device1(config-ospf)#network 100.0.0.0 0.0.0.255 area 1
Device1(config-ospf)#exit
|
#Configure Device2.
Configure Area 1 to a totally Stub area. Devce2 is an ABR, and the no-summary command takes effect only on an ABR.
Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#router-id 2.2.2.2
Device2(config-ospf)#area 1 stub no-summary
Device2(config-ospf)#network 10.0.0.0 0.0.0.255 area 1
Device2(config-ospf)#network 20.0.1.0 0.0.0.255 area 0
Device2(config-ospf)#exit
|
#Configure Device3.
Device3#configure terminal
Device3(config)#router ospf 100
Device3(config-ospf)#router-id 3.3.3.3
Device3(config-ospf)#network 20.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#network 30.0.0.0 0.0.0.255 area 2
Device3(config-ospf)#exit
|
#Configure Device4.
Device4#configure terminal
Device4(config)#router ospf 100
Device4(config-ospf)#router-id 4.4.4.4
Device4(config-ospf)#network 30.0.0.0 0.0.0.255 area 2
Device4(config-ospf)#network 110.0.0.0 0.0.0.255 area 2
Device4(config-ospf)#exit
|
Step 4: On Device4, configure a static route, and redistribute the route into the OSPF.
#Configure Device4.
Device4(config)#ip route 200.1.1.0 255.255.255.0 110.0.0.2
Device4(config)#router ospf 100
Device4(config-ospf)#redistribute static
Device4(config-ospf)#exit
|
Step 5: Check the result.
#Query the OSPF LSDB and routing table of Device1.
Device1#show ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 100)
Router Link States (Area 1 [Stub])
Link ID ADV Router Age Seq# CkSum Link count
1.1.1.1 1.1.1.1 19 0x80000009 0x8513 2
2.2.2.2 2.2.2.2 22 0x80000005 0x51b6 1
Net Link States (Area 1 [Stub])
Link ID ADV Router Age Seq# CkSum
10.0.0.2 2.2.2.2 22 0x80000001 0x61ba
Summary Link States (Area 1 [Stub])
Link ID ADV Router Age Seq# CkSum Route
0.0.0.0 2.2.2.2 55 0x80000002 0x73c1 0.0.0.0/0
Device1#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS
Gateway of last resort is 10.0.0.2 to network 0.0.0.0
O 0.0.0.0/0 [110/2] via 10.0.0.2, 00:00:19, vlan3
C 10.0.0.0/24 is directly connected, 00:01:04, vlan3
C 100.0.0.0/24 is directly connected, 00:11:55, vlan2
C 127.0.0.0/8 is directly connected, 30:46:57, lo0
According to the information in the OSPF database, only Area 1 has an LSA for inter-area route 0.0.0.0/0, while the other areas do not have LSAs for inter-area or external routes. The ABR in the Stub area generates an inter-area route 0.0.0.0/0, which floods in the totally Stub area. Data is forwarded to outside of the area or AS through the default route.
#Query the routing table of Device2.
Device2#show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management
D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS
Gateway of last resort is not set
C 10.0.0.0/24 is directly connected, 00:01:02, vlan2
C 20.0.0.0/24 is directly connected, 00:00:59, vlan3
O 30.0.0.0/24 [110/2] via 20.0.0.2, 00:00:17, vlan3
O 100.0.0.0/24 [110/2] via 10.0.0.1, 00:00:10, vlan2
O 110.0.0.0/24 [110/3] via 20.0.0.2, 00:00:17, vlan3
C 127.0.0.0/8 is directly connected, 56:07:04, lo0
OE 200.1.1.0/24 [150/20] via 20.0.0.2, 00:00:16, vlan3
According to the queried information, you will find that Device2 is able to learn inter-area and external routes.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
If you run the area area-id stub command but do not run the no-summary command, the device in the area can learn inter-area routes but cannot learn external routes. Access to a network outside the AS is still conducted through the default route.