01-22 Common OSPF Operations

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

S1720, S2700, S3700, S5700, S6700, S7700, and S9700

Series Switches
Common Operation Guide 22 Common OSPF Operations

22 Common OSPF Operations

This chapter uses the Open Shortest Path First (OSPF) network shown in Figure 22-1 as an
example to describe common OSPF operations.

Figure 22-1 Basic OSPF network


Area0
10GE1/0/1
VLANIF10
192.168.0.2/24
SwitchA 10GE1/0/1 SwitchB
10GE1/0/2 10GE1/0/2
VLANIF10
VLANIF20 VLANIF30
192.168.0.1/24
192.168.1.1/24 192.168.2.1/24
10GE1/0/1 10GE1/0/1
VLANIF20 VLANIF30
192.168.1.2/24 192.168.2.2/24
SwitchC SwitchD
10GE1/0/2 10GE1/0/2
VLANIF40 VLANIF50
172.16.1.1/24 172.17.1.1/24
10GE1/0/1 10GE1/0/1
VLANIF40 VLANIF50
172.16.1.2/24 172.17.1.2/24
SwitchE 10GE1/0/2 SwitchF
Area1 VLANIF60 Area2
172.18.1.1/24

Configuring Basic OSPF Functions


The following uses the configuration of SwitchA as an example. The configurations of other
switches are similar to the configuration of SwitchA.
<SwitchA> system-view
[SwitchA] ospf 1
[SwitchA-ospf-1] area 0

Issue 17 (2018-08-17) Copyright © Huawei Technologies Co., Ltd. 111


S1720, S2700, S3700, S5700, S6700, S7700, and S9700
Series Switches
Common Operation Guide 22 Common OSPF Operations

[SwitchA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255 //Enable OSPF on


VLANIF10.
[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 //Enable OSPF on
VLANIF20.
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit

Configuring a Stub Area


A stub area is a special area where an area border router (ABR) does not flood received
autonomous system (AS) external routes, which significantly reduces the routing table size
and transmitted routing information of routers. A border area on an OSPF network is often
configured as a stub area. For example, configure Area1 as a stub area.
The following uses the configuration of SwitchA as an example. The configurations of other
switches in Area1 are similar to the configuration of SwitchA.
[SwitchA] ospf 1
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] stub
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit

Configuring an NSSA
In a not-so-stubby area (NSSA), an ABR does not flood AS external routes received from
other areas, similar to the situation in a stub area. The difference is that an ABR can import
and flood AS external routes to the entire OSPF domain. A border area connected to another
AS on an OSPF network is often configured as an NSSA. For example, configure Area2 as an
NSSA.
The following uses the configuration of SwitchB as an example. The configurations of other
switches in Area2 are similar to the configuration of SwitchB.
[SwitchB] ospf 1
[SwitchB-ospf-1] area 2
[SwitchB-ospf-1-area-0.0.0.2] nssa
[SwitchB-ospf-1-area-0.0.0.2] quit
[SwitchB-ospf-1] quit

Configuring OSPF to Import Routes


To access a device running a non-OSPF protocol, an OSPF-capable device needs to import
routes of the non-OSPF protocol into the OSPF network. For example, configure OSPF to
import direct routes of SwitchF into the OSPF network.
[SwitchF] ospf 1
[SwitchF-ospf-1] import-route direct
[SwitchF-ospf-1] quit

Setting the OSPF Interface Cost


OSPF automatically calculates the cost of an interface according to the interface bandwidth by
default. You can also manually set the OSPF interface cost. For example, set the cost of
VLANIF 20 on SwitchA to 5.
[SwitchA] interface vlanif 20
[SwitchA-Vlanif20] ospf cost 5
[SwitchA-Vlanif20] quit

Issue 17 (2018-08-17) Copyright © Huawei Technologies Co., Ltd. 112


S1720, S2700, S3700, S5700, S6700, S7700, and S9700
Series Switches
Common Operation Guide 22 Common OSPF Operations

Configuring Association Between OSPF and BFD


To accelerate OSPF convergence when the status of a link changes, you can configure
bidirectional forwarding detection (BFD) on OSPF links. After detecting a link failure, BFD
notifies OSPF of the failure, which triggers fast OSPF convergence. When the OSPF neighbor
relationship is Down, the BFD session is deleted dynamically.
For example, set up a BFD session on the OSPF link between SwitchA and SwitchB.
# Configure SwitchA.
[SwitchA] bfd
[SwitchA-bfd] quit
[SwitchA] ospf 1
[SwitchA-ospf-1] bfd all-interfaces enable
[SwitchA-ospf-1] quit

# Configure SwitchB.
[SwitchB] bfd
[SwitchB-bfd] quit
[SwitchB] ospf 1
[SwitchB-ospf-1] bfd all-interfaces enable
[SwitchB-ospf-1] quit

Configuring OSPF to Advertise Default Routes


Multiple switches for next-hop backup or traffic load balancing often reside on the area
border and AS border of an OSPF network. A default route can be configured to reduce
routing entries and improve resource usage on the OSPF network.
The advertising mode of the default route is determined by the type of the area to which the
default route is imported, as shown in Table 22-1.

Table 22-1 Default route advertising mode


Area Generated By Advertise LSA Type Floodi
Type d By ng
Area

Commo The default-route-advertise command ASBR Type5 LSA Comm


n area on area

Stub Automatically ABR Type3 LSA Stub


area area

NSSA The nssa [ default-route-advertise ] ASBR Type7 LSA NSSA


command

Totally Automatically ABR Type3 LSA NSSA


NSSA

Issue 17 (2018-08-17) Copyright © Huawei Technologies Co., Ltd. 113

You might also like