< Home

Example for Configuring an OSPF Stub Area

Stub Area Overview

A stub area is an area that does not allow an ABR to advertise received AS external routes. In a stub area, the routing table size and transmitted routing information volume of routers are greatly reduced. A stub area is often placed at the edge of an AS. To ensure the reachability of a destination outside the AS, the ABR in the stub area generates a default route and advertises it to the non-ABR routers in the stub area.

Assume that a device of Company H connects to the backbone area through a single link. The device has low performance and a small routing table. The area where the device resides needs to access other areas or network segments outside the OSPF area, and the next-hop address of routes of the device is the IP address of the next-hop core device of the link. Therefore, the area where the device resides does not need to learn a large number of OSPF external routes and can be configured as a stub area. This configuration can reduce the routing table size of the area and resource consumption of the device.

Configuration Notes

  • The backbone area cannot be configured as a stub area.
  • An ASBR cannot exist in a stub area. That is, external routes are not advertised in a stub area.
  • A virtual link cannot pass through a stub area.
  • To configure an area as a stub area, configure stub area attributes on all the routers in this area using the stub command.
  • To configure an area as a totally stub area, run the stub command on all the routers in this area, and run the stub no-summary command on the ABR in this area.
  • The stub no-summary command can only be configured on an ABR to prevent the ABR from advertising Type 3 LSAs within a stub area. After this command is configured on the ABR, the area becomes a totally stub area, the number of routing entries on routers in the area is reduced, and there are only intra-area routes and a default route advertised by the ABR.
  • For the fixed switch models and versions that support this example, see Applicable Products and Versions.

Networking Requirements

As shown in Figure 1, SwitchA, SwitchB, and SwitchC run OSPF, and the OSPF network is divided into Area 0 and Area 1. SwitchB functions as an ASBR to communicate with external networks. The OSPF routing table size on SwitchC needs to be reduced without affecting communication.

Figure 1 Networking diagram for OSPF stub area configuration

Configuration Roadmap

The configuration roadmap is as follows:

  1. Configure basic OSPF functions on each switch to implement interworking in the OSPF network.

  2. Configure a static route on SwitchB and import the route to the OSPF routing table to ensure that there is a reachable route from the OSPF network to external networks.

  3. Configure Area 1 as a stub area to reduce the OSPF routing table size on SwitchC.

  4. Prohibit the ABR (SwitchA) in Area 1 from advertising Type 3 LSAs within the stub area to configure Area 1 as a totally stub area. This configuration minimizes the OSPF routing table size on SwitchC.

