Example for Configuring OSPF NSSAs
Networking Requirements
As shown in Figure 5-33, OSPF is enabled on all Switches and the AS is divided into three areas. Switch A and Switch B function as ABRs to advertise routes between areas; Switch D functions as the ASBR to import external routes (static routes).
It is required to configure Area 1 as an NSSA and configure Switch C as an ASBR to import external routes (static routes). In addition, the routing information needs to be transmitted correctly in the AS.
Configuration Roadmap
The configuration roadmap is as follows:
- Enable OSPF on each Switch and configure basic OSPF functions.
- Configure static routes on Switch D and import them into OSPF.
- Configure Area 1 as an NSSA and check the OSPF routing information on Switch C. You need to run the nssa command on all devices in Area 1.
- Configure static routes on Switch C, import them into OSPF, and check the OSPF routing information on Switch D.
Procedure
- Configure the VLAN for each interface.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] vlan batch 10 20 [*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10 [*SwitchA-10GE1/0/1] quit [*SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 20 [*SwitchA-10GE1/0/2] quit [*SwitchA] commit
The configurations of Switch B, Switch C, Switch D, Switch E, and Switch F are similar to the configuration of Switch A, and are not provided here.
- Assign an IP address to each VLANIF interface.
[~SwitchA] interface vlanif 10 [*SwitchA-Vlanif10] ip address 192.168.0.1 24 [*SwitchA-Vlanif10] quit [*SwitchA] interface vlanif 20 [*SwitchA-Vlanif20] ip address 192.168.1.1 24 [*SwitchA-Vlanif20] quit [*SwitchA] commit
The configurations of Switch B, Switch C, Switch D, Switch E, and Switch F are similar to the configuration of Switch A, and are not provided here.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Configure Switch D to import static routes. For details, see Example for Configuring OSPF Stub Areas.
- Configure Area 1 as an NSSA.
# Configure Switch A.
[~SwitchA] ospf [*SwitchA-ospf-1] area 1 [*SwitchA-ospf-1-area-0.0.0.1] nssa default-route-advertise no-summary [*SwitchA-ospf-1-area-0.0.0.1] quit [*SwitchA-ospf-1] quit [*SwitchA] commit
# Configure Switch C.
[~SwitchC] ospf [*SwitchC-ospf-1] area 1 [*SwitchC-ospf-1-area-0.0.0.1] nssa [*SwitchC-ospf-1-area-0.0.0.1] quit [*SwitchC-ospf-1] quit [*SwitchC] commit
# Configure Switch E.
[~SwitchE] ospf [*SwitchE-ospf-1] area 1 [*SwitchE-ospf-1-area-0.0.0.1] nssa [*SwitchE-ospf-1-area-0.0.0.1] quit [*SwitchE-ospf-1] quit [*SwitchE] commit
You are advised to specify the default-route-advertise and no-summary keywords in the nssa command run on the ABR (Switch A) to reduce the entries in the routing table of devices in the NSSA. On other devices in the NSSA, you need to run only the nssa command without specifying the two keywords.
# Display the OSPF routing table on Switch C.
[~SwitchC] display ospf routing OSPF Process 1 with Router ID 10.3.3.3 Routing for Network ----------------------------------------------------------------------------- Destination Cost Type NextHop AdvRouter Area 0.0.0.0/0 2 Inter-area 192.168.1.1 10.1.1.1 0.0.0.1 172.16.1.0/24 1 Direct 172.16.1.1 10.3.3.3 0.0.0.1 192.168.1.0/24 1 Direct 192.168.1.2 10.3.3.3 0.0.0.1 Total Nets: 3 Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
- Configure static routes on Switch C and import them into OSPF.
# Import static routes on Switch C.
[~SwitchC] ip route-static 10.0.0.0 8 null 0 [*SwitchC] ospf [*SwitchC-ospf-1] import-route static [*SwitchC-ospf-1] quit [*SwitchC] commit
- Verify the configuration.
# Display the OSPF routing table on Switch D.
[~SwitchD] display ospf routing OSPF Process 1 with Router ID 10.4.4.4 Routing for Network ---------------------------------------------------------------------------- Destination Cost Type NextHop AdvRouter Area 172.16.1.0/24 4 Inter-area 192.168.2.1 10.2.2.2 0.0.0.2 172.17.1.0/24 1 Direct 172.17.1.1 10.4.4.4 0.0.0.2 192.168.0.0/24 2 Inter-area 192.168.2.1 10.2.2.2 0.0.0.2 192.168.1.0/24 3 Inter-area 192.168.2.1 10.2.2.2 0.0.0.2 192.168.2.0/24 1 Direct 192.168.2.2 10.4.4.4 0.0.0.2 Routing for ASEs ----------------------------------------------------------------------------- Destination Cost Type Tag NextHop AdvRouter 10.0.0.0/8 1 Type2 1 192.168.2.1 10.1.1.1 Total Nets: 6 Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
In the routing table on Switch D, you can find that an AS external route is imported to the NSSA.
Configuration Files
Configuration file of Switch A
# sysname SwitchA # vlan batch 10 20 # router id 10.1.1.1 # interface Vlanif10 ip address 192.168.0.1 255.255.255.0 # interface Vlanif20 ip address 192.168.1.1 255.255.255.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 20 # 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 nssa default-route-advertise no-summary # return
Configuration files of Switch B, Switch D, and Switch F are similar to the configuration file of Switch A, and are not provided here.
Configuration file of Switch C
# sysname SwitchC # vlan batch 20 40 # router id 10.3.3.3 # interface Vlanif20 ip address 192.168.1.2 255.255.255.0 # interface Vlanif40 ip address 172.16.1.1 255.255.255.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 40 # ospf 1 import-route static area 0.0.0.1 network 192.168.1.0 0.0.0.255 network 172.16.1.0 0.0.0.255 nssa # ip route-static 10.0.0.0 255.0.0.0 NULL0 # return
Configuration file of Switch E
# sysname SwitchE # vlan batch 40 # router id 10.5.5.5 # interface Vlanif40 ip address 172.16.1.2 255.255.255.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 40 # ospf 1 area 0.0.0.1 network 172.16.1.0 0.0.0.255 nssa # return