This section describes how to configure a stub area that imports static routes. Such configuration can reduce the number of LSAs advertised to this area without affecting route reachability.
On the network shown in Figure 1, all routers run OSPF, and the entire AS is divided into three areas. Device A and Device B function as ABRs to advertise inter-area routes; Device D functions as the ASBR to import external routes (static routes).
Configure Area 1 as a stub area to reduce the LSAs advertised to this area without affecting route reachability.
When configuring an OSPF stub area, note the following rules:
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
Configure a static route on Device D and import it into OSPF.
Configure Area 1 as a stub area by running the stub command on all routers in Area 1 and check the OSPF routing information on Device C.
Prevent Device A from advertising Type 3 LSAs to the stub area, and check the OSPF routing information on Device C.
To complete the configuration, you need the following data:
Device Name |
Router ID |
Process ID |
IP Address |
Device A |
1.1.1.1 |
1 |
Area 0: 192.168.0.0/24 Area 1: 192.168.1.0/24 |
Device B |
2.2.2.2 |
1 |
Area 0: 192.168.0.0/24 Area 2: 192.168.2.0/24 |
Device C |
3.3.3.3 |
1 |
Area 1: 192.168.1.0/24 and 172.16.1.0/24 |
Device D |
4.4.4.4 |
1 |
Area 2: 192.168.2.0/24 and 172.17.1.0/24 |
Device E |
5.5.5.5 |
1 |
Area 1: 172.16.1.0/24 |
Device F |
6.6.6.6 |
1 |
Area 2: 172.17.1.0/24 |
[*DeviceD] ip route-static 10.0.0.0 8 null 0 [*DeviceD] ospf 1 [*DeviceD-ospf-1] import-route static type 1 [*DeviceD-ospf-1] commit [~DeviceD-ospf-1] quit
# Display the ABR and ASBR information on Device C.
[~DeviceC] display ospf abr-asbr OSPF Process 1 with Router ID 3.3.3.3 Routing Table to ABR and ASBR Type Destination Area Cost NextHop RtType Intra-area 1.1.1.1 0.0.0.1 1 192.168.1.1 ABR Inter-area 4.4.4.4 0.0.0.1 3 192.168.1.1 ASBR
# Display the OSPF routing table of Device C.
If the area where Device C resides is a common area, external routes exist in the routing table.
[~DeviceC] display ospf routing OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 172.17.1.0/24 4 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.0.0/24 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.2.0/24 3 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 10.0.0.0/8 4 Type1 1 192.168.1.1 4.4.4.4 Total Nets: 4 Intra Area: 0 Inter Area: 3 ASE: 1 NSSA: 0
# Configure Device A.
[~DeviceA] ospf 1 [*DeviceA-ospf-1] area 1 [*DeviceA-ospf-1-area-0.0.0.1] stub [*DeviceA-ospf-1-area-0.0.0.1] commit [~DeviceA-ospf-1-area-0.0.0.1] quit
# Configure Device C.
[~DeviceC] ospf 1 [*DeviceC-ospf-1] area 1 [*DeviceC-ospf-1-area-0.0.0.1] stub [*DeviceC-ospf-1-area-0.0.0.1] commit [~DeviceC-ospf-1-area-0.0.0.1] quit
# Configure Device E.
[~DeviceE] ospf 1 [*DeviceE-ospf-1] area 1 [*DeviceE-ospf-1-area-0.0.0.1] stub [*DeviceE-ospf-1-area-0.0.0.1] commit [~DeviceE-ospf-1-area-0.0.0.1] quit
# Display the routing table on Device C.
After the area where Device C resides is configured as a stub area, a default route rather than AS external routes is displayed in the routing table.
[~DeviceC] display ospf routing OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 0.0.0.0/0 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 172.17.1.0/24 4 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.0.0/24 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.2.0/24 3 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 Total Nets: 4 Intra Area: 0 Inter Area: 4 ASE: 0 NSSA: 0
[~DeviceA] ospf [*DeviceA-ospf-1] area 1 [*DeviceA-ospf-1-area-0.0.0.1] stub no-summary [*DeviceA-ospf-1-area-0.0.0.1] commit [~DeviceA-ospf-1-area-0.0.0.1] quit
# Display the OSPF routing table on Device C.
[~DeviceC] display ospf routing OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 0.0.0.0/0 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 Total Nets: 1 Intra Area: 0 Inter Area: 1 ASE: 0 NSSA: 0
After the advertisement of summary LSAs to the stub area is disabled, the number of routing entries on the routers in the stub area further decreases, and only the default route to a destination beyond the stub area is reserved.
Device A configuration file
# sysname DeviceA # router id 1.1.1.1 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.0.1 255.255.255.0 # interface GigabitEthernet0/1/8 undo shutdown ip address 192.168.1.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.0.0 0.0.0.255 area 0.0.0.1 network 192.168.1.0 0.0.0.255 stub no-summary # return
Device B configuration file
# sysname DeviceB # router id 2.2.2.2 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.0.2 255.255.255.0 # interface GigabitEthernet0/1/8 undo shutdown ip address 192.168.2.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.0.0 0.0.0.255 area 0.0.0.2 network 192.168.2.0 0.0.0.255 # return
Device C configuration file
# sysname DeviceC # router id 3.3.3.3 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.1.2 255.255.255.0 # interface GigabitEthernet0/1/8 undo shutdown ip address 172.16.1.1 255.255.255.0 # ospf 1 area 0.0.0.1 network 192.168.1.0 0.0.0.255 network 172.16.1.0 0.0.0.255 stub # return
Device D configuration file
# sysname DeviceD # router id 4.4.4.4 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.2.2 255.255.255.0 # interface GigabitEthernet0/1/8 undo shutdown ip address 172.17.1.1 255.255.255.0 # ospf 1 import-route static type 1 area 0.0.0.2 network 192.168.2.0 0.0.0.255 network 172.17.1.0 0.0.0.255 # ip route-static 10.0.0.0 255.0.0.0 NULL0 # return
Device E configuration file
# sysname DeviceE # router id 5.5.5.5 # interface GigabitEthernet0/1/8 undo shutdown ip address 172.16.1.2 255.255.255.0 # ospf 1 area 0.0.0.1 network 172.16.1.0 0.0.0.255 stub # return
Device F configuration file
# sysname DeviceF # router id 6.6.6.6 # interface GigabitEthernet0/1/8 undo shutdown ip address 172.17.1.2 255.255.255.0 # ospf 1 area 0.0.0.2 network 172.17.1.0 0.0.0.255 # return