Procedure

  1. Specify the VLANs to which interfaces belong.

    # Configure SwitchA. The configurations of SwitchB and SwitchC are similar.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan batch 10 20
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type trunk
    [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
    [SwitchA-GigabitEthernet0/0/1] quit
    [SwitchA] interface gigabitethernet 0/0/2
    [SwitchA-GigabitEthernet0/0/2] port link-type trunk
    [SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 20
    [SwitchA-GigabitEthernet0/0/2] quit

  2. Configure an IP address for each VLANIF interface.

    # Configure SwitchA. The configurations of Switch B and SwitchC are similar.

    [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

  3. Configure basic OSPF functions.

    # Configure SwitchA.

    [SwitchA] ospf 1 router-id 10.1.1.1
    [SwitchA-ospf-1] area 0
    [SwitchA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.0] quit
    [SwitchA-ospf-1] area 1
    [SwitchA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.1] quit
    [SwitchA-ospf-1] quit

    # Configure SwitchB.

    [SwitchB] ospf 1 router-id 10.2.2.2
    [SwitchB-ospf-1] area 0
    [SwitchB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
    [SwitchB-ospf-1-area-0.0.0.0] quit
    [SwitchB-ospf-1] quit

    # Configure SwitchC.

    [SwitchC] ospf 1 router-id 10.3.3.3
    [SwitchC-ospf-1] area 1
    [SwitchC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
    [SwitchC-ospf-1-area-0.0.0.1] quit
    [SwitchC-ospf-1] quit

  4. Configure SwitchB to import a static route.

    [SwitchB] ip route-static 10.0.0.0 8 null 0
    [SwitchB] ospf 1
    [SwitchB-ospf-1] import-route static type 1   //SwitchB functions as an ASBR and imports external routes.
    [SwitchB-ospf-1] quit

    # Check the OSPF routing table on SwitchC. The command output shows that the OSPF routing table contains an AS external route.

    [SwitchC] display ospf routing
    
         OSPF Process 1 with Router ID 10.3.3.3
                       Routing Tables
    
     Routing for Network
     Destination        Cost  Type         NextHop         AdvRouter       Area
     192.168.1.0/24     1     Transit      192.168.1.2     10.3.3.3        0.0.0.1
     192.168.0.0/24     2     Inter-area   192.168.1.1     10.1.1.1        0.0.0.1
    
     Routing for ASEs
     Destination    Cost      Type       Tag         NextHop         AdvRouter
     10.0.0.0/8    3         Type1      1           192.168.1.1     10.2.2.2
    
     Total Nets: 3
     Intra Area: 1  Inter Area: 1  ASE: 1  NSSA: 0

  5. Configure Area 1 as a stub area.

    # Configure SwitchA.

    [SwitchA] ospf 1
    [SwitchA-ospf-1] area 1
    [SwitchA-ospf-1-area-0.0.0.1] stub   //Configure Area 1 as a stub area. All the routers in Area 1 must have the stub command configured.
    [SwitchA-ospf-1-area-0.0.0.1] quit
    [SwitchA-ospf-1] quit

    # Configure SwitchC.

    [SwitchC] ospf 1
    [SwitchC-ospf-1] area 1
    [SwitchC-ospf-1-area-0.0.0.1] stub   //Configure Area 1 as a stub area. All the routers in Area 1 must have the stub command configured.
    [SwitchC-ospf-1-area-0.0.0.1] quit
    [SwitchC-ospf-1] quit

    # Check the OSPF routing table on SwitchC. The command output shows that the OSPF routing table does not contain the AS external route 10.0.0.0/8 but contains a default route to external networks.

    [SwitchC] display ospf routing
    
              OSPF Process 1 with Router ID 10.3.3.3
                       Routing Tables
    
     Routing for Network
     Destination        Cost  Type       NextHop         AdvRouter       Area
     192.168.1.0/24     1     Transit    192.168.1.2     10.3.3.3         0.0.0.1
     0.0.0.0/0          2     Inter-area 192.168.1.1     10.1.1.1         0.0.0.1
     192.168.0.0/24     2     Inter-area 192.168.1.1     10.1.1.1         0.0.0.1
    
     Total Nets: 3
     Intra Area: 1  Inter Area: 2  ASE: 0  NSSA: 0

  6. Configure Area 1 as a totally stub area.

    [SwitchA] ospf 1
    [SwitchA-ospf-1] area 1
    [SwitchA-ospf-1-area-0.0.0.1] stub no-summary   //Configure Area 1 as a totally stub area. An ABR in Area 1 must have the stub no-summary command configured, while other routers in Area 1 must have the stub command configured.
    [SwitchA-ospf-1-area-0.0.0.1] quit
    [SwitchA-ospf-1] quit

  7. Verify the configuration.

    # Check the OSPF routing table on SwitchC. The command output shows that the OSPF routing table contains only an intra-area OSPF route and a default route to external networks but does not contain the Inter-Area route 192.168.0.0/24.

    [SwitchC] display ospf routing
    
              OSPF Process 1 with Router ID 10.3.3.3
                       Routing Tables
    
     Routing for Network
     Destination        Cost  Type       NextHop         AdvRouter       Area
     192.168.1.0/24     1     Transit    192.168.1.2     10.3.3.3         0.0.0.1
     0.0.0.0/0          2     Inter-area 192.168.1.1     10.1.1.1         0.0.0.1
    
     Total Nets: 2
     Intra Area: 1  Inter Area: 1  ASE: 0  NSSA: 0

Configuration Files

  • SwitchA configuration file

    #
    sysname SwitchA
    #
    vlan batch 10 20
    #
    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 GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    interface GigabitEthernet0/0/2
     port link-type trunk
     port trunk allow-pass vlan 20
    #
    ospf 1 router-id 10.1.1.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
  • SwitchB configuration file

    #
    sysname SwitchB
    #
    vlan batch 10
    #
    interface Vlanif10
     ip address 192.168.0.2 255.255.255.0
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    ospf 1 router-id 10.2.2.2
     import-route static type 1
     area 0.0.0.0
      network 192.168.0.0 0.0.0.255
    #
    ip route-static 10.0.0.0 255.0.0.0 NULL0
    #
    return
  • SwitchC configuration file

    #
    sysname SwitchC
    #
    vlan batch 20
    #
    interface Vlanif20
     ip address 192.168.1.2 255.255.255.0
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 20
    #
    ospf 1 router-id 10.3.3.3
     area 0.0.0.1
      network 192.168.1.0 0.0.0.255
      stub
    #
    return

Applicable Products and Versions

Table 1 Applicable product models and versions

Product

Product Model

Software Version

S2700

S2720-EI

V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S3700

S3700-EI

V100R006C05

S3700-HI

V200R001C00

S5700

S5700-EI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02&C03)

S5710-EI

V200R001C00, V200R002C00, V200R003C00, V200R005(C00&C02)

S5720-EI

V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5720-SI, S5720S-SI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5720I-SI

V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5730-SI

V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5730S-EI

V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5720-LI, S5720S-LI

V200R010C00, V200R011C00, V200R011C10, V200R012(C00&C20), V200R013C00, V200R019C00, V200R019C10

S5700-HI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00SPC500&C01&C02)

S5710-HI

V200R003C00, V200R005(C00&C02&C03)

S5720-HI

V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5730-HI

V200R012C00, V200R013C00, V200R019C00, V200R019C10

S5731-H

V200R013C02, V200R019C00, V200R019C10

S5731-S, S5731S-S

V200R019C00, V200R019C10

S5731S-H

V200R019C00, V200R019C10

S5732-H

V200R019C00, V200R019C10

S5735-L, S5735S-L

V200R019C00, V200R019C10

S5735S-L-M

V200R019C00, V200R019C10

S5735-S, S5735S-S

V200R019C00, V200R019C10

S5700

S5735-S-I

V200R019C10

S6700

S6700-EI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02)

S6720-EI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720S-EI

V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720-SI, S6720S-SI

V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720-LI, S6720S-LI

V200R011C00, V200R011C10, V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6720-HI

V200R012C00, V200R013C00, V200R019C00, V200R019C10

S6730-H

V200R013C02, V200R019C00, V200R019C10

S6730S-H

V200R019C10

S6730-S, S6730S-S

V200R019C00, V200R019C10

S7700

S7703, S7706, S7712

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00, V200R013C02, V200R019C00, V200R019C10

S7703 PoE

V200R013C00, V200R019C00, V200R019C10

S7706 PoE

V200R013C00, V200R019C00, V200R019C10

S9700

S9703, S9706, S9712

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00

For details about software mappings, visit Hardware Query Tool and search for the desired product model.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >