0% found this document useful (0 votes)
5 views171 pages

01-05 OSPF Configuration

The document provides a comprehensive guide on configuring OSPF (Open Shortest Path First) for Huawei AR Series Access Routers, detailing its functions, packet types, LSA types, and area types. It covers essential tasks such as establishing neighbor relationships, configuring routing attributes, and ensuring network stability and security. The guide also includes troubleshooting tips and examples for effective OSPF implementation in large networks.

Uploaded by

Choubane Lamine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views171 pages

01-05 OSPF Configuration

The document provides a comprehensive guide on configuring OSPF (Open Shortest Path First) for Huawei AR Series Access Routers, detailing its functions, packet types, LSA types, and area types. It covers essential tasks such as establishing neighbor relationships, configuring routing attributes, and ensuring network stability and security. The guide also includes troubleshooting tips and examples for effective OSPF implementation in large networks.

Uploaded by

Choubane Lamine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 171

Huawei AR Series Access Routers

CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5 OSPF Configuration

About This Chapter

You can build an OSPF network to discover and calculate routes in an


Autonomous System (AS). OSPF applies to large networks composed of several
hundreds of devices.

5.1 Overview of OSPF


5.2 Understanding OSPF
5.3 Application Scenarios for OSPF
5.4 Summary of OSPF Configuration Tasks
5.5 Licensing Requirements and Limitations for OSPF
5.6 Default Settings for OSPF
5.7 Configuring Basic OSPF Functions
Before building OSPF networks, you need to configure basic OSPF functions.
5.8 Setting Session Parameters for OSPF Neighbor Relationships
On an OSPF network, all routing information is transmitted and exchanged
between neighboring or adjacent devices. Maintaining neighbor relationships or
adjacencies helps improve stability on the entire network.
5.9 Configuring OSPF Attributes in Different Types of Networks
By setting network types for OSPF interfaces and adjusting OSPF attributes, you
can flexibly build OSPF networks.
5.10 Configuring OSPF Stub Areas
By configuring non-backbone areas at the edge of ASs as stub areas, you can
reduce the size of the routing table and number of LSAs to be transmitted.
5.11 Configuring OSPF NSSA
Configuring a non-backbone area on the border of an autonomous system (AS) as
a not-so-stubby area (NSSA) can reduce entries in the routing table and the
amount of routing information to be transmitted.
5.12 Adjusting OSPF Route Selection

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 137


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.13 Controlling OSPF Routing Information


5.14 Configuring OSPF IP FRR
In the case of a link fault, a device enabled with OSPF IP FRR can fast switch
traffic to the backup link. This protects traffic and greatly improves the reliability
of OSPF networks.
5.15 Configuring BFD for OSPF
If requirements for data transmission are high, and OSPF convergence speed needs
to be improved when the link status changes, you can configure BFD on OSPF
links. After detecting a link failure, BFD notifies the routing protocol of the failure,
which triggers fast convergence. When the neighbor relationship becomes Down,
the BFD session is deleted dynamically.
5.16 Configuring OSPF Fast Convergence
5.17 Configuring OSPF GR
Configuring OSPF GR to avoid traffic interruption and route flapping caused by
the active/standby switchover.
5.18 Improving the Stability of an OSPF Network
Stable OSPF networks decrease route flapping frequency, ensure normal device
operation, and improve network performance.
5.19 Improving the Security of an OSPF Network
On a network demanding high security, you can configure OSPF authentication
and the GTSM to improve the security of the OSPF network.
5.20 Configuring the Network Management Function of OSPF
OSPF supports the network management function. You can bind the OSPF MIB to
a certain OSPF process, and configure the trap function and log function.
5.21 Configuring OSPF Neighbor Relationship Flapping Suppression
OSPF neighbor relationship flapping suppression works by delaying OSPF neighbor
relationship reestablishment or setting the link cost to the maximum value.
5.22 Disabling Master/Slave Board Switching Triggered by Abnormal OSPF LSA
Aging
By default, master/slave board switching triggered by abnormal OSPF LSA aging is
enabled. To disable this function, perform this task.
5.23 Maintaining OSPF
Maintaining OSPF involves resetting OSPF and clearing OSPF statistics.
5.24 Configuration Examples for OSPF
5.25 Troubleshooting OSPF
5.26 FAQ About OSPF

5.1 Overview of OSPF

Definition
The Open Shortest Path First (OSPF) protocol is a link-state Interior Gateway
Protocol (IGP) developed by the Internet Engineering Task Force (IETF).

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 138


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

OSPF Version 2, as defined in RFC 2328, is designed for IPv4. OSPF Version 3, as
defined in RFC 2740, is designed for IPv6. Unless otherwise stated, OSPF stated in
this document refers to OSPF Version 2.

Purpose
Before the introduction of OSPF, the Routing Information Protocol (RIP) was the
most widely used IGP.

RIP is distance-vector routing protocol and has the problems of slow convergence,
routing loops, and poor scalability. Therefore, OSPF now becomes the most widely
accepted and used IGP.

OSPF is a link-state routing protocol resolving the problems faced by RIP and
featuring:

● Multicast packet transmission, reducing the load on the switches not running
OSPF
● Classless Interdomain Routing (CIDR)
● Load balancing among equal-cost routes
● Packet authentication

5.2 Understanding OSPF

5.2.1 OSPF Fundamentals

OSPF has the following functions:

● Divides an Autonomous System (AS) into one or multiple logical areas.


● Advertises routes by sending Link State Advertisements (LSAs).
● Exchanges OSPF packets between devices in an OSPF area to synchronize
routing information.
● Encapsulates OSPF packets into IP packets and sends the packets in unicast or
multicast mode.

Packet Types

Table 5-1 Packet types

Packet Type Function

Hello packet Sent periodically to discover and maintain


OSPF neighbor relationships.

Database Description (DD) Contains brief information about the local link-
packet state database (LSDB) and synchronizes the
LSDBs on two devices.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 139


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Packet Type Function

Link State Request (LSR) Requests the required LSAs from neighbors.
packet LSR packets are sent only after DD packets are
exchanged successfully.

Link State Update (LSU) Sends the required LSAs to neighbors.


packet

Link State Acknowledgement Acknowledges the receipt of an LSA.


(LSAck) packet

LSA Types

Table 5-2 LSA types


LSA Type Function

Router-LSA (Type 1) Describes the link status and link cost of a router. It
is generated by every router and advertised in the
area to which the router belongs.

Network-LSA (Type 2) Describes the link status of all routers on the local
network segment. Network-LSAs are generated by a
designated router (DR) and advertised in the area to
which the DR belongs.

Network-summary-LSA Describes routes to a specific network segment in an


(Type 3) area. Network-summary-LSAs are generated by an
Area Border Router (ABR) and advertised in all areas
except totally stub areas and Not-So-Stubby Areas
(NSSAs). For example, an ABR belongs to both Area
0 and Area 1. Area 0 has a network segment
10.1.1.0, and Area 1 has a network segment 11.1.1.0.
The Type 3 LSA of the network segment 11.1.1.0
generated by the ABR for Area 0 and the Type 3 LSA
of the network segment 10.1.1.0 generated by the
ABR for Area 1 are advertised within the non-totally
stub area or NSSA.

ASBR-summary-LSA Describes routes to an Autonomous System


(Type 4) Boundary Router (ASBR). ASBR-summary-LSAs are
generated by an ABR and advertised to all related
areas except the area to which the ASBR belongs.

AS-external-LSA (Type Describes routes to a destination outside the AS. AS-


5) external-LSAs are generated by an ASBR and
advertised to all areas except stub areas and NSSAs.

NSSA-LSA (Type 7) Describes routes to a destination outside the AS.


Generated by an ASBR and advertised in NSSAs only.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 140


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

LSA Type Function

Opaque-LSA (Type 9/ Provides a universal mechanism for OSPF extension.


Type 10/Type 11) ● Type 9 LSAs are advertised only on the network
segment where the interface originating Type 9
LSAs resides. Grace LSAs used to support GR are a
type of Type 9 LSAs.
● Type 10 LSAs are advertised inside an OSPF area.
LSAs used to support TE are a type of Type 10
LSAs.
● Type 11 LSAs are advertised within an AS. At
present, there are no applications of Type 11 LSAs.

Support of LSAs in Areas

Table 5-3 Support of LSAs in areas

Area Type Router Netwo Netwo ASBR- AS- NSSA-


-LSA rk-LSA rk- summa extern LSA
(Type (Type summ ry-LSA al-LSA (Type
1) 2) ary- (Type (Type 7)
LSA 4) 5)
(Type
3)

Common area Suppor Suppor Suppor Suppor Support Not


(including standard ted ted ted ted ed support
and backbone ed
areas)

Stub area Suppor Suppor Suppor Not Not Not


ted ted ted support support support
ed ed ed

Totally stub area Suppor Suppor Not Not Not Not


ted ted support support support support
ed ed ed ed

NSSA Suppor Suppor Suppor Not Not Suppor


ted ted ted support support ted
ed ed

Totally NSSA Suppor Suppor Not Not Not Suppor


ted ted support support support ted
ed ed ed

Router Types
Figure 5-1 lists common router types used in OSPF.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 141


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-1 Router types


IS-IS ASBR

Area1 Area4

Internal Router Backbone Router

Area0

Area2 ABR Area3

Table 5-4 Router types

Router Type Description

Internal router All interfaces on an internal router belong to the


same OSPF area.

Area Border Router (ABR) An ABR belongs to two or more than two areas,
one of which must be the backbone area.
An ABR is used to connect the backbone area and
non-backbone areas. It can be physically or logically
connected to the backbone area.

Backbone router At least one interface on a backbone router belongs


to the backbone area.
Internal routers in Area 0 and all ABRs are
backbone routers.

AS Boundary Router An ASBR in as AS exchanges routing information


(ASBR) with devices in other ASs.
An ASBR does not necessarily reside on the border
of an AS. It can be an internal router or an ABR. An
OSPF device that imports external routing
information will become an ASBR.

Route Types
Inter-area and intra-area routes in an AS describe the AS's network structure. AS
external routes describe the routes to destinations outside an AS. OSPF classifies
the imported AS external routes into Type 1 and Type 2 external routes.

Table 5-5 lists route types in descending priority order.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 142


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Table 5-5 Route types


Route Type Description

Intra-area route Routes within an area.

Inter-area route Routes between areas.

Type 1 external route Type 1 external routes have high reliability.


Cost of a Type 1 external route = Cost of the route
from a local router to an ASBR + Cost of the route
from the ASBR to the destination of the Type 1
external route

Type 2 external route Type 2 external routes have low reliability, and
therefore OSPF considers that the cost of the route
from an ASBR to the destination of a Type 2
external route is much greater than the cost of any
internal route to the ASBR.
Cost of a Type 2 external route = Cost of the route
from the ASBR to the destination of the Type 2
external route

Area Types

Table 5-6 Area types


Area Type Function

Common area OSPF areas are common areas by default. Common areas
include standard areas and backbone areas.
● A standard area is the most common area and transmits
intra-area routes, inter-area routes, and external routes.
● A backbone area connects all the other OSPF areas. It is
usually named Area 0.

Stub area A stub area does not advertise AS external routes but
advertises only intra-area and inter-area routes.
Compared with a non-stub area, a router in a stub area
maintains fewer routing entries and transmits less routing
information.
To ensure the reachability of AS external routes, the ABR in
a stub area advertises Type 3 default routes to the entire
stub area. All AS external routes must be advertised by the
ABR.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 143


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Area Type Function

Totally stub area A totally stub area does not advertise AS external routes or
inter-area routes but advertises only intra-area routes.
Compared with a non-stub area, a router in a totally stub
area maintains fewer routing entries and transmits less
routing information.
To ensure the reachability of AS external and inter-area
routes, the ABR in a totally stub area advertises Type 3
default routes to the entire totally stub area. All AS
external and inter-area routes must be advertised by the
ABR.

NSSA An NSSA can import AS external routes. An ASBR uses Type


7 LSAs to advertise the imported AS external routes to the
entire NSSA. These Type 7 LSAs are translated into Type 5
LSAs on an ABR, and are then flooded in the entire OSPF
AS.
An NSSA has the characteristics of a stub area in an AS.
An ABR in an NSSA advertises Type 7 default routes to the
entire NSSA. All inter-area routes must be advertised by the
ABR.

Totally NSSA A totally NSSA can import AS external routes. An ASBR


uses Type 7 LSAs to advertise the imported AS external
routes to the entire NSSA. These Type 7 LSAs are translated
into Type 5 LSAs on an ABR, and are then flooded in the
entire OSPF AS.
A totally NSSA has the characteristics of a totally stub area
in an AS.
An ABR in a totally NSSA advertises Type 3 and Type 7
default routes to the entire totally NSSA. All inter-area
routes must be advertised by the ABR.

OSPF Network Types


Table 5-7 lists four OSPF network types that are classified based on link layer
protocols.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 144


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Table 5-7 OSPF network types

Network Type Description

Broadcast A network with the link layer protocol of Ethernet or


Fiber Distributed Data Interface (FDDI) is a broadcast
network by default.
On a broadcast network:
● Hello packets, LSU packets, and LSAck packets are
usually transmitted in multicast mode. 224.0.0.5 is an
IP multicast address reserved for an OSPF device.
224.0.0.6 is an IP multicast address reserved for an
OSPF DR or backup designated router (BDR).
● DD and LSR packets are transmitted in unicast mode.

Non-Broadcast A network with the link layer protocol of frame relay


Multi-Access (FR) or X.25 is an NBMA network by default.
(NBMA) On an NBMA network, protocol packets such as Hello
packets, DD packets, LSR packets, LSU packets, and
LSAck packets are sent in unicast mode.

Point-to-Multipoint No network is a P2MP network by default, no matter


(P2MP) what type of link layer protocol is used on the network.
A network can be changed to a P2MP network. The
common practice is to change a non-fully meshed
NBMA network to a P2MP network.
On a P2MP network:
● Hello packets are transmitted in multicast mode using
the multicast address 224.0.0.5.
● Other types of protocol packets, such as DD packets,
LSR packets, LSU packets, and LSAck packets are sent
in unicast mode.

Point-to-point (P2P) By default, a network where the link layer protocol is


PPP, HDLC, or LAPB is a P2P network.
On a P2P network, protocol packets such as Hello
packets, DD packets, LSR packets, LSU packets, and
LSAck packets are sent in multicast mode using the
multicast address 224.0.0.5.

DR and BDR
On broadcast or NBMA networks, any two routers need to exchange routing
information. As shown in Figure 5-2, n routers are deployed on the network. n x
(n - 1)/2 adjacencies must be established. Any route change on a router is
transmitted to other routers, which wastes bandwidth resources. OSPF resolves
this problem by defining a DR and a BDR. After a DR is elected, all routers send
routing information only to the DR. Then the DR broadcasts LSAs. routers other
than the DR and BDR are called DR others. The DR others establish only
adjacencies with the DR and BDR and not with each other. This process reduces

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 145


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

the number of adjacencies established between routers on broadcast or NBMA


networks.

Figure 5-2 Network topologies before and after a DR election

If the original DR fails, routers must reelect a DR and the routers except the new
DR must synchronize routing information to the new DR. This process is lengthy,
which may cause incorrect route calculations. A BDR is used to shorten the
process. The BDR is a backup for a DR. A BDR is elected together with a DR. The
BDR establishes adjacencies with all routers on the network segment and
exchanges routing information with them. If the DR fails, the BDR immediately
becomes a new DR. The routers need to reelect a new BDR, and this process does
not affect route calculations.
The DR priority of a router interface determines its qualification for DR and BDR
elections. The router interfaces with their DR priorities greater than 0 are eligible.
Each router adds the elected DR to a Hello packet and sends it to other routers on
the network segment. When both router interfaces on the same network segment
declare that they are DRs, the router interface with a higher DR priority is elected
as a DR. If the two router interfaces have the same DR priority, the router
interface with a larger router ID is elected as a DR.

Stub Area
Stub areas are specific areas where ABRs do not flood the received AS external
routes. In stub areas, Routers maintain fewer routing entries and less routing
information.
Configuring a stub area is optional. Not every area can be configured as a stub
area. A stub area is usually a non-backbone area with only one ABR and is located
at the AS border.
To ensure the reachability of the routes to destinations outside an AS, the ABR in
the stub area generates a default route and advertises the route to the non-ABRs
in the same stub area.
Note the following points when configuring a stub area:
● The backbone area cannot be configured as a stub area.
● Before configuring an area as a stub area, you must configure stub area
attributes on all routers in the area.
● There should be no ASBR in a stub area, meaning that AS external routes
cannot be transmitted in the stub area.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 146


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Virtual connections cannot cross a stub area.

NSSA
NSSAs are a special type of OSPF areas. There are many similarities between an
NSSA and a stub area. Both of them do not advertise the external routes received
from the other OSPF areas. The difference is that a stub area cannot import AS
external routes, whereas an NSSA can import AS external routes and advertise the
imported routes to the entire AS.
After an area is configured as an NSSA, an ABR in the NSSA generates a default
route and advertises the route to the other routers in the NSSA. This is to ensure
the reachability of the routes to the destinations outside an AS.
Note the following points when configuring an NSSA:
● The backbone area cannot be configured as an NSSA.
● Before configuring an area as an NSSA, you must configure NSSA attributes
on all routers in the area.
● Virtual connections cannot cross an NSSA.

Neighbor State Machine


To exchange routing information on an OSPF network, neighbor routers must
establish adjacencies. The differences between neighbor relationships and
adjacencies are described as follows:
● Neighbor relationship: After the local router starts, it uses an OSPF interface
to send a Hello packet to the remote router. After the remote router receives
the packet, it checks whether the parameters carried in the packet are
consistent with its own parameters. If the parameters carried in the packet are
consistent with its own parameters, the local and remote routers establish a
neighbor relationship.
● Adjacency: After the local and remote routers establish a neighbor
relationship, they exchange DD packets and LSAs to establish an adjacency.
OSPF has eight state machines: Down, Attempt, Init, 2-way, Exstart, Exchange,
Loading, and Full.
● Down: It is in the initial stage of setting up sessions between neighbors. The
state machine is Down when a router does not receive Hello packets from its
neighbor before the dead interval expires.
● Attempt: It occurs only on an NBMA network. The state machine is Attempt
when a neighbor does not reply with Hello packets before the dead interval
has expired. The local router, however, keeps sending Hello packets to the
neighbor at every poll interval.
● Init: The state machine is Init after a router receives Hello packets.
● 2-way: The state machine is 2-way when the Hello packets received by a
router contain its own router ID. The state machine will remain in the 2-way
state if no adjacency needs to be established, and will become Exstart if an
adjacency is required.
● Exstart: The state machine is Exstart when the two neighbors start to
negotiate the master/slave status and determine the sequence numbers of
DD packets.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 147


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Exchange: The state machine is Exchange when a router starts to exchange


DD packets with its neighbor after the master/slave status negotiation is
completed.
● Loading: The state machine is Loading after a router has finished exchanging
DD packets with its neighbor.
● Full: The state machine is Full when the LSA retransmission list is empty.

OSPF Packet Authentication


OSPF supports packet authentication. Only the OSPF packets that have been
authenticated can be received. If OSPF packets are not authenticated, a neighbor
relationship cannot be established.
Routers support two authentication methods:
● Area-based authentication
● Interface-based authentication
When both area-based and interface-based authentication methods are
configured, interface-based authentication takes effect.
According to the authentication modes of packets, the authentication is classified
into the following:
● Non-authentication
Authentication is not required.
● Simple authentication
The authenticated party directly adds the configured password to packets for
authentication. This imposes security threats.
● MD5 authentication
The authenticated party encrypts the configured password using a Message
Digest 5 (MD5) algorithm and adds the ciphertext password to packets for
authentication. This authentication mode improves password security. The
MD5 algorithms supported includes MD5 and HMAC-MD5.
● Keychain authentication
A keychain consists of multiple authentication keys, each of which contains an
ID and a password. Each key has the lifecycle. According to the life cycle of
the key, you can dynamically select different authentication keys from the
keychain. A keychain can dynamically select the authentication key to
enhance attack defense.
Keychain provides authentication protection for OSPF by dynamically
changing algorithms and keys to improve the security of OSPF.
● HMAC-SHA256 authentication
The HMAC-SHA256 algorithm use to encrypt a password before adding the
password to the packet, which improves password security.

OSPF Route Summarization


Route summarization means that an ABR in an area summarizes the routes with
the same prefix into one route and advertises the summarized route to the other
areas.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 148


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Route summarization between areas reduces the amount of routing information


to be transmitted, reducing the size of routing tables and improving device
performance.

Route summarization can be carried out by an ABR or an ASBR:

● Route summarization on an ABR:


When an ABR in an area advertises routing information to other areas, it
generates Type 3 LSAs by network segment. If this area contains contiguous
network segments, you can summarize these network segments into a single
summary network segment. The ABR only needs to send one summary LSA,
and will not send the LSAs that belong to the summary network segment.
● Route summarization on an ASBR:
If the local device is an ASBR and route summarization is configured, the
ASBR will summarize the imported Type 5 LSAs within the summary address
range. After an NSSA is configured, the ASBR needs to summarize the
imported Type 7 LSAs within the summary address range.
If the local device is an ASBR and ABR, the device will summarize the Type 5
LSAs that are translated from Type 7 LSAs.

OSPF Default Route


A default route is a route of which the destination address and mask are all 0s. If
a router cannot find a route in its routing table for forwarding packets, it can
forward packets using a default route. Due to hierarchical management of OSPF
routes, the priority of default Type 3 routes is higher than the priority of default
Type 5 or Type 7 routes.

OSPF default routes are usually used in the following cases:

● An ABR advertises default Type 3 Summary LSAs to instruct routers within an


area to forward packets between areas.
● An ASBR advertises default Type 5 ASE LSAs or default Type 7 NSSA LSAs to
instruct routers in an AS to forward packets to other ASs.

Principles for advertising OSPF default routes are described below:


● An OSPF router advertises an LSA that describes a default route only when an
interface on the OSPF router is connected to a network outside an area.
● If an OSPF router has advertised an LSA carrying information about a type of
default route, the OSPF router does not learn this type of default routes
advertised by other routers. This means that the OSPF router no longer
calculates routes based on the LSAs carrying information about the same type
of the default routes advertised by other routers, but stores these LSAs in its
LSDB.
● The route on which default external route advertisement depends cannot be a
route in the local OSPF AS. This means that the route cannot be the one
learned by the local OSPF process. This is because default external routes are
used to guide packet forwarding outside an AS, whereas the routes within an
AS have the next hop pointing to the devices within the AS.

Table 5-8 provides guidelines for advertising default routes in different areas.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 149


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Table 5-8 Guidelines for advertising OSPF default routes


Area Type Function

Common area By default, devices in a common OSPF area do not


automatically generate default routes, even if the common
OSPF area has default routes.
When a default route on the network is generated by
another routing process (not OSPF process), the device that
generates the default route must advertise the default
route in the entire OSPF AS. (Run a command on an ASBR
to configure the ASBR to generate a default route. After
the configuration, the ASBR generates a default Type 5 ASE
LSA and advertises the LSA to the entire OSPF AS.)

Stub area A stub area does not allow AS external routes (Type 5
LSAs) to be transmitted within the area.
All routers within the stub area must learn AS external
routes from the ABR. The ABR automatically generates a
default Summary LSA (Type 3 LSA) and advertises it to the
entire stub area. Then all routes to destinations outside an
AS can be learned from the ABR.

Totally stub area A totally stub area does not allow AS external routes (Type
5 LSAs) or inter-area routes (Type 3 LSAs) to be
transmitted within the area.
All routers within the totally stub area must learn AS
external routes and other areas' routes from the ABR. The
ABR automatically generates a default Summary LSA (Type
3 LSA) and advertises it to the entire totally stub area.
Then, all routes to destinations outside an AS and to
destinations in other areas can be learned from the ABR.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 150


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Area Type Function

NSSA An NSSA allows its ASBRs to import a small number of AS


external routes, but does not advertise ASE LSAs (Type 5
LSAs) received from other areas within the NSSA. This
means that AS external routes can be learned only from
ASBRs in the NSSA.
Devices in an NSSA do not automatically generate default
routes.
Use either of the following methods as required:
● To advertise some external routes using the ASBR in the
NSSA and advertise other external routes through other
areas, configure a default Type 7 LSA on the ABR and
advertise this LSA in the entire NSSA.
● To advertise all the external routes using the ASBR in
the NSSA, configure a default Type 7 LSA on the ASBR
and advertise this LSA in the entire NSSA.
The difference between these two configurations is
described below:
● An ABR will generate a default Type 7 LSA regardless of
whether the routing table contains the default route
0.0.0.0.
● An ASBR will generate a default Type 7 LSA only when
the routing table contains the default route 0.0.0.0.
A default route is flooded only in the local NSSA and is not
flooded in the entire OSPF AS. If routers in the local NSSA
cannot find routes to the outside of the AS, the routers can
forward packets to the outside of the AS through an ASBR.
Packets of other OSPF areas, however, cannot be sent to
the outside of the AS through this ASBR. Default Type 7
LSAs will not be translated into default Type 5 LSAs and
flooded in the entire OSPF AS.

Totally NSSA A totally NSSA does not allow AS external routes (Type 5
LSAs) or inter-area routes (Type 3 LSAs) to be transmitted
within the area.
All routers within the totally NSSA must learn AS external
routes from the ABR. The ABR automatically generates a
default Summary LSA and advertises it to the entire totally
NSSA. Then all external routes received from other areas
and inter-area routes can be advertised within the totally
NSSA.

OSPF Route Filtering


OSPF supports route filtering using routing policies. By default, OSPF does not
filter routes.
Routing policies used by OSPF include the route-policy, access-list, and prefix-list.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 151


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

OSPF route filtering can be used for:

● Importing routes
OSPF can import routes learned by other routing protocols. You can configure
routing policies to filter the imported routes to allow OSPF to import only the
routes that match specific conditions.
● Advertising imported routes
OSPF advertises the imported routes to its neighbors.
You can configure filtering rules to filter the routes to be advertised. The
filtering rules can be configured only on ASBRs.
● Learning routes
Filtering rules can be configured to allow OSPF to filter the received intra-
area, inter-area, and AS external routes.
After receiving routes, an OSPF device adds only the routes that match the
filtering rules to the local routing table, but can still advertise all routes from
the OSPF routing table.
● Learning inter-area LSAs
You can configure an ABR to filter the incoming Summary LSAs. This
configuration takes effect only on ABRs because only ABRs can advertise
Summary LSAs.

Table 5-9 Differences between inter-area LSA learning and route learning

Inter-Area LSA Route Learning


Learning

Filters incoming Filters the routes that are calculated based on LSAs,
LSAs. but does not filter LSAs. This means that all incoming
LSAs are learned.

● Advertising inter-area LSAs


You can run a command to configure an ABR to filter the outgoing Summary
LSAs. This configuration takes effect only on ABRs.

OSPF Multi-Process
OSPF supports multi-process. Multiple OSPF processes can run on the same router,
and they are independent of each other. Route exchanges between different OSPF
processes are similar to route exchanges between different routing protocols.

Each interface on the router belongs to only one OSPF process.

A typical application of OSPF multi-process is that OSPF runs between PEs and
CEs in a VPN, whereas OSPF is used as an IGP on the backbone of the VPN. Two
OSPF processes on the same PE are independent of each other.

OSPF RFC 1583 Compatibility


RFC 1583 is an earlier version of OSPFv2.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 152


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

When OSPF calculates external routes, routing loops may occur because RFC 2328
and RFC 1583 define different route selection rules. To prevent routing loops, both
communication ends must use the same route selection rules.

● After RFC 1583 compatibility is enabled, OSPF uses the route selection rules
defined in RFC 1583.
● When RFC 1583 compatibility is disabled, OSPF uses the route selection rules
defined in RFC 2328.

OSPF calculates external routes based on Type 5 LSAs. If the router enabled with
RFC 1583 compatibility receives a Type 5 LSA:
● The router selects a route to the ASBR that originates the LSA, or to the
forwarding address (FA) described in the LSA.
● The router selects external routes to the same destination.

By default, OSPF uses the route selection rules defined in RFC 1583.

5.2.2 OSPF Basics

OSPF route calculation involves the following processes:

1. Adjacency establishment
The adjacency establishment process is as follows:
a. The local and remote routers use OSPF interfaces to exchange Hello
packets to establish a neighbor relationship.
b. The local and remote routers negotiate a master/slave relationship and
exchange DD packets.
c. The local and remote routers exchange LSAs to synchronize their LSDBs.
2. Route calculation
OSPF uses the shortest path first (SPF) algorithm to calculate routes, resulting
in fast route convergence.

Adjacency Establishment
Adjacencies can be established in either of the following situations:

● Two routers have established a neighbor relationship and communicate for


the first time.
● The DR or BDR on a network segment changes.

The adjacency establishment process is different on different networks.

Adjacency establishment on a broadcast network

On a broadcast network, the DR and BDR establish adjacencies with each router
on the same network segment, but DR others establish only neighbor
relationships.

Figure 5-3 shows the adjacency establishment process on a broadcast network.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 153


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-3 Adjacency establishment on a broadcast network

The adjacency establishment process on a broadcast network is as follows:


1. Neighbor relationship establishment
a. Router A uses the multicast address 224.0.0.5 to send a Hello packet to
Router B through the OSPF interface connected to a broadcast network.
The packet carries the DR field of 1.1.1.1 (ID of Router A) and the
Neighbors Seen field of 0. A neighbor router has not been discovered,
and Router A regards itself as a DR.
b. After Router B receives the packet, it returns a Hello packet to Router A.
The returned packet carries the DR field of 2.2.2.2 (ID of Router B) and
the Neighbors Seen field of 1.1.1.1 (Router A's router ID). Router A has
been discovered but its router ID is less than that of Router B, and
therefore Router B regards itself as a DR. Then Router B's status changes
to Init.
c. After Router A receives the packet, Router A's status changes to 2-way.
NOTE
The following procedures are not performed for DR others on a broadcast network.
2. Master/Slave negotiation and DD packet exchange
a. Router A sends a DD packet to Router B. The packet carries the following
fields:

▪ Seq field: The value x indicates the sequence number is x.

▪ I field: The value 1 indicates that the packet is the first DD packet,
which is used to negotiate a master/slave relationship and does not
carry LSA summaries.

▪ M field: The value 1 indicates that the packet is not the last DD
packet.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 154


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

▪ MS field: The value 1 indicates that Router A declares itself a master.


To improve transmission efficiency, Router A and Router B determine
which LSAs in each other's LSDB need to be updated. If one party
determines that an LSA of the other party is already in its own LSDB, it
does not send an LSR packet for updating the LSA to the other party. To
achieve the preceding purpose, Router A and Router B first send DD
packets, which carry summaries of LSAs in their own LSDBs. Each
summary identifies an LSA. To ensure packet transmission reliability, a
master/slave relationship must be determined during DD packet
exchange. One party serving as a master uses the Seq field to define a
sequence number. The master increases the sequence number by one
each time it sends a DD packet. When the other party serving as a slave
sends a DD packet, it adds the sequence number carried in the last DD
packet received from the master to the Seq field of the packet.
b. After Router B receives the DD packet, Router B's status changes to
Exstart and Router B returns a DD packet to Router A. The returned
packet does not carry LSA summaries. Because Router B's router ID is
greater than Router A's router ID, Router B declares itself a master and
sets the Seq field to y.
c. After Router A receives the DD packet, it agrees that Router B is a master
and Router A's status changes to Exchange. Then Router A sends a DD
packet to Router B to transmit LSA summaries. The packet carries the Seq
field of y and the MS field of 0. The value 0 indicates that Router A
declares itself a slave.
d. After Router B receives the packet, Router B's status changes to Exchange
and Router B sends a new DD packet containing its own LSA summaries
to Router A. The value of the Seq field carried in the new DD packet is
changed to y + 1.
Router A uses the same sequence number as Router B to confirm that it has
received DD packets from Router B. Router B uses the sequence number plus
one to confirm that it has received DD packets from Router A. When Router B
sends the last DD packet, it sets the M field of the packet to 0.
3. LSDB synchronization
a. After Router A receives the last DD packet, it finds that many LSAs in
Router B's LSDB do not exist in its own LSDB, so Router A's status
changes to Loading. After Router B receives the last DD packet from
Router A, Router B's status directly changes to Full, because Router B's
LSDB already contains all LSAs of Router A.
b. Router A sends an LSR packet for updating LSAs to Router B. Router B
returns an LSU packet to Router A. After Router A receives the packet, it
sends an LSAck packet for acknowledgement.
The preceding procedures continue until the LSAs in Router A's LSDB are the
same as those in Router B's LSDB. Router A's status changes to Full. After
Router A and Router B exchange DD packets and update all LSAs, they
establish an adjacency.
Adjacency establishment on an NBMA network
The adjacency establishment process on an NBMA network is similar to that on a
broadcast network. The blue part shown in Figure 5-4 highlights the differences
from a broadcast network.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 155


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

On an NBMA network, all routers establish adjacencies only with the DR and BDR.

Figure 5-4 Adjacency establishment on an NBMA network

The adjacency establishment process on an NBMA network is as follows:


1. Neighbor relationship establishment
a. After Router B sends a Hello packet to a Down interface of Router A,
Router B's status changes to Attempt. The packet carries the DR field of
2.2.2.2 (ID of Router B) and the Neighbors Seen field of 0. A neighbor
router has not been discovered, and Router B regards itself as a DR.
b. After Router A receives the packet, Router A's status changes to Init and
Router A returns a Hello packet. The returned packet carries the DR and
Neighbors Seen fields of 2.2.2.2. Router B has been discovered but its
router ID is greater than that of Router A, and therefore Router A agrees
that Router B is a DR.
NOTE
The following procedures are not performed for DR others on an NBMA network.
2. Master/Slave relationship negotiation and DD packet exchange
The procedures for negotiating a master/slave relationship and exchanging
DD packets on an NBMA network are the same as those on a broadcast
network.
3. LSDB synchronization
The procedure for synchronizing LSDBs on an NBMA network is the same as
that on a broadcast network.
Adjacency establishment on a point-to-point (P2P)/point-to-multipoint
(P2MP) network
The process for establishing an adjacency on a P2P/P2MP network is similar to
that on a broadcast network except that no DR or BDR needs to be elected on a

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 156


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

P2P/P2MP network. DD packets are transmitted in unicast mode on P2P networks


and in unicast mode on P2MP networks.

Route Calculation
OSPF uses an LSA to describe the network topology. A Type 1 LSA describes the
attributes of a link between routers. A router transforms its LSDB into a weighted,
directed graph, which reflects the topology of the entire AS. All routers in the
same area have the same graph. Figure 5-5 shows a weighted, directed graph.

Figure 5-5 Weighted, directed graph

Based on the graph, each router uses an SPF algorithm to calculate an SPT with
itself as the root. The SPT shows routes to nodes in the AS. Figure 5-6 shows an
SPT.

Figure 5-6 SPT

When a router's LSDB changes, the router recalculates a shortest path. Frequent
SPF calculations consume a large amount of resources and affect router efficiency.
Changing the interval between SPF calculations can prevent resource consumption
caused by frequent LSDB changes. The default interval between SPF calculations is
5 seconds.

The route calculation process is as follows:

1. A router calculates intra-area routes.


The router uses an SFP algorithm to calculate shortest paths to other routers
in an area. Type 1 and Type 2 LSAs accurately describe the network topology

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 157


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

in an area. Based on the network topology described by a Type 1 LSA, the


router calculates paths to other routers in the area.
NOTE
If multiple equal-cost routes are produced during route calculation, the SPF algorithm
retains all these routes in the LSDB.
2. The router calculates inter-area routes.
The network segment of the routes in an adjacent area can be considered to
be directly connected to the ABR. Because the shortest path to the ABR has
been calculated in the preceding phase, the router can directly check a Type 3
LSA to obtain the shortest path to the network segment. The ASBR can also
be considered to be connected to the ABR. Therefore, the shortest path to the
ASBR can also be calculated in this phase.
NOTE
If the router performing an SPF calculation is an ABR, the router needs to check only
Type 3 LSAs in the backbone area.
3. The router calculates AS external routes.
AS external routes can be considered to be directly connected to the ASBR.
Because the shortest path to the ASBR has been calculated in the preceding
phase, the router can check Type 5 LSAs to obtain the shortest paths to other
ASs.

5.2.3 OSPF TE
OSPF Traffic Engineering (TE) is a new feature developed on the basis of OSPF to
support MPLS TE and establish and maintain the Label Switch Path (LSP) of TE. In
the MPLS TE architecture described in "Principles" in the Configuration Guide -
MPLS - MPLS TE Configuration, OSPF functions as the information advertising
component, responsible for collecting and advertising MPLS TE information.
In addition to the network topology, TE also needs to know network constraints,
such as the bandwidth, TE metric, administrative group, and affinity attribute.
Current OSPF functions, however, cannot meet these requirements. Therefore,
OSPF needs to be extended by introducing a new type of LSAs to advertise
network constraints. Based on the network constraints, the Constrained Shortest
Path First (CSPF) algorithm can calculate the path that satisfies certain
constraints.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 158


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-7 Function of OSPF in the MPLS TE architecture

Destination: Network1 Destination: Network1


cost=2 cost=2

Area 3 RouterE
RouterC ASBR
cost=6 cost=1 cost=8

RouterA RouterB
ASBR cost=1
cost=2

Area 0

Area 2

RouterD

Function of OSPF in the MPLS TE Architecture


In the MPLS TE architecture, OSPF functions as the information advertising
component:
● Collects related information about TE.
● Floods TE information to devices in the same area.
● Uses the collected TE information to form the TE database (TEDB) and
provides it for CSPF to calculate routes.
OSPF does not consider what the specific information is or how MPLS uses the
information.

TE-LSA
OSPF uses a new type of LSAs, namely, Type 10 opaque LSAs, to collect and
advertise TE information. This type of LSAs contains the link status information
required by TE, including the maximum link bandwidth, maximum reservable
bandwidth, current reserved bandwidth, and link color. Type 10 opaque LSAs
synchronize link status information among devices in an area through the OSPF
flooding mechanism. By so doing, a uniform TEDB is formed for route calculation.

Interaction Between OSPF TE and CSPF


OSPF collects TE information in an area by using Type 10 LSAs, including the
bandwidth, priority, and link metric. After processing the collected TE information,
OSPF provides it for CSPF to calculate routes.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 159


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

IGP Shortcut and Forwarding Adjacency


OSPF supports IGP shortcut and forwarding adjacency. The two features allow
OSPF to use a tunnel interface as an outgoing interface to reach a destination.

Differences between IGP shortcut and forwarding adjacency are as follows:

● A device enabled with IGP shortcut uses a tunnel interface as an outgoing


interface, but it does not advertise the link of the tunnel interface to
neighbors. Therefore, other devices cannot use this tunnel.
● A device enabled with forwarding adjacency uses a tunnel interface as an
outgoing interface, and advertises the tunnel interface to neighbors.
Therefore, other devices can use this tunnel.
● IGP shortcut is unidirectional and needs to be configured only on the device
that uses IGP shortcut.

OSPF DS-TE
DiffSer Aware Traffic Engineering (DS-TE) controls and forwards flows differently
based on Class of Service (CoS). DS-TE combines the advantages of MPLS TE and
Differentiated Services (DiffServ) and controls flow paths precisely. By so doing,
DS-TE effectively uses network resources and reserves required resources for
different service flows. For details, see "Principles" in the Configuration Guide -
MPLS - MPLS TE Configuration.

To support DS-TE in MPLS, OSPF supports the local overbooking multiplier TLV
and bandwidth constraint (BC) TLV in the TE-LSA, which are used to advertise and
collect the reservable bandwidths of class types (CTs) with different priorities on
the link (A CT refers to a collection of bandwidths of an LSP or a group of LSPs
with the same CoS.)

OSPF SRLG
OSPF supports the applications of the Shared Risk Link Group (SRLG) in MPLS by
obtaining information about the SRLG that floods TE information to devices in an
area. For details, see "Principles" in the Configuration Guide - MPLS - MPLS TE
Configuration.

5.2.4 BFD for OSPF

Definition
Bidirectional Forwarding Detection (BFD) is a mechanism to detect
communication faults between forwarding engines.

To be specific, BFD detects connectivity of a data protocol on a path between two


systems. The path can be a physical link, a logical link, or a tunnel.

In BFD for OSPF, a BFD session is associated with OSPF. The BFD session quickly
detects a link fault and then notifies OSPF of the fault. This speeds up OSPF's
response to the change of the network topology.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 160


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Purpose
The link fault or the topology change may cause devices to re-calculate routes.
Therefore, the convergence of routing protocols must be as quick as possible to
improve the network performance.

Link faults are unavoidable. Therefore, a feasible solution is required to detect


faults faster and notify the faults to routing protocols immediately. If BFD is
associated with OSPF, once a fault occurs on a link between neighbors, BFD can
speed up the OSPF convergence.

Table 5-10 Comparison before and after BFD for OSPF is enabled

Associated Link Fault Detection Mechanism Convergence


with BFD or Speed
Not

Not associated An OSPF Dead timer expires. By default, At the second level
with BFD the timeout period of the timer is 40s.

Associated A BFD session goes Down. At the millisecond


with BFD level

Principle

Figure 5-8 BFD for OSPF

RouterA RouterB GE3/0/0


172.16.1.1/24
GE2/0/0 GE2/0/0
GE1/0/0 10.3.3.1/24 10.3.3.2/24 GE1/0/0
10.1.1.1/24 10.2.2.2/24

GE1/0/0 GE2/0/0
10.1.1.2/24 10.2.2.1/24 Area0
RouterC

The principle of BFD for OSPF is shown in Figure 5-8.

1. OSPF neighbor relationships are established between these three routers.


2. After a neighbor relationship becomes Full, this triggers BFD to establish a
BFD session.
3. The outbound interface on RouterA connected to RouterB is GE 2/0/0. If the
link fails, BFD detects the fault and then notifies RouterA of the fault.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 161


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

4. RouterA processes the event that a neighbor relationship becomes Down and
re-calculates routes. After calculation, the outbound interface is GE1 /0/0
passes through RouterC and then reaches RouterB.

NOTE

BFD One-Arm Echo function can not be associated with OSPF.

5.2.5 OSPF GTSM

Definition
GTSM is short for Generalized TTL Security Mechanism, a mechanism that protects
the services over the IP layer by checking whether the TTL value in the IP packet
header is within a pre-defined range.

Purpose
On the network, an attacker may simulate valid OSPF packets and keeps sending
them to a device. After receiving these packets, the device identifies the
destination of the packets. The forwarding plane of the device then directly sends
the packets to the control plane for processing without checking the validity of the
packets. As a result, the device is busy processing these "valid" packets, resulting
in high CPU usage.
In applications, the GTSM is mainly used to protect the TCP/IP-based control plane
from CPU-utilization based attacks, for example, attacks that cause CPU overload.

Principle
Devices enabled with GTSM check the TTL values in all the received packets
according to the configured policies. The packets that fail to pass the policies are
discarded or sent to the control plane. This prevents devices from possible CPU-
utilization based attacks. A GTSM policy involves the following items:
● Source address of the IP packet sent to the device
● VPN instance to which the packet belongs
● Protocol number of the IP packet (89 for OSPF, and 6 for BGP)
● Source interface number and destination interface number of protocols above
TCP/UDP
● Valid TTL range
The method of implementing GTSM is as follows:
● For the directly connected OSPF neighbors, the TTL value of the unicast
protocol packets to be sent is set to 255.
● For multi-hop neighbors, a reasonable TTL range is defined.
The applicability of GTSM is as follows:
● GTSM takes effect only for unicast packets. The TTL value of multicast packets
cannot exceed 255; therefore, GTSM is not required for multicast packets.
● GTSM does not support tunnel-based neighbors.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 162


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.2.6 OSPF Smart-discover

Definition
Generally, Routers periodically send Hello packets through OSPF interfaces. That
is, a Router sends Hello packets at the Hello interval set by a Hello timer. Because
Hello packets are sent at a fixed interval, the speed at which OSPF neighbor
relationship is established is lowered.
Enabling Smart-discover can speed up the establishment of OSPF neighbor
relationships in specific scenarios.

Table 5-11 OSPF Smart-discover


Smart-discover Configured Processing
or Not

Smart-discover is not ● Hello packets are sent only when the Hello
configured timer expires.
● The gap between the sending of two Hello
packets is the Hello interval.
● Neighbors keep waiting to receive Hello
packets within the Hello interval.

Smart-discover is configured ● Hello packets are sent directly regardless of


whether the Hello timer expires.
● Neighbors can receive packets rapidly and
perform status transition immediately.

Principle
In the following scenarios, the interface enabled with Smart-discover can send
Hello packets to neighbors without having to wait for the Hello timer to expire:
● The neighbor status becomes 2-way for the first time.
● The neighbor status changes from 2-way or a higher state to Init.

5.2.7 OSPF VPN

Definition
As an extension of OSPF, OSPF VPN multi-instance enables Provider Edges (PEs)
and Customer Edges (CEs) in VPNs to run OSPF for interworking and use OSPF to
learn and advertise routes.

Purpose
As a widely used IGP, in most cases, OSPF runs in VPNs. If OSPF runs between PEs
and CEs, and PEs advertise VPN routes to CEs using OSPF, CEs do not need to

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 163


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

support other routing protocols for interworking with PEs. This simplifies
management and configuration of CEs.

Running OSPF Between PEs and CEs


In BGP/MPLS VPN, routing information is transmitted between PEs using Multi-
Protocol BGP (MP-BGP), whereas routes are learned and advertised between PEs
and CEs using OSPF.
Running OSPF between PEs and CEs has the following benefits:
● OSPF is used in a site to learn routes. Running OSPF between PEs and CEs can
reduce the protocol types that CEs must support, reducing the requirements
for CEs.
● Similarly, running OSPF both in a site and between PEs and CEs simplifies the
workload of network administrators. In this manner, network administrators
do not have to be familiar with multiple protocols.
● When a network using OSPF but not VPN on the backbone network begins to
use BGP/MPLS VPN, running OSPF between PEs and CEs facilitates the
transition.
As shown in Figure 5-9, CE1, CE3, and CE4 belong to VPN 1, and the numbers
following OSPF refer to the process IDs of multiple OSPF instances running on PEs.

Figure 5-9 Running OSPF between PEs and CEs


VPN1 VPN1
Site1 Site3
Area1
Area0
CE1 CE3

Area0 Area0
OSPF 100 VPN1
OSPF 100 VPN1 MPLS VPN
Backbone
Area1 PE1 PE2 Area1
OSPF 200 VPN2 OSPF 200 VPN1

CE2 CE4
Area1 Area2
Site2 Site4
VPN2 VPN1

The process of advertising routes of CE1 to CE3 and CE4 is as follows:


1. PE1 imports OSPF routes of CE1 into BGP and forms BGP VPNv4 routes.
2. PE1 advertises BGP VPNv4 routes to PE2 using MP-BGP.
3. PE2 imports BGP VPNv4 routes into OSPF, and then advertises these routes to
CE3 and CE4.
The process of advertising routes of CE4 or CE3 to CE1 is the same as the
preceding process.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 164


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Configuring OSPF Areas Between PEs and CEs


OSPF areas between PEs and CEs can be either non-backbone areas or backbone
areas (Area 0). A PE can only be an area border router (ABR).

In the extended application of OSPF VPN, the MPLS VPN backbone network serves
as Area 0. OSPF requires that Area 0 be contiguous. Therefore, Area 0 of all VPN
sites must be connected to the MPLS VPN backbone network. If a VPN site has
OSPF Area 0, the PEs that CEs access must be connected to the backbone area of
this VPN site through Area 0. If no physical link is available to directly connect PEs
to the backbone area, a virtual link can be used to implement logical connection
between the PEs and the backbone area, as shown in Figure 5-10.

Figure 5-10 Configuring OSPF areas between PEs and CEs


PE1 VPN PE2
backbone
Area0 Area0
Area1 Virtual
link
CE1 CE2
Site1 Site2
Area0 Area0

A non-backbone area (Area 1) is configured between PE1 and CE1, and a


backbone area (Area 0) is configured in Site 1. As a result, the backbone area in
Site 1 is separated from the VPN backbone area. Therefore, a virtual link is
configured between PE1 and CE1 to ensure that the backbone area is contiguous.

OSPF Domain ID
If inter-area routes are advertised between local and remote OSPF areas, these
areas are considered to be in the same OSPF domain.

● Domain IDs identify and differentiate different domains.


● Each OSPF domain has one or more domain IDs, one of which is a primary ID
with the others being secondary IDs.
● If an OSPF instance does not have a specific domain ID, its ID is considered as
null.

Before advertising the remote routes sent by BGP to CEs, PEs need to determine
the type of OSPF routes (Type 3, Type 5 or Type 7) to be advertised to CEs
according to domain IDs.

● If local domain IDs are the same as or compatible with remote domain IDs in
BGP routes, PEs advertise Type 3 routes.
● Otherwise, PEs advertise Type 5 or Type 7 routes.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 165


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Table 5-12 Domain ID

Comparison Between Local and Local and Route Type


Remote Domain IDs Remote
Domain
IDs the
Same Or
Not

Both the local and remote domain IDs The same Inter-area route
are null.

The remote domain ID is the same as The same Inter-area route


the local primary domain ID or one of
the local secondary domain IDs.

The remote domain ID is different Not the If the local area is a non-
from the local primary domain ID or same NSSA, external routes are
any of the local secondary domain IDs. generated.
If the local area is an
NSSA, NSSA routes are
generated.

Routing Loop Prevention


Between PEs and CEs, routing loops may occur when OSPF and BGP learn routes
from each other.

Figure 5-11 OSPF VPN routing loops


PE1

VPN
backbone

vpn1 site1 10.1.1.1/32

CE1

PE2

As shown in Figure 5-11, on PE1, OSPF imports a BGP route whose destination
address is 10.1.1.1/32, and then generates and advertises a Type 5 or Type 7 LSA
to CE1. Then, CE1 learns an OSPF route with the destination address and next hop
being 10.1.1.1/32 and PE1 respectively, and advertises the route to PE2. In this
manner, PE2 learns an OSPF route with the destination address and next hop
being 10.1.1.1/32 and CE1 respectively.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 166


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Similarly, CE1 also learns an OSPF route with the destination address and next hop
being 10.1.1.1/32 and PE2 respectively. PE1 learns an OSPF route with the
destination address and next hop being 10.1.1.1/32 and CE1 respectively.
As a result, CE1 has two equal-cost routes with next hops being PE1 and PE2
respectively, and the next hops of the routes from PE1 and PE2 to 10.1.1.1/32 are
CE1. Thus, a routing loop occurs.
In addition, the preference of an OSPF route is higher than that of a BGP route.
Therefore, on PE1 and PE2, BGP routes to 10.1.1.1/32 are replaced by the OSPF
route. That is, the OSPF route with the destination address and next hop being
10.1.1.1/32 and CE1 respectively is active in the routing tables of PE1 and PE2.
The BGP route then becomes inactive, and thus the LSA generated when this route
is imported by OSPF is deleted. This causes the OSPF route to be withdrawn. As a
result, there is no OSPF route in the routing table, and the BGP route becomes
active again. This cycle causes route flapping.
OSPF VPN provides a solution to this problem, as shown in Table 5-13.

Table 5-13 Routing loop prevention


Feature Definition Function

DN-bit To prevent routing loops, an When advertising the


OSPF multi-instance process uses generated Type 3, Type
one bit as a flag bit, which is 5, or Type 7 LSAs to CEs,
called the DN-bit. PEs set the DN-bit of
these LSAs to 1 and the
DN-bit of other LSAs to
0.
When calculating routes,
the OSPF multi-instance
process of a PE ignores
the LSAs with the DN-bit
being 1. This avoids
routing loops that occur
when PEs learn the self-
originated LSAs from
CEs.

VPN Route Tag The VPN route tag is carried in When a PE detects that
Type 5 or Type 7 LSAs generated the VPN route tag in the
by PEs according to the received incoming LSA is the
BGP private route. same as that in the local
Not transmitted in BGP extended LSA, the PE ignores this
community attributes, the VPN LSA. Consequently,
route tag is valid only on the PEs routing loops are
that receive BGP routes and avoided.
generate OSPF LSAs.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 167


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Feature Definition Function

Default Route A route with the destination PEs do not calculate


address and mask being all 0s is default routes.
a default route. Default routes are used
to forward the traffic
from CEs or the sites
where CEs reside to the
VPN backbone network.

Disabling Routing Loop Prevention

NOTICE

Disabling routing loop prevention may cause routing loops. Exercise caution when
performing this operation.

During BGP or OSPF route exchanges, routing loop prevention prevents OSPF
routing loops in VPN sites.
In the inter-AS VPN Option A scenario, if OSPF is running between ASBRs to
transmit VPN routes, the remote ASBR may be unable to learn the OSPF routes
sent by the local ASBR due to the routing loop prevention mechanism.
As shown in Figure 5-12, inter-AS VPN Option A is deployed. OSPF is running
between PE1 and CE1. CE1 sends VPN routes to CE2.

Figure 5-12 Networking diagram for inter-AS VPN Option A

VPN1
CE1 VPN1
CE3
BGP/MPLS backbone BGP/MPLS backbone
AS: 100 AS: 200
PE1
PE3
ASBR1 ASBR2
MP-IBGP MP-IBGP
OSPF

PE2
PE4

CE2 CE4
VPN2 VPN2

1. PE1 learns routes to CE1 using the OSPF process in a VPN instance, and
imports these routes into MP-BGP, and sends the MP-BGP routes to ASBR1.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 168


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

2. After having received the MP-BGP routes, ASBR1 imports the routes into the
OSPF process in a VPN instance and generates Type 3, Type 5, or Type 7 LSAs
in which the DN bit is set to 1.
3. ASBR2 learns these LSAs using OSPF and checks the DN bit of each LSA. After
learning that the DN bit in each LSA is set to 1, ASBR2 does not add the
routing information carried in these LSAs to its routing table.

Due to the routing loop prevention mechanism, ASBR2 cannot learn the OSPF
routes sent from ASBR1, causing CE1 to be unable to communicate with CE3.

To address the preceding problem, use either of the following methods:

● A device does not set the DN bit to 1 in the LSAs when importing BGP routes
into OSPF. For example, ASBR1 does not set the DN bit to 1 when importing
MP-BGP routes into OSPF. After ASBR2 receives these routes and checks that
the DN bit in the LSAs carrying these routes is 0, ASBR2 adds the routes to its
routing table.
● A device does not check the DN bit after having received LSAs. For example,
ASBR1 sets the DN bit to 1 in LSAs when importing MP-BGP routes into OSPF.
ASBR2, however, does not check the DN bit after having received these LSAs.

The preceding methods can be used more flexibly based on specific types of LSAs.
For Type 3 LSAs, you can configure a sender to determine whether to set the DN
bit to 1 or configure a receiver to determine whether to check the DN bit in the
Type 3 LSAs based on the router ID of the device that generates the Type 3 LSAs.

In the inter-AS VPN Option A scenario shown in Figure 5-13, the four ASBRs are
fully meshed and run OSPF. ASBR2 may receive the Type 3, Type 5, or Type 7 LSAs
generated on ASBR4. If ASBR2 is not configured to check the DN bit in the LSAs,
ASBR2 will accept the Type 3 LSAs, and routing loops will occur, as described in
Figure 5-13. ASBR2 will deny the Type 5 or Type 7 LSAs, because the VPN route
tags carried in the LSAs are the same as the default VPN route tag of the OSPF
process on ASBR2.

To address the routing loop problem caused by Type 3 LSAs, configure ASBR2 not
to check the DN bit in the Type 3 LSAs that are generated by devices with the
router ID 10.1.1.1 and the router ID 10.3.3.3. After the configuration is complete, if
ASBR2 receives Type 3 LSAs sent by ASBR4 with the router ID 10.4.4.4, ASBR2 will
check the DN bit and deny these Type 3 LSAs because the DN bit is set to 1.

Figure 5-13 Networking diagram for full-mesh ASBRs in the inter-AS VPN Option
A scenario
OSPF Router ID OSPF Router ID
10.1.1.1 10.2.2.2
ASBR1 ASBR2

OSPF AS: 200


AS: 100

ASBR3 ASBR4
OSPF Router ID OSPF Router ID
10.3.3.3 10.4.4.4

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 169


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

OSPF Multi-VPN-Instance
OSPF multi-VPN-instance is short for OSPF multi-instance.

Multi-VPN-Instance CE
OSPF multi-instance generally runs on PEs. The devices that run OSPF multi-
instance within the LANs of users and are configured with the vpn-instance-
capability simple command are called Multi-VPN-Instance CEs (MCEs), that is,
multi-instance CEs.
Compared with OSPF multi-instance running on PEs, MCEs have the following
characteristics:
● MCEs do not need to support OSPF-BGP synchronization.
● MCEs establish different OSPF instances for different services. Different virtual
CEs transmit different services. This solves the security issue of the LAN at a
low cost.
● MCEs implement different OSPF multi-instances on a CE. The key to
implementing MCEs is to disable loop detection and calculate routes directly.
That is, MCEs also use the received LSAs with the DN-bit set to 1 for route
calculation.

5.2.8 OSPF NSSA

Definition
As defined in OSPF, stub areas cannot import external routes. This prevents a large
number of external routes from consuming bandwidth and storage resources of
the Routers in stub areas. To import external routes and to prevent external routes
from consuming resources, NSSAs are used, because stub areas cannot meet
requirements.
NSSAs are a new type of OSPF areas.
There are many similarities between NSSAs and stub areas. The difference
between NSSAs and stub areas is that NSSAs can import AS external routes into
the entire OSPF AS and advertise the imported routes in the OSPF AS, but do not
learn external routes from other areas on the OSPF network.

Figure 5-14 NSSA


RIP RIP
Type5 Type5 NSSA Area

Type5 Type5 Type7


ASBR Area2 Area0 Area1 ASBR
ABR ABR

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 170


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

N-bit
All Routers in an area must be configured with the same area type. In OSPF, the
N-bit is carried in a Hello packet and is used to identify the area type supported
by the Router. OSPF neighbor relationships cannot be established between Routers
configured with different area types.
Some manufacturers do not comply with the standard and set the N-bit in both
OSPF Hello and DD packets. To allow Huawei devices to interwork with these
manufacturers' devices, set the N-bit in OSPF DD packets on Huawei devices.

Type 7 LSA
● Type 7 LSAs are a new type of LSAs that can only be used in NSSAs and
describe the imported external routes.
● Type 7 LSAs are generated by ASBRs in an NSSA and flooded only in the NSSA
where the ASBRs reside.
● When the ABRs in the NSSA receive these Type 7 LSAs, they translate some of
the Type 7 LSAs into Type 5 LSAs to advertise AS external routes to the other
areas on the OSPF network.

Translating Type 7 LSAs Into Type 5 LSAs


To advertise the external routes imported by an NSSA to other areas, Type 7 LSAs
need to be translated into Type 5 LSAs so that the external routes can be
advertised on the entire OSPF network.
● The Propagate bit (P-bit) in a Type 7 LSA is used to instruct the Router
whether to translate Type 7 LSAs into Type 5 LSAs.
● By default, the ABR with the largest router ID in an NSSA is responsible for
translating Type 7 LSAs into Type 5 LSAs.
● Only the Type 7 LSAs in which the P-bit is set to 1 and the FA is not 0 can be
translated into Type 5 LSAs. The FA indicates that the packet to a specific
destination address will be forwarded to the address specified by the FA.
● The P-bit is not set for default routes in Type 7 LSAs generated by an ABR.

Preventing Loops Caused by Default Routes


There may be multiple ABRs in an NSSA. To prevent routing loops, these ABRs not
to calculate default routes advertised by each other.

5.2.9 OSPF Fast Convergence


OSPF fast convergence is an extended feature of OSPF to speed up route
convergence. The characteristics of OSPF fast convergence are as follows:
● 5.2.11 Priority-based OSPF Convergence
● When certain routes on the network change, only the changed routes are
recalculated. This is called Partial Route Calculation (PRC).
● An intelligent timer is used to implement LSA management (the generating
and receiving of LSAs). With the intelligent timer, infrequent changes are
responded to quickly, whereas frequent changes are suppressed as desired.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 171


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

To avoid excessive consumption of device resources by network connections or


due to frequent route flapping, RFC 2328 maintains that:
– After an LSA is generated, it cannot be generated again within 1 second.
The interval for updating LSAs is 5 seconds.
– The interval for receiving LSAs is one second.
On a stable network where routes need to be fast converged, you can use the
intelligent timer to set the interval for receiving LSAs to 0 seconds. This
ensures that topology or route changes can be advertised to the network or
be immediately sensed, thus speeding up route convergence on the network.
● Route calculation is controlled through the intelligent timer.
When the network topology changes, devices need to recalculate routes
according to OSPF. This means that frequent changes in the network topology
affect the performance of devices. To address issue, RFC 2328 requires the use
of a delay timer in route calculation so that route calculation is performed
only after the specified delay. However, the delay suggested by RFC is a fixed
value and cannot ensure both fast response to topology changes and effective
flapping suppression.
By means of the intelligent timer, the delay in route calculation can be flexibly
set as desired. As a result, infrequent changes are responded to quickly,
whereas frequent changes are suppressed as desired.
● 5.2.6 OSPF Smart-discover

5.2.10 OSPF NSR

Non-Stop Routing (NSR) is a routing technique that prevents a neighbor from


sensing the fault on the control plane of a device that provides a slave control
plane. With NSR, when the control plane of the device becomes faulty, the
neighbor relationship set up through specific routing protocols, MPLS, and other
protocols that carry services are not interrupted.

As networks develop at a fast pace, operators are having increasingly higher


requirements for reliability of IP networks. NSR, as a high availability (HA)
solution, is introduced to ensure that services transmitted by a device are not
affected when a hardware or software failure occurs on the device.

OSPF NSR synchronizes the protocol data on the master MPU/SRU to the slave
MPU/SRU in real time. When the master MPU/SRU becomes faulty or needs to be
upgraded, the slave MPU/SRU rapidly takes over services from the master
MPU/SRU without being sensed by the neighbor. OSPF NSR synchronizes the real-
time data between the master and slave MPUs/SRUs in the following manners:
● OSPF backs up configuration data and dynamic data, including information
about interfaces, neighbors, and LSDBs.
● OSPF does not back up routes, shortest path trees (SPTs), and Traffic
Engineering DataBases (TEDBs). All these can be restored through the source
data by using the database backup process.
● When the master-slave switchover occurs, the new master MPU/SRU restores
the operation data and takes over services from the former master MPU/SRU
without being sensed by the neighbor.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 172


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE

Only the AR3200 series support NSR.

5.2.11 Priority-based OSPF Convergence


Priority-based OSPF convergence ensures that specific routes converge first when
a great number of routes need to converge. Different routes can be set with
different convergence priorities. This allows important routes to converge first and
therefore improves network reliability.

By using priority-based OSPF convergence, you can assign a higher convergence


priority to routes for key services so that those routes can converge fast. By so
doing, the impact on key services is reduced.

5.2.12 OSPF IP FRR


OSPF IP Fast Reroute (FRR) is dynamic IP FRR in which a backup link is pre-
computed by an OSPF based on the LSDBs on the entire network. The backup link
is stored in the forwarding table to protect traffic in the case of failures. In this
manner, the failure recovery time can be reduced to less than 50 ms.

OSPF IP FRR complies with RFC 5286, that is, Basic Specification for IP Fast
Reroute Loop-Free Alternates, which protects traffic when links or nodes become
faulty.

Background
With the development of networks, Voice over IP (VoIP) and online video services
require high-quality real-time transmission. Nevertheless, if an OSPF fault occurs,
multiple processes, including fault detection, LSP update, LSP flooding, route
calculation, and FIB entry delivery, must be performed to switch traffic to a new
link. As a result, the fault recovery time is much greater than 50 ms, the time for
users to sense traffic interruption, which cannot meet the requirement for real-
time services.

Implementation Principle
OSPF IP FRR pre-computes a backup link by using the Loop-Free Alternate (LFA)
algorithm, and then adds the backup link and the primary link to the forwarding
table. In the case of failures, OSPF IP FRR can fast switch traffic to the backup link
before routes on the control plane converge. This prevents traffic interruption and
thus protects traffic and improves reliability of an OSPF network. The Router
supports IPv4 OSPF IP FRR.

In the LFA algorithm, considering a neighbor that can provide a backup link as the
root node, the neighbor computes the shortest path from itself to the destination
of the primary link by using the SPF algorithm. The neighbor then computes a
loop-free backup link with the smallest cost by using the inequality defined in RFC
5286.

OSPF IP FRR can filter backup routes that need to be added to the IP routing
table. Only the backup routes that are filtered through the filtering policy are

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 173


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

added to the IP routing table. In this manner, users can flexibly manage the
addition of OSPF backup routes to the IP routing table.

Application Environment
OSPF IP FRR is classified into link protection and link-node dual protection.
Distance_opt(X,Y) indicates the shortest path between node X and node Y.
Link protection: indicates that the object to be protected is the traffic passing
through an OSPF IP FRR-enabled link. The link cost must satisfy the inequality
Distance_opt(N, D) < Distance_opt(N, S) + Distance_opt(S, D). S indicates the
source node of traffic; N indicates the node on the backup link; D indicates the
destination node of traffic.
As shown in Figure 5-15, traffic is transmitted from RouterS to RouterD. The link
cost satisfies the link protection inequality. When the primary link fails, RouterS
switches the traffic to the backup link RouterS -> RouterN so that the traffic can
be further transmitted along downstream paths. This ensures that traffic
interruption is less than 50 ms.

Figure 5-15 OSPF IP FRR link protection


cost = 10 cost = 5

RouterS RouterE RouterD


5
co

t=
t=s

s
co
1
0

RouterN

Link-node dual protection: Figure 5-16 shows link-node dual protection of OSPF IP
FRR. Node protection takes precedence over link protection.
Link-node dual protection must satisfy the following situations:
The link cost must satisfy the inequality Distance_opt(N, D) < Distance_opt(N, S)
+ Distance_opt(S, D).
The interface cost of the router must satisfy the inequality Distance_opt(N, D) <
Distance_opt(N, E) + Distance_opt(E, D).
S indicates the source node of traffic; E indicates the faulty node; N indicates the
node on the backup link; D indicates the destination node of traffic.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 174


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-16 OSPF IP FRR link-node dual protection


cost = 15 cost = 5

RouterE
RouterS RouterD
co
st= 5
10 ost=
c

RouterN

5.2.13 OSPF-BGP Association

Definition
When a new device is deployed in the network or a device is restarted, network
traffic may be lost during BGP convergence. This is because IGP convergence is
faster than BGP convergence.
This problem can be solved through the synchronization between OSPF and BGP.

Purpose
If a backup link exists, during traffic switchback, BGP traffic is lost because BGP
route convergence is slower than OSPF route convergence.
As shown in Figure 5-17, RouterA, RouterB, RouterC, and RouterD run OSPF and
establish IBGP connections. RouterC functions as the backup of RouterB. When the
network is stable, BGP and OSPF routes converge completely on the device.
Normally, traffic from RouterA to 10.3.1.0/30 passes through RouterB. When
RouterB becomes faulty, traffic is switched to RouterC. After RouterB recovers,
traffic is switched back to RouterB. During this process, packet loss occurs.
This is because when traffic is switched back to RouterB, IGP route convergence is
faster than BGP route convergence. Consequently, convergence of OSPF routes is
already complete when BGP route convergence is still going on. As a result,
RouterB does not know the route to 10.3.1.0/30.
Therefore, when packets from RouterA to 10.3.1.0/30 arrive at RouterB, they are
discarded because RouterB does not have the route to 10.3.1.0/30.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 175


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-17 OSPF-BGP synchronization


RouterC
POS2/0/0 POS1/0/0 RouterF
10.1.2.2/30 10.1.4.1/30 POS1/0/0
10.3.1.2/30
POS1/0/0 POS2/0/0
POS2/0/0 10.1.4.2/30 10.3.1.1/30
10.1.2.1/30 EBGP
RouterA RouterD RouterE
POS1/0/0 POS3/0/0
10.1.1.1/30 10.2.1.1/30 POS1/0/0
POS2/0/0 10.2.1.2/30
10.1.3.2/30
POS1/0/0 POS2/0/0
10.1.1.2/30 10.1.3.1/30
AS 10 RouterB AS 20

Principle
The device enabled with OSPF-BGP synchronization remains as a stub router
within the set synchronization period. That is, the link metric in the LSA advertised
by the device is the maximum value 65535. Therefore, the device instructs other
OSPF devices not to use it for data forwarding.
As shown in Figure 5-17, OSPF-BGP synchronization is enabled on RouterB. In this
situation, before BGP route convergence is complete, RouterA continues to use the
backup link RouterC rather than forward traffic to RouterB until BGP route
convergence on RouterB is complete.

5.2.14 OSPF Local MT

Definition and Purpose


When multicast and an MPLS TE tunnel are deployed in a network, multicast may
be affected by the TE tunnel, which causes multicast services to become
unavailable.
To solve this problem, you can enable local multicast-topology (MT) for multicast
packet forwarding.

Local MT
After IGP Shortcut is configured on a TE tunnel, the outbound interface of the
route calculated by an IGP may not be the actual physical interface but a TE
tunnel interface.
According to the unicast route to the multicast source address, a router sends a
Join message through a TE tunnel interface. In this situation, routers spanned by
the TE tunnel cannot detect the Join message, so they do not create any multicast
forwarding entry.
As shown in Figure 5-18, RouterB spanned by the TE tunnel does not create any
multicast forwarding entry.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 176


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-18 OSPF Local MT

Client Server

Join Packets
Multicast Packets

RouterB
GE1/1/0 GE2/1/0 GE2/2/0 GE3/1/0

RouterA RouterC
Tunnel1/0/0

A TE tunnel is unidirectional, so multicast data packets sent by the multicast


source are sent to the routers spanned by the tunnel through physical interfaces.
These routers discard the multicast data packets, because they do not have any
multicast forwarding entry. As a result, services become unavailable.
After local MT is enabled, if the outbound interface of the calculated route is a TE
tunnel interface of IGP Shortcut type, the route management (RM) module
creates a separate Multicast IGP (MIGP) routing table for the multicast protocol,
calculates the actual physical outbound interface for the route, and then adds the
route to the MIGP routing table. Multicast then uses routes in the MIGP routing
table to forward packets.
In Figure 5-18, the packets requesting to join a multicast group is sent from
RouterA to RouterB through GE 1/1/0. RouterB then can create the multicast
forwarding table correctly.

5.2.15 OSPF GR
Routers generally operate with separation of the control plane and forwarding
plane. When the network topology remains stable, a restart of the control plane
does not affect the forwarding plane, and the forwarding plane can still forward
data properly. This separation ensures non-stop service forwarding.
In graceful restart (GR) mode, the forwarding plane continues to direct data
forwarding after a restart occurs. The actions on the control plane, such as re-
establishment of neighbor relationships and route calculation, do not affect the
forwarding plane. Network reliability is improved because service interruption
caused by route flapping is prevented.

Basic Concepts of OSPF GR


Graceful Restart (GR) is a technology used to ensure normal traffic forwarding
and non-stop forwarding of key services during the restart of routing protocols.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 177


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Unless otherwise stated, GR described in this section refers to the GR technology


defined in RFC 3623.
GR is one of the high availability (HA) technologies, which comprise a set of
comprehensive technologies, such as fault-tolerant redundancy, link protection,
faulty node recovery, and traffic engineering. As a fault-tolerant redundancy
technology, GR is widely used to ensure non-stop forwarding of key services
during master/slave switchover and system upgrade.
The following concepts are involved in GR:
● Grace-LSA
OSPF supports GR by flooding Grace-LSAs. Grace-LSAs are used to inform the
neighbor of the GR time, cause, and interface address when the GR starts and
ends.
● Role of a router during GR
– Restarter: is the router that restarts. The Restarter can be configured to
support totally GR or partly GR.
– Helper: is the router that helps the Restarter. The Helper can be
configured to support planned GR or unplanned GR or to selectively
support GR through the configured policies.
NOTE
In practical application, in order to realize that business forwarding is not affected by
motherboard failure, it is usually possible to configure BGP GR in the hardware
environment of dual motherboard to make sense.
All the models support the GR Helper, and only AR3200 series support the GR
Restarter.
● Conditions that cause GR
– Unknown: indicates that GR is triggered for an unknown reason.
– Software restart: indicates that GR is triggered by commands.
– Software reload/upgrade: indicates that GR is triggered by software
restart or upgrade.
– Switch to redundant control processor: indicates that GR is triggered by
the abnormal master/slave switchover.
● GR period
The GR period cannot exceed 1800 seconds. OSPF routers can exit from GR
regardless of whether GR succeeds or fails, without waiting for GR to expire.

Classification of OSPF GR
● Totally GR: indicates that when a neighbor of a router does not support GR,
the router exits from GR.
● Partly GR: indicates that when a neighbor does not support GR, only the
interface associated with this neighbor exits from GR, whereas the other
interfaces perform GR normally.
● Planned GR: indicates that a router restarts or performs the master/slave
switchover using a command. The Restarter sends a Grace-LSA before restart
or master/slave switchover.
● Unplanned GR: indicates that a router restarts or performs the master/slave
switchover because of faults. A router performs the master/slave switchover,

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 178


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

without sending a Grace-LSA, and then enters GR after the slave board goes
Up. The process of unplanned GR is the same as that of planned GR.

GR Process
● A router starts GR.
In planned GR mode, after master/slave switchover is triggered through a
command, the Restarter sends a Grace-LSA to all neighbors to notify them of
the start, period, and cause of GR, and then performs the master/slave
switchover.
In unplanned GR, the Restarter does not send the Grace-LSA.
In unplanned GR mode, the Restarter sends a Grace-LSA immediately after
the slave board goes Up, informing neighbors of the start, period, and cause
of GR. The Restarter then sends a Grace-LSA to each neighbor five times
consecutively. This ensures that neighbors receive the Grace-LSA. This
operation is proposed by manufacturers but not defined by the OSPF protocol.
The Restarter sends a Grace-LSA to notify neighbors that it enters GR. During
GR, neighbors keep neighbor relationships with the Restarter so that other
routers cannot detect the switchover of the Restarter.
● The GR process runs, as shown in Figure 5-19.

Figure 5-19 OSPF GR process

RouterA RouterB

Restarter Helper
Before the active/ Grace-LSA
Enter Helper
standby switchover
Switchover Return LSAck
LSAck
Finish switchover packet for the
received LSA
Grace-LSA Updates the GR
Enter GR period for the
Grace-LSAs received
Grace-LSAs
Send Hello packets, negotiate,
exchange
Full DD packets, and synchronize LSDB
Exit GR successfully, Exit the Helper
Flush Grace-LSA successfully and
calculate routes,
and generate LSA generate Router-
LSA

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 179


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● The router exits from GR.

Table 5-14 Reasons that a router exits GR


Executi Restarter Helper
on of
GR

GR Before GR expires, the Restarter re- After the Helper receives


succee establishes neighbor relationships the Grace-LSA with the Age
ds. with all neighbors before master/ being 3600s from the
slave switchover. Restarter, the neighbor
relationship between the
Helper and Restarter enters
the Full state.

GR ● GR expires, and neighbor ● Helper does not receive


fails. relationships do not recover the Grace-LSA from
completely. Restarter before the
● Router-LSA or Network-LSA sent neighbor relationship
by the Helper causes Restarter expires.
to fail to perform bidirectional ● Status of the interface
check. that functions as the
● Status of the interface that Helper changes.
functions as the Restarter ● Helper receives the LSA
changes. that is inconsistent with
● Restarter receives the one-way the LSA in the local
Hello packet from the Helper. LSDB from another
router. This situation can
● The Restarter receives the Grace- be excluded after the
LSA that is generated by another Helper is configured not
router on the same network to perform strict LSA
segment. Only one router can check.
perform GR on the same
network segment. ● Helper receives Grace-
LSAs from two routers
● On the same network segment, on the same network
neighbors of the Restarter have segment at the same
different DRs or BDRs because of time.
the topology changes.
● Neighbor relationships
between Helper and
other neighbors change.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 180


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Comparison Between GR Mode and Non-GR Mode

Table 5-15 Comparison of master/slave switchover in the GR mode and non-GR


mode
Switchover in Non-GR Mode Switchover in GR Mode

● OSPF neighbor relationships are ● OSPF neighbor relationships are re-


re-established. established.
● Routes are recalculated. ● Routes are recalculated.
● Forwarding table changes. ● Forwarding table remains unchanged.
● Entire network detects route ● Except for neighbors of the device
changes, and route flapping where master/slave switchover
occurs for a short period of time. occurs, other routers do not detect
● Packets are lost during route changes.
forwarding, and services are ● No packets are lost during
interrupted. forwarding, and services are not
affected.

5.2.16 OSPF-LDP Association


Definition
In the networking that uses primary and backup links, when the faulty primary
link recovers, traffic is switched from the backup link back to the primary link.
IGP route convergence completes before an LDP session is established.
Consequently, the old LSP is deleted before the new LSP is established and LSP
traffic is interrupted.

Purpose
As shown in Figure 5-20, the primary link adopts the path
PE1→P1→P2→P3→PE2, and the backup link adopts the path
PE1→P1→P4→P3→PE2.
When the primary link is faulty, traffic is switched to the backup link. After the
primary link recovers, traffic is switched back to the primary link. During this
process, traffic is interrupted for a long period of time.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 181


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-20 OSPF-LDP association


P2

PE1 P1 P3 PE2

Primary link
Backup link
P4

Synchronizing Label Distribution Protocol(LDP) and IGP on P1 and P2 can shorten


traffic interruption caused by traffic switchover from the backup link to the
primary link.

Table 5-16 OSPF-LDP association


Enabling Status of OSPF-LDP Traffic Interruption Time
Association

Not enabled. Seconds level

Enabled. Milliseconds level

Principle
The principle of LDP-IGP synchronization is to delay route switchback by
suppressing the establishment of IGP neighbor relationships until LDP convergence
is complete. That is, before an LSP on the primary link is established, the backup
link continues to forward traffic. Then the link is deleted after the LSP is
established.
Synchronization of LDP and IGP involves three timers:
● Hold-down
● Hold-max-cost
● Delay
After the primary link recovers, a router responds as follows:
1. Starts the hold-down timer. The IGP interface does not establish IGP
neighbors but waits for establishment of an LDP session. The Hold-down
timer specifies the period that the IGP interface waits.
2. Starts the hold-max-cost timer after the hold-down timer expires. The hold-
max-cost timer specifies the interval for advertising the maximum link metric
of the interface in the Link State Advertisement (LSA) to the primary link.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 182


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

3. Starts the Delay timer to allow time for establishment of an LSP after an LDP
session is re-established for the faulty link.
4. After the Delay timer expires, LDP notifies IGP that synchronization is
complete regardless of the status of IGP.

5.2.17 OSPF Database Overflow

Definition
OSPF requires that routers in the same area have the same Link-State Database
(LSDB).
With the continuous increase in routes on the network, some routers fail to carry
the additional routing information because of limited system resources. This
situation is called OSPF database overflow.

Purpose
You can configure stub areas or NSSAs to solve the problem of the continuous
increase in routing information that causes the exhaustion of system resources of
routers. However, configuring stub areas or NSSAs cannot solve the problem when
the unexpected increase in dynamic routes causes database overflow. Setting the
maximum number of external LSAs in the LSDB can dynamically limit the LSDB
capacity, to avoid the problems caused by database overflow.

Principle
To prevent database overflow, you can set the maximum number of non-default
external routes on a router.
All routers on the OSPF network must be set with the same upper limit. If the
number of external routes on a router reaches the upper limit, the router enters
the Overflow state and starts an overflow timer. The router automatically exits
from the overflow state after the timer expires. By default, it is 5 seconds.

Table 5-17 OSPF database overflow


Overflow Phase OSPF Processing

Entering overflow state A router deletes all non-default external routes that
are generated.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 183


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Overflow Phase OSPF Processing

Staying in overflow state ● Router does not generate non-default external


routes.
● Router discards the newly received, non-default
external routes, and does not reply with an
LSAck packet.
● When the overflow timer expires, the router
checks whether the number of external routes
still exceeds the upper limit.
– If so, the router restarts the timer.
– If not, the router exits from overflow state.

Exiting from the overflow ● Router deletes the overflow timer.


state ● Router generates non-default routes.
● Router learns the newly received non-default
routes, and replies with an LSAck packet.
● Router prepares to enter Overflow state for the
next time it occurs.

5.2.18 OSPF Mesh-Group

Definition
In the scenario where there are multiple concurrent links, you can deploy OSPF
mesh-group to classify links into a mesh group. Then, OSPF floods LSAs to only a
link selected from the mesh group. Using OSPF mesh-group prevents unnecessary
burden on the system caused by repetitive flooding.
The mesh-group feature is disabled by default.

Purpose
After receiving or generating an LSA, an OSPF process floods the LSA. When there
are multiple concurrent links, OSPF floods the LSA to each link and sends Update
messages.
In this scenario, if there are 2000 concurrent links, OSPF floods each LSA 2000
times. Only one flooding, however, is valid. The other 1999 times are useless
repetition.
To prevent burden on the system caused by repetitive flooding, you can enable
mesh-group to classify multiple concurrent links between a router and its
neighbor into a group and then select a primary link to use for flooding.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 184


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Principles
As shown in Figure 5-21, RouterA and RouterB, which are connected through
three links, establish an OSPF neighbor relationship. After receiving a new LSA
from interface 4, RouterA floods the LSA to RouterB through interfaces 1, 2, and 3.

This flooding causes a heavy load on the concurrent links. For the neighbor with
concurrent links, only a primary link is selected to flood the LSA.

Figure 5-21 LSA flooding with OSPF mesh-group disabled

1 LSA

LSA 4 2 LSA

RouterA 3 LSA RouterB

When multiple concurrent links exist between a device enabled with OSPF mesh-
group and its neighbor, the device selects to flood the received LSAs, as shown in
Figure 5-22.

Figure 5-22 LSA flooding with OSPF mesh-group enabled

1 LSA

LSA 4 2 LSA

3 LSA
RouterA RouterB

As defined in OSPF, LSAs can be flooded to a link only when the neighbor status is
not lower than Exchange. In this case, when the status of the interface on the
primary link is lower than Exchange, OSPF reselects a primary link from the
concurrent links and then floods the LSA. After receiving the LSA flooded by
RouterA from link 1, RouterB no longer floods the LSA to RouterA through
interfaces 2 and 3.

As defined by the mesh-group feature, the Router ID of a neighbor uniquely


identifies the mesh group. Interfaces connected to the same neighbor that have a
status greater than Exchange belong to the same mesh group.

In Figure 5-23, a mesh group of RouterA resides in Area 0, which contains the
links of interface 1 and interface 2. More than one neighbor of interface 3 resides
on the broadcast link. Therefore, interface 3 cannot be defined as part of the mesh
group.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 185


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-23 Interface not added to mesh group

4 2
RouterB
RouterA
3

Area0

NOTE

After a router is enabled with mesh-group, if the Router IDs of the router and its directly
connected neighbor are the same, LSDBs cannot be synchronized and routes cannot be
calculated correctly. In this case, you need to reconfigure the Router ID of the neighbor.

5.2.19 OSPF Neighbor Relationship Flapping Suppression


OSPF neighbor relationship flapping suppression works by delaying OSPF neighbor
relationship reestablishment or setting the link cost to the maximum value
(65535).

Background
If the status of an interface carrying OSPF services alternates between Up and
Down, OSPF neighbor relationship flapping occurs on the interface. During the
flapping, OSPF frequently sends Hello packets to reestablish the neighbor
relationship, synchronizes LSDBs, and recalculates routes. In this process, a large
number of packets are exchanged, adversely affecting neighbor relationship
stability, OSPF services, and other OSPF-dependent services, such as LDP and BGP.
OSPF neighbor relationship flapping suppression can address this problem by
delaying OSPF neighbor relationship reestablishment or preventing service traffic
from passing through flapping links.

Related Concepts
Flapping_event: reported when the status of a neighbor relationship on an
interface last changes from Full to a non-Full state. The flapping_event triggers
flapping detection.

Flapping_count: number of times flapping has occurred.

Detect-interval: detection interval. The interval is used to determine whether to


trigger a valid flapping_event.

Threshold: flapping suppression threshold. When the flapping_count reaches or


exceeds threshold, flapping suppression takes effect.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 186


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Resume-interval: interval for exiting from OSPF neighbor relationship flapping


suppression. If the interval between two successive valid flapping_events is longer
than resume-interval, the flapping_count is reset.

Implementation
Flapping detection
OSPF interfaces start a flapping counter. If the interval between two
flapping_events is shorter than the detect-interval, a valid flapping_event is
recorded, and the flapping_count increases by 1. When the flapping_count exceeds
the threshold, the system determines that flapping occurs, and therefore triggers
flapping suppression, and sets the flapping_count to 0. If the interval between two
valid flapping_events is longer than the resume-interval before the flapping_count
reaches the threshold again, the system sets the flapping_count to 0 again.
Interfaces start the suppression timer when the status of a neighbor relationship
last changes to ExStart or Down.
The detect-interval, threshold, and resume-interval are configurable.
Flapping suppression
Flapping suppression works in either Hold-down or Hold-max-cost mode.
● Hold-down mode: In the case of frequent flooding and topology changes
during neighbor relationship establishment, interfaces prevent neighbor
relationships from being reestablished during the suppression period, which
minimizes LSDB synchronization attempts and packet exchanges.
● Hold-max-cost mode: If the traffic forwarding path changes frequently,
interfaces use 65535 as the cost of the flapping link during the suppression
period, which prevents traffic from passing through the flapping link.
Flapping suppression can also work first in Hold-down mode and then in Hold-
max-cost mode.
By default, the Hold-max-cost mode takes effect. The mode and suppression
period can be changed manually.

NOTE
When an interface enters the flapping suppression state, all neighbor relationships on the
interface enter the state accordingly.
Exiting from flapping suppression
Interfaces exit from flapping suppression in the following scenarios:
● The suppression timer expires.
● The corresponding OSPF process is reset.
● A command is run to exit from flapping suppression.

Typical Scenarios
Basic scenario
In Figure 5-24, the traffic forwarding path is Router A -> Router B -> Router C ->
Router E before a link failure occurs. After the link between Router B and Router C
fails, the forwarding path switches to Router A -> Router B -> Router D -> Router

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 187


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

E. If the neighbor relationship between Router B and Router C frequently flaps at


the early stage of the path switchover, the forwarding path will be switched
frequently, causing traffic loss and affecting network stability. If the neighbor
relationship flapping meets suppression conditions, flapping suppression takes
effect.
● If flapping suppression works in Hold-down mode, the neighbor relationship
between Router B and Router C is prevented from being reestablished during
the suppression period, in which traffic is forwarded along the path Router A -
> Router B -> Router D -> Router E.
● If flapping suppression works in Hold-max-cost mode, 65535 is used as the
cost of the link between Router B and Router C during the suppression period,
and traffic is forwarded along the path Router A -> Router B -> Router D ->
Router E.

Figure 5-24 Flapping suppression in a basic scenario

Router C

cost=10 cost=10

Router A Router B Router E


cost=100 cost=100

Router D

Single-forwarding path scenario


When only one forwarding path exists on the network, the flapping of the
neighbor relationship between any two devices on the path will interrupt traffic
forwarding. In Figure 5-25, the traffic forwarding path is Router A -> Router B ->
Router C -> Router E. If the neighbor relationship between Router B and Router C
flaps, and the flapping meets suppression conditions, flapping suppression takes
effect. However, if the neighbor relationship between Router B and Router C is
prevented from being reestablished, the whole network will be divided. Therefore,
Hold-max-cost mode (rather than Hold-down mode) is recommended. If flapping
suppression works in Hold-max-cost mode, 65535 is used as the cost of the link
between Router B and Router C during the suppression period. After the network
stabilizes and the suppression timer expires, the link is restored.

NOTE

By default, the Hold-max-cost mode takes effect.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 188


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-25 Flapping suppression in a single-forwarding path scenario


Router A Router E

cost=65535

Router B Router C

Broadcast scenario
In Figure 5-26, four devices are deployed on the same broadcast network using
switches, and the devices are broadcast network neighbors. If Router C flaps due
to a link failure, and Router A and Router B were deployed at different time
(Router A was deployed earlier for example) or the flapping suppression
parameters on Router A and Router B are different, Router A first detects the
flapping and suppresses Router C. Consequently, the Hello packets sent by Router
A do not carry Router C's router ID. However, Router B has not detected the
flapping yet and still considers Router C a valid node. As a result, the DR
candidates identified by Router A are Router B and Router D, whereas the DR
candidates identified by Router B are Router A, Router C, and Router D. Different
DR candidates result in a different DR election result, which may lead to route
calculation errors. To prevent this problem in scenarios where an interface has
multiple neighbors, such as on a broadcast, P2MP, or NBMA network, all
neighbors on the interface are suppressed when the status of a neighbor
relationship last changes to ExStart or Down. Specifically, if Router C flaps, Router
A, Router B, and Router D on the broadcast network are all suppressed. After the
network stabilizes and the suppression timer expires, Router A, Router B, and
Router D are restored to normal status.

Figure 5-26 Flapping suppression on a broadcast network

Router A Router B

Router C Router D

Multi-area scenario
In Figure 5-27, Router A, Router B, Router C, Router E, and Router F are
connected in area 1, and Router B, Router D, and Router E are connected in

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 189


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

backbone area 0. Traffic from Router A to Router F is preferentially forwarded


along an intra-area route, and the forwarding path is Router A -> Router B ->
Router C -> Router E -> Router F. When the neighbor relationship between Router
B and Router C flaps and the flapping meets suppression conditions, flapping
suppression takes effect in the default mode (Hold-max-cost). Consequently,
65535 is used as the cost of the link between Router B and Router C. However, the
forwarding path remains unchanged because intra-area routes take precedence
over inter-area routes during route selection according to OSPF route selection
rules. To prevent traffic loss in multi-area scenarios, configure Hold-down mode to
prevent the neighbor relationship between Router B and Router C from being
reestablished during the suppression period. During this period, traffic is forwarded
along the path Router A -> Router B -> Router D -> Router E -> Router F.

NOTE

By default, the Hold-max-cost mode takes effect. The mode can be changed to Hold-down
manually.

Figure 5-27 Flapping suppression in a multi-area scenario

Router A Router C Router F

cost=10 cost=10
Area 1

Router B Router E
Area Device B Device E
Area 0
0 cost=10 cost=10
cost=10 cost=10

Router D

Scenario with both LDP-IGP synchronization and OSPF neighbor relationship


flapping suppression configured
In Figure 5-28, if the link between PE1 and P1 fails, an LDP LSP switchover is
implemented immediately, causing the original LDP LSP to be deleted before a
new LDP LSP is established. To prevent traffic loss, LDP-IGP synchronization needs
to be configured. With LDP-IGP synchronization, 65535 is used as the cost of the
new LSP to be established. After the new LSP is established, the original cost takes
effect. Consequently, the original LSP is deleted, and LDP traffic is forwarded along
the new LSP.
LDP-IGP synchronization and OSPF neighbor relationship flapping suppression
work in either Hold-down or Hold-max-cost mode. If both functions are
configured, Hold-down mode takes precedence over Hold-max-cost mode,
followed by the configured link cost. Table 5-18 lists the suppression modes that
take effect in different situations.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 190


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Table 5-18 Principles for selecting the suppression modes that take effect in
different situations
LDP-IGP LDP-IGP LDP-IGP Exited from LDP-
Synchronization/ Synchronization Synchronization IGP
OSPF Neighbor Hold-down Mode Hold-max-cost Synchronization
Relationship Mode Suppression
Flapping
Suppression
Mode

OSPF Neighbor Hold-down Hold-down Hold-down


Relationship
Flapping
Suppression
Hold-down Mode

OSPF Neighbor Hold-down Hold-max-cost Hold-max-cost


Relationship
Flapping
Suppression
Hold-max-cost
Mode

Exited from OSPF Hold-down Hold-max-cost Exited from LDP-


Neighbor IGP
Relationship synchronization
Flapping and OSPF
Suppression neighbor
relationship
flapping
suppression

For example, the link between PE1 and P1 frequently flaps in Figure 5-28, and
both LDP-IGP synchronization and OSPF neighbor relationship flapping
suppression are configured. In this case, the suppression mode is selected based on
the preceding principles. No matter which mode (Hold-down or Hold-max-cost) is
selected, the forwarding path is PE1 -> P4 -> P3 -> PE2.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 191


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-28 Scenario with both LDP-IGP synchronization and OSPF neighbor
relationship flapping suppression configured

P1 P2

cost=10
cost=10 cost=10

CE1 PE1 PE2 CE2


cost=100 cost=100
cost=100

P4 P3

Scenario with both bit-error-triggered protection switching and OSPF


neighbor relationship flapping suppression configured
If a link has poor link quality, services transmitted along it may be adversely
affected. If bit-error-triggered protection switching is configured and the bit error
rate (BER) along a link exceeds a specified value, a bit error event is reported, and
65535 is used as the cost of the link, triggering route reselection. Consequently,
service traffic is switched to the backup link. If both bit-error-triggered protection
switching and OSPF neighbor relationship flapping suppression are configured,
they both take effect. Hold-down mode takes precedence over Hold-max-cost
mode, followed by the configured link cost.

5.3 Application Scenarios for OSPF

5.3.1 OSPF GR
NOTE
In practical application, in order to realize that business forwarding is not affected by
motherboard failure, it is usually possible to configure OSPF GR in the hardware
environment of dual motherboard to make sense.
All the models support the GR Helper, and only AR3200 series support the GR Restarter.

In Figure 5-29, RouterA, RouterB, RouterC, and RouterD run OSPF for
interworking, and RouterA and RouterB are enabled with GR. When RouterA
restarts, RouterB helps RouterA perform GR, without notifying other neighbors of
RouterA. OSPF GR ensures non-interrupted network traffic.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 192


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-29 OSPF GR

es
B do ter RouterC
r ou
o ute tify R ter A
R no u
Set up neighbor t Ro s
no that tart
relationship C res
RouterA and negotiate RouterB
GR

Restarter Helper Rou


not ter B d RouterD
Restart if y R oes
Rou ou n
ter ter D ot
A re tha
star t
ts

5.3.2 OSPF GTSM


As shown in Figure 5-30, OSPF runs between Routers, and GTSM is enabled on
RouterC. The following are the valid TTL ranges of the packets that are sent from
Routers to RouterC:

● RouterA and RouterE are the neighbors of RouterC, and their valid TTL range
of packets is [255 - hops + 1, 255].
● The valid TTL ranges of the packets sent from RouterB, RouterD, and RouterF
to RouterC are respectively [254, 255], [253, 255], and [252, 255].

Figure 5-30 OSPF GTSM

Area0
RouterA RouterB
POS1/0/0 POS1/0/0
192.168.0.1/24 192.168.0.2/24

POS2/0/0 POS2/0/0
192.168.1.1/24 192.168.2.1/24
POS1/0/0 POS1/0/0
192.168.1.2/24 192.168.2.2/24
RouterC RouterD
GE2/0/0 GE2/0/0
172.16.1.1/24 172.17.1.1/24
GE2/0/0 GE2/0/0
172.16.1.2/24 172.17.1.2/24
RouterE RouterF

Area1 PC Area2

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 193


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.4 Summary of OSPF Configuration Tasks


After basic OSPF functions are configured, you can build a basic OSPF network.
On the basic OSPF network, you can configure other OSPF functions as required.
Table 5-19 describes the OSPF configuration tasks.

Table 5-19 OSPF configuration tasks


Scenario Description Task

Configuring Basic OSPF The configuration of 5.7 Configuring Basic


Functions basic OSPF functions is OSPF Functions
the foundation of the 5.8 Setting Session
OSPF network and the Parameters for OSPF
precondition for other Neighbor
OSPF functions. Relationships
5.9 Configuring OSPF
Attributes in
Different Types of
Networks

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 194


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Scenario Description Task

Configuring OSPF Areas ● In a stub area, the 5.10 Configuring


area border router OSPF Stub Areas
(ABR) does not 5.11 Configuring
transmit learned OSPF NSSA
autonomous
system (AS)
external routes.
This
implementation
reduces entries in
the routing tables
on ABRs in stub
areas and the
amount of routing
information to be
transmitted.
● An NSSA is a new
type of OSPF area.
Neither the NSSA
nor the stub area
transmits routes
learned from other
areas in the AS on
which it resides.
Different from the
stub area, the NSSA
allows AS external
routes to be
imported and
forwarded in the
entire AS.

Adjusting OSPF Route To meet various user 5.12 Adjusting OSPF


Selection requirements, you can Route Selection
adjust OSPF
parameters to flexibly
control OSPF routing.

Controlling OSPF Routing To meet network 5.13 Controlling OSPF


Information requirements, you can Routing Information
configure different
parameters to
accurately control the
advertising and
receiving of OSPF
routes.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 195


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Scenario Description Task

Controlling the Convergence To enable OSPF to 5.16 Configuring


Speed of OSPF Routes quickly detect changes OSPF Fast
in the network Convergence
topology, you can
speed up OSPF route
convergence. To
decrease the impact of
route flapping on the
network and relieve
loads on devices, you
can lower the
convergence speed of
OSPF routes.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 196


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Scenario Description Task

Improving the Reliability of ● OSPF IP FRR pre- 5.14 Configuring


an OSPF Network computes a backup OSPF IP FRR
link by using the 5.15 Configuring BFD
Loop-Free Alternate for OSPF
(LFA) algorithm,
and then adds the 5.17 Configuring
backup link and the OSPF GR
primary link to the
forwarding table. In
the case of failures,
OSPF IP FRR can
fast switch traffic to
the backup link
before routes on
the control plane
converge. This
prevents traffic
interruption,
protects traffic, and
improves reliability
of an OSPF
network.
● By default, the
interval for OSPF to
send Hello packets
is 10 seconds on
broadcast networks;
on NBMA networks,
the interval for
sending Hello
packets is 30
seconds. The
interval for
declaring a
neighbor Down,
that is, the dead
time after which
the neighbor
relationship
becomes invalid, is
four times the
interval for sending
Hello packets. If the
router does not
receive a Hello
packet from its
neighbor within the
dead time, the
router deletes the
neighbor. That is,

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 197


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Scenario Description Task

the router detects


neighbor faults at
the second level.
This causes a large
number of packets
to be lost on a
high-speed
network.
Bidirectional
Forwarding
Detection (BFD) is
introduced to solve
the preceding
problem in the
existing detection
mechanism. BFD
ensures that the
detection interval is
reduced to the
millisecond level.
Instead of replacing
the Hello
mechanism of
OSPF, BFD works
with OSPF to fast
detect the
adjacency fault. In
addition, BFD
instructs OSPF to
recalculate
corresponding
routes to ensure
correct packet
forwarding.
● When a router
restarts or performs
an active/standby
switchover, it
directly ages all
routing entries in
the Forward
Information Base
(FIB) table. This
results in route
interruption. In
addition,
neighboring routers
remove this router
from the neighbor

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 198


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Scenario Description Task

list, and notify


other routers. This
causes the re-
calculation of SPF. If
this router recovers
within a few
seconds, the
neighbor
relationship
becomes unstable.
This results in route
flapping.
After being enabled
with OSPF Graceful
Restart (GR), a
router can ensure
continuous packet
forwarding in the
event of a restart
caused by an
abnormality. In
such a case, route
flapping is avoided
during the short
restart of the
router.

Improving the Stability of an You can improve the 5.18 Improving the
OSPF Network stability of the OSPF Stability of an OSPF
network to reduce Network
route flapping on the
OSPF network and
enable the device to
work in a normal state
for a long time.

Improving the Security of an In a network 5.19 Improving the


OSPF Network demanding high Security of an OSPF
security, you can Network
configure OSPF
authentication and
adopt the GTSM
mechanism to improve
the security of the
OSPF network.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 199


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.5 Licensing Requirements and Limitations for OSPF


Involved Network Elements
None

Licensing Requirements
OSPF is a basic feature of a router and is not under license control.

Feature Limitations
None

5.6 Default Settings for OSPF


Table 5-20 describes the default settings for OSPF.

Table 5-20 Default settings for OSPF


Parameter Default Setting

OSPF Disabled

Interval for sending Hello By default, the interval for sending Hello packets
packets is 10 seconds on P2P and broadcast interfaces;
the interval is 30 seconds on P2MP and NBMA
interfaces.

Dead interval for OSPF By default, the dead interval for OSPF neighbors
neighbors is 40 seconds on P2P and broadcast interfaces;
the interval is 120 seconds on P2MP and NBMA
interfaces.

Period during which a 500 seconds


device continues to act as a
stub router

Bandwidth reference value 100 Mbit/s


used to calculate the link
cost

5.7 Configuring Basic OSPF Functions


Before building OSPF networks, you need to configure basic OSPF functions.

Applicable Environment
When OSPF is configured on multiple routers in the same area, most
configuration data, such as the timer, filter, and aggregation, must be planned

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 200


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

uniformly in the area. Incorrect configurations may cause neighboring routers to


fail to send messages to each other or even causing routing information
congestion and self-loops.

The OSPF-relevant commands that are configured in the interface view take effect
regardless of whether OSPF is enabled. After OSPF is disabled, the OSPF-relevant
commands also exist on interfaces.

Pre-configuration Tasks
Before configuring basic OSPF functions, complete the following task:

● Configuring IP addresses for interfaces to ensure that neighboring nodes are


reachable at the network layer

5.7.1 Creating an OSPF Process

Context
To run OSPF, the router needs to have a router ID. A router ID of the router is a
32-bit unsigned integer, which uniquely identifies the router in an AS. To ensure
the stability of OSPF, you need to manually configure a router ID for each device
during network planning.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] *

An OSPF process is created, and the OSPF view is displayed.

● The parameter process-id specifies the ID of an OSPF process. The default


value is 1.
The router supports OSPF multi-process. You can create different processes for
different types of service. The OSPF process ID is valid in the local area,
without affecting packet exchange with other routers. Therefore, different
routers can also exchange packets even though they have different process
IDs.
● The parameter router-id router-id specifies the router ID of the router.
By default, the system automatically selects an IP address of the interface as
the router ID. The largest IP address in loopback addresses is taken as the
router ID. If no loopback interface is configured, the largest IP address
configured on the interface is selected as the router ID. When manually
setting a router ID, ensure that the router ID of each device in an AS is
unique. Generally, you can set the router ID to be the same as the IP address
of a certain interface on the device.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 201


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE
The router ID of each OSPF process must be unique on the OSPF network; otherwise,
the OSPF neighbor relationship cannot be set up and routing information is incorrect.
Configuring a unique router ID for each OSPF process on each OSPF device is
recommended to ensure stability.
● The parameter vpn-instance vpn-instance-name specifies the name of a VPN
instance.
If a VPN instance is specified, the OSPF process belongs to the specified VPN
instance. Otherwise, the OSPF process belongs to the public network
instances.
----End

5.7.2 Creating an OSPF Area

Context
More and more devices are deployed with the increasing expansion of the network
scale. As a result, each device has to maintain a large LSDB, which becomes a
heavy burden. OSPF solves this problem by dividing an AS into areas. An area is
regarded as a logical device group. Each group is identified by an area ID. The
borders of an area are devices, rather than links. A network segment (or a link)
belongs to only one area; that is, each OSPF interface must belong to an area.

Procedure
Step 1 Run system-view
The system view is displayed.

Step 2 Run ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] *

The OSPF process is enabled, and the OSPF view is displayed.


Step 3 Run area area-id
The OSPF area view is displayed.
Areas are not equally important. The area with an area ID 0 is called the backbone
area. The backbone area is responsible for forwarding inter-area routing
information. In addition, routing information between non-backbone areas must
be forwarded through the backbone area.
----End

5.7.3 Enabling OSPF

Context
After creating an OSPF process, you need to configure the network segments
included in an area. A network segment belongs to only one area. That is, you
need to specify an area for each interface that runs OSPF. In this document,
network segment refers to the network segment to which the IP address of the
OSPF interface belongs.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 202


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

OSPF checks the network mask carried in a received Hello packets. If the network
mask carried in a received Hello packet is different from the network mask of the
local device, the Hello packet is discarded. As a result, an OSPF neighbor
relationship is not established.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run area area-idnetwork ip-address wildcard-maskinterface interface-type
interface-numberospf enable [ process-id ] area area-id
The OSPF area view is displayed.
OSPF can be enabled in an OSPF area or on a specific interface.
● Enable OSPF in an OSPF area.
1. Run
Network segments belonging to an area are configured.
OSPF can properly run on an interface only when the following conditions are
met:
– The IP address mask length of the interface is equal to or greater than
the mask length specified in the network command.
– The primary IP address of the interface must be within the network
segment specified by the network command.
By default, OSPF advertises the IP address of the loopback interface as a 32-
bit host route, which is irrelevant to the mask length configured on the
loopback interface. To advertise routes to the network segment of the
loopback interface, configure the network type as NBMA or broadcast in the
interface view. For details, see Configuring Network Types of OSPF
Interfaces.
● Enable OSPF on an interface.
1. Run the following command in the system view:interface interface-type
interface-number
The interface view is displayed.
2. Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
An area ID can be input in the format of a decimal integer or an IPv4 address,
but displayed in the format of IPv4 address.

----End

5.7.4 (Optional) Creating OSPF Virtual Links

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 203


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Context
After OSPF areas are defined, OSPF route updates between non-backbone areas
are transmitted through a backbone area. Therefore, OSPF requires that all non-
backbone areas maintain connectivity with the backbone area and that the
backbone areas in different OSPF areas maintain connectivity with each other. In
real world situations, this requirement may not be met because of certain
restrictions. To resolve this problem, you can configure OSPF virtual links.

Perform the following steps on the router running OSPF.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run area area-id

The OSPF area view is displayed.

Step 4 Run vlink-peer router-id [ smart-discover | hello hello-interval | retransmit


retransmit-interval | trans-delay trans-delay-interval | dead dead-interval |
[ simple [ plain plain-text | [ cipher ] cipher-text ] | { md5 | hmac-md5 | hmac-
sha256 } [ key-id { plain plain-text | [ cipher ] cipher-text } ] | authentication-
null | keychain keychain-name ] ] *

A virtual link is created.

This command must also be configured on the neighboring router.

NOTICE

If plain is selected, the password is saved in the configuration file in plain text.
This brings security risks. It is recommended that you select cipher to save the
password in cipher text.
MD5 authentication and HMAC-MD5 authentication have potential security risks.
HMAC-SHA256 authentication mode is recommended.

----End

Follow-up Procedure
After virtual links are created, different default MTUs may be used on devices
provided by different vendors. To ensure consistency, the MTU is set to 0 by
default when the interface sends DD packets. For details, see Configuring an
Interface to Fill in the DD Packet with the Actual MTU.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 204


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.7.5 (Optional) Restricting the Flooding of LSA Update


Packets

Context
When multiple neighboring routers are configured or a large number of LSA
update packets are flooded, the neighboring router may receive a large number of
LSA update packets in a short period. This keeps the neighboring router busy
processing a burst of LSA update packets and causes the neighboring router to
discard Hello packets that are used to maintain the OSPF neighbor relationships.
As a result, the neighbor relationships are interrupted. After the neighbor
relationships are reestablished, more packets will be exchanged. This increases the
frequency of neighbor relationship interruption. To resolve this problem, you can
restrict the flooding of LSA update packets to maintain neighbor relationships.
Perform the following steps on the router running OSPF.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run flooding-control [ number transmit-number | timer-interval transmit-
interval ] *
The flooding of LSA update packets is restricted.
By default, the number of LSA update packets to be flooded each time is 50, and
the interval at which LSA update packets are flooded is 30s.
After the flooding-control command is run, the flooding of LSA update packets is
immediately restricted.
If the flooding-control command is not run, the function of restricting the
flooding of LSA update packets automatically takes effect when the number of
neighboring routers exceeds 256.

----End

5.7.6 Verifying the Basic OSPF Function Configuration

Prerequisites
All configurations of basic OSPF functions are complete.

Procedure
● Run the display ospf [ process-id ] peer command in any view to check
information about OSPF neighbors.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 205


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Run the display ospf [ process-id ] interface command in any view to check
information about OSPF interfaces.
● Run the display ospf [ process-id ] routing command in any view to check
information about the OSPF routing table.
● Run the display ospf [ process-id ] lsdb command to check information in
the OSPF LSDB.

----End

5.8 Setting Session Parameters for OSPF Neighbor


Relationships
On an OSPF network, all routing information is transmitted and exchanged
between neighboring or adjacent devices. Maintaining neighbor relationships or
adjacencies helps improve stability on the entire network.

Pre-configuration Tasks
Before configuring session parameters for OSPF neighbor or adjacency
relationships, complete the following tasks:

● Configuring a link layer protocol


● Configuring IP addresses for interfaces to ensure that neighboring nodes are
reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure
Perform one or more of the following configuration tasks (excluding the task of
Verifying the OSPF Session Parameter Configuration) as required.

5.8.1 Setting the OSPF Packet Retransmission Limit

Context
After an OSPF router sends one of the following packets, if it does not receive the
LSAck packet within a specified time, it retransmits the packet. After the number
of packet retransmissions reaches the set limit, the OSPF router tears down the
adjacency relationship with its neighbor.
● DD packets
● LSU packets
● LSR packets

Procedure
Step 1 Run system-view

The system view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 206


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 2 Run ospf [ process-id ]


The OSPF view is displayed.
Step 3 Run retransmission-limit [ max-number ]
The OSPF packet retransmission limit is set.
By default, the OSPF packet retransmission limit is not set. The default maximum
number of packet retransmissions is 30.

----End

5.8.2 Configuring an Interface to Fill in DD Packets with the


Actual MTU

Context
After virtual links are created, different default MTUs may be used on devices
provided by different vendors. To ensure consistency, the MTU is set to 0 by
default when the interface sends DD packets.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The OSPF interface view is displayed.
Step 3 Run ospf mtu-enable
The interface is configured to fill in DD packets with the actual MTU and check
whether the MTU in DD packets from the neighbor exceeds the MTU of the local
end.
By default, the MTU in DD packets sent by an interface is 0.

NOTICE

Setting the MTU in a DD packet will lead to the re-establishment of the neighbor
relationship.

----End

5.8.3 Verifying the OSPF Session Parameter Configuration

Prerequisites
All configurations of session parameters of the OSPF neighbor or adjacency
relationship are complete.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 207


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
● Run the display ospf [ process-id ] peer command to check information
about OSPF neighbors.
● Run the display ospf [ process-id ] brief command to check brief information
about the specified OSPF process.
● Run the display ospf [ process-id ] retrans-queue [ interface-type interface-
number ] [ neighbor-id ] [ low-level-of-retrans-times-range min-time ]
[ high-level-of-retrans-times-range max-time ] command to check the
OSPF retransmission list.

----End

5.9 Configuring OSPF Attributes in Different Types of


Networks
By setting network types for OSPF interfaces and adjusting OSPF attributes, you
can flexibly build OSPF networks.

Applicable Environment
In Table 5-21, OSPF classifies networks into four types based on the type of link
layer protocols.

NOTE

Differentiated OSPF configurations that are applicable only to NBMA networks and P2MP
networks are provided in this section. The OSPF configurations not provided here are
applicable to the four types of networks.

Table 5-21 Network types supported by OSPF

Network Type Characteristic Default Configuration

Broadcast On the broadcast network, If the link layer protocol is


Hello packets, LSU packets, Ethernet or Fiber Distributed
and LSAck packets are Data Interface (FDDI), OSPF
multicasted; DD packets and regards the network as a
LSR packets are unicasted. broadcast network by
default.

Non-broadcast On an NBMA network, Hello If the link layer protocol is


multiple access packets, DD packets, LSR ATM, OSPF regards the
(NBMA) packets, LSU packets, and network as an NBMA
LSAck packets are unicasted. network by default.
The NBMA network must be
fully meshed. Any two
routers on the NBMA
network must be directly
reachable.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 208


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Network Type Characteristic Default Configuration

Point-to-point On a P2P network, Hello If the link layer protocol is


(P2P) packets, DD packets, LSR PPP, HDLC, or Link Access
packets, LSU packets, and Procedure Balanced (LAPB),
LSAck packets are OSPF regards the network as
multicasted. a P2P network by default.

Point-to- On a P2MP network, Hello OSPF does not regard a


multipoint packets are multicasted; DD network as a P2MP network
(P2MP) packets, LSR packets, LSU by default regardless of any
packets, and LSAck packets link layer protocol. A P2MP
are unicasted. network is forcibly changed
from the network of another
type.

As described in Table 5-21, the difference between OSPF configurations on


networks of different types lies in the packet transmission mode.

Pre-configuration Tasks
Before configuring OSPF attributes in different types of networks, complete the
following tasks:

● Configuring IP addresses for interfaces to ensure that neighboring nodes are


reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure
Configuring network types of OSPF interfaces is the prerequisite for configuring
P2MP or NBMA network attributes

5.9.1 Configuring Network Types of OSPF Interfaces


Context
By default, the physical interface type determines the network type.

● The network type of an Ethernet interface is broadcast.


● The network type of a serial interface running PPP or HDLC is P2P.
● The network type of an ATM interface or a frame relay (FR) interface is
NBMA.
NOTE

● A P2MP network is forcibly changed from another other type of network.


● AR100&AR120&AR150&AR160&AR200 series do not support frame-relay interface.

The network types of the interfaces on both ends of a link must be the same;
otherwise, the OSPF neighbor relationship cannot be established.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 209


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The OSPF interface view is displayed.
Step 3 Run ospf network-type { broadcast | nbma | p2mp | p2p [ peer-ip-ignore ] }
The network type of the OSPF interface is configured.
By default, the network type of an interface depends on the physical interface.
The network type of an Ethernet interface is broadcast; the network type of a
serial or POS interface (encapsulated with PPP or HDLC) is P2P; the network type
of an ATM and FR interface is NBMA.
When the network type is configured for an interface, the original network type of
the interface is replaced.
The network type can be configured to suit networking requirements.
● If the network type of an interface is broadcast and a router does not support
multicast addresses, change the network type of the interface to NBMA.
● If the network type of an interface is NBMA and the network is fully meshed
or any two routers are directly connected, change the network type of the
interface to broadcast and do not configure neighboring router information
on the interface.
● If the network type of an interface is NBMA and the network is not fully
meshed, change the network type of the interface to P2MP. After that, two
indirectly connected routers can communicate through one router that can
directly reach both the two routers. After the network type of the interface is
changed to P2MP, configuring neighboring router information on the interface
is unnecessary.
● If only two routers run OSPF on the same network segment, changing the
network type of the interface to P2P is recommended.
NOTE
OSPF cannot be configured on a null interface.

----End

5.9.2 Configuring P2MP Network Attributes

Procedure
Step 1 Disable OSPF from checking the network mask.
1. Run system-view
The system view is displayed.
2. Run interface interface-type interface-number
The interface view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 210


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

3. Run ospf network-type p2mp


The network type of the OSPF interface is configured.
A P2MP network is forcibly changed from another type of network. For
details, see Configuring Network Types for OSPF Interfaces.
4. Run ospf p2mp-mask-ignore
OSPF is disabled from checking the network mask on the P2MP network.
Step 2 Configure the router to filter the LSA packets to be sent.
When multiple links exist between two routers, you can configure the local router
to filter the LSA packets to be sent. This can reduce unnecessary LSA
retransmission attempts and save bandwidth resources.
1. Run quit
Exit from the interface view.
2. Run ospf [ process-id ]
The OSPF process view is displayed.
3. Run filter-lsa-out peer ip-address { all | { summary [ acl { acl-number | acl-
name } ] | ase [ acl { acl-number | acl-name } ] | nssa [ acl { acl-number |
acl-name } ] } * }
The local router is configured to filter the LSA packets to be sent on the P2MP
network.
By default, the LSA packets to be sent are not filtered.

----End

5.9.3 Configuring NBMA Network Attributes

Procedure
Step 1 (Optional) Set the network type to NBMA.
An NBMA network must be fully meshed. Any two routers on the NBMA network
must be directly reachable. In most cases, however, this requirement cannot be
met. To resolve this problem, run specific commands to forcibly change the
network type to NBMA. For details, see Configuring Network Types for OSPF
Interfaces.
1. Run system-view
The system view is displayed.
2. Run interface interface-type interface-number
The interface view is displayed.
3. Run ospf network-type nbma
The network type of the OSPF interface is set to NBMA.
Step 2 (Optional) Set the interval at which Hello packets for polling are sent on the
NBMA network.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 211


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

On the NBMA network, after the neighbor relationship becomes invalid, the router
sends Hello packets at an interval defined in the polling mechanism.

1. Run ospf timer poll interval

The interval at which Hello packets for polling are sent by an NBMA interface
is set.

The default value is 120, in seconds.

Step 3 Configure a neighboring router on the NBMA network.

If the network type of an interface is NBMA, the interface cannot broadcast Hello
packets to discover neighboring routers. Therefore, the IP address of a neighboring
router must be configured on the interface and whether the neighboring router
can participate in DR election must be determined on the interface.

1. Run quit

Exit from the interface view.


2. Run ospf [ process-id ]

The OSPF process view is displayed.


3. Run peer ip-address [ dr-priority priority ]

A neighboring router is configured on the NBMA network.

----End

5.9.4 Verifying the OSPF Attribute Configuration

Prerequisites
The configurations for OSPF attributes on the NBMA network and P2MP network
are complete.

Procedure
● Run either of the following commands to check LSDB information.
– display ospf [ process-id ] lsdb [ brief ]
– display ospf [ process-id ] lsdb [ { router | network | summary | asbr |
ase | nssa | opaque-link | opaque-area | opaque-as } [ link-state-id ] ]
[ originate-router [ advertising-router-id ] | self-originate ] [ age { min-
value min-age-value | max-value max-age-value } * ]
● Run the display ospf [ process-id ] peer [ [ interface-type interface-number ]
neighbor-id | brief | last-nbr-down ] command to view neighbor information.
● Run the display ospf [ process-id ] nexthop command to check next hop
information.
● Run either of the following commands to check routing table information.
– display ospf [ process-id ] routing [ ip-address [ mask | mask-length ] ]
[ interface interface-type interface-number ] [ nexthop nexthop-
address ]
– display ospf [ process-id ] routing router-id [ router-id ]

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 212


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Run the display ospf [ process-id ] interface [ all | interface-type interface-


number ] [ verbose ] command to check interface information.
----End

5.10 Configuring OSPF Stub Areas


By configuring non-backbone areas at the edge of ASs as stub areas, you can
reduce the size of the routing table and number of LSAs to be transmitted.

Applicable Environment
The number of LSAs can be reduced by partitioning an AS into different areas. To
reduce the number of entries in the routing table and the number of LSAs to be
transmitted in a non-backbone area, configure the non-backbone area on the
border of the AS as a stub area.
Configuring a stub area is optional.
Note the following points when configuring a stub area:
● The backbone area (Area 0) cannot be configured as a stub area.
● If an area needs to be configured as a stub area, all the routers in this area
must be configured with stub attributes using the stub command.
● An ASBR cannot exist in a stub area. External routes are not transmitted in
the stub area.
● Virtual links cannot exist in the stub area.

Pre-configuration Tasks
Before configuring OSPF stub areas, complete the following tasks:
● Configuring IP addresses for interfaces to ensure that neighboring nodes are
reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure

Figure 5-31 Flowchart of configuring OSPF stub areas

Configure OSPF stub areas

Configure metrics of default


routes sent to stub areas

Mandatory
procedure
Optional
procedure

5.10.1 Defining the Current Area as a Stub Area

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 213


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run area area-id
The OSPF area view is displayed.

Step 4 Run stub [ no-summary | default-route-advertise backbone-peer-ignore ] *

The specified area is configured as a stub area.


● The parameter no-summary is used to forbid the ABR to send Type 3 LSAs to
the stub area.
● The parameter default-route-advertise is used to enable the ABR to
generate default Type 3 LSAs and advertise them to the stub area.
● The parameter backbone-peer-ignore is used to prevent the ABR from
checking the neighbor status when the ABR generates default Type 3 LSAs
and advertises them to the stub area. Specifically, the ABR generates default
Type 3 LSAs and advertises them to the stub area as long as an interface that
is Up exist in the backbone area.
NOTE

● Stub attributes must be configured on all routers in a stub area using the stub
command.
● Configuring or deleting stub attributes will update routing information in the area. Stub
attributes can be deleted or reconfigured only after the routing update is complete.

----End

5.10.2 (Optional) Configuring Metrics of Default Routes Sent


to Stub Areas

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run area area-id
The OSPF area view is displayed.

Step 4 Run stub [ no-summary | default-route-advertise backbone-peer-ignore ] *

The specified area is configured as a stub area.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 214


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● The parameter no-summary is used to forbid the ABR to send Type 3 LSAs to
the stub area.
● The parameter default-route-advertise is used to enable the ABR to
generate default Type 3 LSAs and advertise them to the stub area.
● The parameter backbone-peer-ignore is used to prevent the ABR from
checking the neighbor status when the ABR generates default Type 3 LSAs
and advertises them to the stub area. Specifically, the ABR generates default
Type 3 LSAs and advertises them to the stub area as long as an interface that
is Up exist in the backbone area.
NOTE

● Stub attributes must be configured on all routers in a stub area using the stub
command.
● Configuring or deleting stub attributes will update routing information in the area. Stub
attributes can be deleted or reconfigured only after the routing update is complete.

Step 5 (Optional) Run stub [ no-summary ]


The specified area is configured as a stub area.
The parameter no-summary is used to forbid the ABR to send Type 3 LSAs to the
stub area.

NOTE

● Stub attributes must be configured on all routers in a stub area using the stub
command.
● Configuring or deleting stub attributes will update routing information in the area. Stub
attributes can be deleted or reconfigured only after the routing update is complete.

Step 6 Run default-cost cost


The cost of the default route to the stub area is set.
The parameter cost specifies the cost of the Type 3 default route to a stub area.
The default value is 1.
To ensure the reachability of AS external routes, the ABR in the stub area
generates a default route and advertises the route to the non-ABR routers in the
stub area.

----End

5.10.3 Verifying the OSPF Stub Area Configuration

Procedure
Run either of the following commands to check LSDB information.
● display ospf [ process-id ] lsdb [ brief ]
● display ospf [ process-id ] lsdb [ { router | network | summary | asbr | ase |
nssa | opaque-link | opaque-area | opaque-as } [ link-state-id ] ]
[ originate-router [ advertising-router-id ] | self-originate ] [ age { min-
value min-age-value | max-value max-age-value } * ]
Run either of the following commands to check routing table information.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 215


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● display ospf [ process-id ] routing [ ip-address [ mask | mask-length ] ]


[ interface interface-type interface-number ] [ nexthop nexthop-address ]
● display ospf [ process-id ] routing router-id [ router-id ]
Run the display ospf [ process-id ] abr-asbr [ router-id ] command to check ASBR
and ABR information.

5.11 Configuring OSPF NSSA


Configuring a non-backbone area on the border of an autonomous system (AS) as
a not-so-stubby area (NSSA) can reduce entries in the routing table and the
amount of routing information to be transmitted.

Applicable Environment
To both import external routes and prevent resource consumption caused by
external routes, you can configure an NSSA.
The NSSA is a special type of OSPF area. Neither an NSSA nor a stub area
transmits routes learned from other areas in the AS where it resides. A stub area
does not allow AS external routes to be imported, whereas an NSSA allows AS
external routes to be imported and advertised in the entire AS.
Type 7 LSAs are used to carry imported AS external routing information in the
NSSA. Type 7 LSAs are generated by the ASBRs of NSSAs and flooded only in the
NSSAs where ASBRs reside. The ABR in an NSSA selectively translates received
Type 7 LSAs into Type 5 LSAs to advertise AS external routing information to the
other areas over the OSPF network.

Pre-configuration Tasks
Before configuring an NSSA, complete the following tasks:
● Configuring IP addresses for interfaces to ensure that neighboring routers are
reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run area area-id
The OSPF area view is displayed.
Step 4 Run nssa [ { default-route-advertise [ backbone-peer-ignore ] | suppress-
default-route } | flush-waiting-timer interval-value | no-import-route | no-
summary | set-n-bit | suppress-forwarding-address | translator-always |
translator-interval interval-value | zero-address-forwarding | translator-strict ]*

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 216


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

The specified area is configured as an NSSA.

NOTE

● NSSA attributes must be configured on all devices in the NSSA using the nssa
command.
● Configuring or deleting NSSA attributes may update the routing information in the area
and disconnect neighbor relationships. NSSA attributes can be reconfigured or deleted
only after the routing update is complete.

The nssa command is applicable to the following scenarios:


● The default-route-advertise parameter is configured to advertise Type 7
LSAs carrying the default route on the ASBR to the NSSA.
Regardless of whether the default route 0.0.0.0/0 exists in the routing table
on the ABR, Type 7 LSAs carrying the default route will be generated.
However, Type 7 LSAs carrying the default route will be generated on the
ASBR only when the default route 0.0.0.0/0 exists in the routing table.
● The parameter backbone-peer-ignore is used to prevent the ABR from
checking the neighbor status when the ABR generates default Type 7 LSAs
and advertises them to the NSSA. Specifically, the ABR generates default Type
7 LSAs and advertises them to the NSSA as long as an interface that is Up
exist in the backbone area.
● When the area to which the ASBR belongs is configured as an NSSA, invalid
Type 5 LSAs from other routers in the area where LSAs are flooded will be
reserved. These LSAs will be deleted only when the aging time reaches 3600s.
The router performance is affected because the forwarding of a large number
of LSAs consumes memory resources. To resolve such a problem, you can set
the parameter flush-waiting-timer to the maximum value 3600s for Type 5
LSAs so that the invalid Type 5 LSAs from other routers can be deleted in
time.
NOTE

– When the LS age field value (aging time) in the header of an LSA reaches 3600s,
the LSA is deleted.
– If an ASBR also functions as an ABR, flush-waiting-timer does not take effect.
This prevents Type 5 LSAs in the non-NSSAs from being deleted.
● If an ASBR also functions as an ABR, the no-import-route parameter can be
configured to prevent external routes imported using the import-route
command from being advertised to the NSSA.
● The no-summary parameter is configured on an ABR to reduce the number
of LSAs that are transmitted to the NSSA. This implementation prevents the
ABR from transmitting Type 3 LSAs to the NSSA.
NOTE
After the nssa default-route-advertise backbone-peer-ignore no-summary
command is run, the ABR generates default Type 7 and Type 3 LSAs as long as an
interface that is Up exist in the backbone area. The default Type 3 LSAs preferentially
take effect.
● After the set-n-bit parameter is configured, the N-bit is set in the database
description (DD) packets during the synchronization between the router and
neighboring routers.
● If multiple ABRs are deployed in the NSSA, the system automatically selects
an ABR (generally the router with the largest router ID) as a translator to

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 217


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

convert Type 7 LSAs into Type 5 LSAs. You can configure the translator-
always parameter on an ABR to specify the ABR as an all-the-time translator.
To specify two ABRs for load balancing, configure the translator-always
parameter on the chosen ABRs to specify the ABRs as all-the-time translators.
You can use this command to pre-configure a fixed translator to prevent LSA
flooding caused by translator role changes.
● The translator-interval parameter is used to ensure uninterrupted services
when translator roles change. The value of interval-value must be greater
than the flooding period.

Step 5 (Optional) Run default-cost cost

The cost of the default route on which Type 3 LSAs are transmitted to the NSSA by
the ABR is set.

To ensure the reachability of AS external routes, the ABR in the NSSA generates a
default route and advertises this route to the other routers in the NSSA. The cost
of the default route to an NSSA is set and the selection of the default route is
adjusted.

Type 7 LSAs can be used to carry default route information to guide traffic to
other ASs.

Multiple ABRs may be deployed in an NSSA. To prevent routing loops, ABRs do not
calculate the default routes advertised by each other.

By default, the cost of the default route to the NSSA by the ABR is 1.

----End

Verifying the Configuration

Run either of the following commands to check LSDB information:

● display ospf [ process-id ] lsdb [ brief ]


● display ospf [ process-id ] lsdb [ { router | network | summary | asbr | ase |
nssa | opaque-link | opaque-area | opaque-as } [ link-state-id ] ]
[ originate-router [ advertising-router-id ] | self-originate ] [ age { min-
value min-age-value | max-value max-age-value } * ]

Run either of the following commands to check routing table information:

● display ospf [ process-id ] routing [ ip-address [ mask | mask-length ] ]


[ interface interface-type interface-number ] [ nexthop nexthop-address ]
● display ospf [ process-id ] routing router-id [ router-id ]

Run the display ospf [ process-id ] interface [ all | interface-type interface-


number ] [ verbose ] command to check OSPF interface information.

5.12 Adjusting OSPF Route Selection

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 218


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Applicable Environment
On complex networks, you can adjust OSPF parameters to flexibly optimize load
balancing requirements.

Pre-configuration Tasks
Before adjusting OSPF route selection, complete the following tasks:
● Configuring IP addresses for interfaces to ensure that neighboring nodes are
reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure
Perform one or more configuration tasks (excluding the task of Verifying the OSPF
Route Selection Adjustment Configuration) as required.

5.12.1 Setting the Link Cost for an OSPF Interface

Context
OSPF can automatically calculate the link cost for an interface according to the
interface bandwidth. You can also set the link cost for the interface using
commands.
If you do not set the cost of an OSPF interface using the ospf cost cost command,
OSPF automatically calculates the cost of the interface according to the interface
bandwidth. The calculation formula is as follows: Cost of the interface =
Bandwidth reference value/Interface bandwidth. The integer of the calculated
result is the cost of the interface. If the calculated result is smaller than 1, the cost
value is 1. Changing the bandwidth reference value can change the cost of an
interface.

Procedure
● Setting the link cost for an OSPF interface
a. Run system-view
The system view is displayed.
b. Run interface interface-type interface-number
The OSPF interface view is displayed.
c. Run ospf cost cost
The cost of the OSPF interface is set.
● Setting the bandwidth reference value
a. Run system-view
The system view is displayed.
b. Run ospf [ process-id ]
The OSPF process view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 219


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

c. Run bandwidth-reference value


The bandwidth reference value is set.
The parameter value specifies the bandwidth reference value used to
calculate the link cost, in Mbit/s.

NOTE

Ensure that the bandwidth reference values of routers in an OSPF process are the
same.

----End

5.12.2 Configuring Equal-Cost Routes

Context
If the destinations and costs of the multiple routes discovered by one routing
protocol are the same, load balancing can be implemented among the routes.
As shown in Figure 5-32, three routes between RouterA and RouterB that run
OSPF have the same costs. The three routes are equal-cost routes for load
balancing.

Figure 5-32 Networking diagram of equal-cost routes

IP
Network
co
5 st=
st= 10
co

cost=10 IP cost=5
Network
RouterA
RouterB
co
st =8 =7
st
IP co
Network

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run maximum load-balancing number
The maximum number of equal-cost routes is set.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 220


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE

By default, the AR100&AR120&AR150&AR160&AR200 series, AR1200 series, AR2201-48FE,


AR2202-48FE, AR2204-27GE, AR2204-27GE-P, AR2204-51GE-P, AR2204-51GE,
AR2204-51GE-R, AR2204E, AR2204E-D, AR2204 support a maximum of four equal-cost
routes, and the AR2220, AR2220E, AR2204XE, AR2204XE-DC, AR2240 (using SRU40, SRU60,
SRU80, SRU100E), AR2240C, AR3600 (using SRUX5), and AR3200 (using SRU40, SRU60,
SRU80, SRU100E) series support a maximum of eight equal-cost routes, AR2240 (using
SRU200, SRU200E or SRU400), and AR3200 (using SRU200, SRU200E or SRU400) series
support a maximum of sixteen equal-cost routes.

Step 4 (Optional) Run nexthop ip-address weight value


The route preferences are configured for load balancing.
When the number of equal-cost routes on the live network is greater than that
specified in the maximum load-balancing command, valid routes are selected for
load balancing based on the following criteria:
1. Route preference: Routes with higher preferences are selected for load
balancing.
2. Interface index: If routes have the same priorities, routes with higher interface
index values are selected for load balancing.
3. Next hop IP address: If routes have the same priorities and interface index
values, routes with larger IP address are selected for load balancing.
To specify valid routes for load balancing, run the nexthop command to set the
route preference. Ensure that the preferences of valid routes to be used are high.
The smaller the weight value, the higher the preference of the route. The default
weight value is 255, which indicates that load balancing is implemented
regardless of the route preferences.

----End

5.12.3 Configuring External Route Selection Rules

Context
RFC 2328 and RFC 1583 define the route selection rule differently. After OSPF is
enabled on the router, specify a route selection rule based on the router
configuration. The router complies with the route selection rule defined in RFC
1583 by default. If the neighboring router complies with the route selection rule
defined in RFC 2328, configure the local router to comply with that defined in RFC
2328. This allows all routers in the OSPF area to comply with the same route
selection rule.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 221


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 3 Run undo rfc1583 compatible

The router is configured to comply with the route selection rule defined in RFC
2328, not RFC 1583.

By default, the router complies with route selection rule defined in RFC 1583.

----End

5.12.4 Verifying the OSPF Route Selection Adjustment


Configuration

Prerequisites
All configurations of adjusting OSPF route selection are complete.

Procedure
● Run the display ospf [ process-id ] interface command to check information
about OSPF interfaces.
● Run the display ospf [ process-id ] routing command to check information
about the OSPF routing table.

----End

5.13 Controlling OSPF Routing Information

Pre-configuration Tasks
Before controlling OSPF routing information, complete the following tasks:

● Configuring IP addresses for interfaces to ensure that neighboring nodes are


reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure
Perform one or more configuration tasks (excluding the task of Verifying the OSPF
Routing Information Control Configuration) as required.

5.13.1 Configuring OSPF to Import External Routes

Context
To access a router running a non-OSPF protocol, an OSPF-capable router needs to
import routes of the non-OSPF protocol into the OSPF network.

OSPF can ensure loop-free intra-area and inter-area routes; however, OSPF cannot
protect external routes against loops. Therefore, when configuring OSPF to import
external routes, avoid the loops caused by manual configurations.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 222


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Do as follows on the router that functions as the ASBR running OSPF:

Procedure
● Configuring OSPF to import the routes discovered by other protocols
a. Run system-view

The system view is displayed.


b. Run ospf [ process-id ]

The OSPF process view is displayed.


c. Run import-route { limit limit-number | { bgp [ permit-ibgp ] | direct |
unr | rip [ process-id-rip ] | static | isis [ process-id-isis ] | ospf [ process-
id-ospf ] } [ cost cost | type type | tag tag | route-policy route-policy-
name ] * }

The routes discovered by other protocols are imported.


● Setting parameters for OSPF to import routes
a. Run system-view

The system view is displayed.


b. Run ospf [ process-id ]

The OSPF process view is displayed.


c. Run default { cost { cost-value | inherit-metric } | limit limit | tag tag |
type type } *

The default values of parameters (the metric of routes, tag, and type) are
set for importing routes.

The default values of parameters (the cost, number of routes, tag, and
type) are set for imported routes.

When OSPF imports external routes, you can set default values for some
additional parameters, such as the cost, number of routes to be imported,
route tag, and route type. The route tag is used to identify the protocol-
related information. For example, it can be used to differentiate AS
numbers carried in BGP routes imported by OSPF.

By default, the cost of the external routes imported by OSPF is 1; the type
of the imported external routes is Type 2; the default tag value of the
imported routes is 1.

NOTE

You can run one of the following commands to set the cost of the imported
route. The following commands are listed in descending order of priority.
● Run the apply cost command to set the cost of a route.
● Run the import-route command to set the cost of the imported route.
● Run the default command to set the default cost of the imported route.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 223


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.13.2 Configuring OSPF to Advertise the Default Route to the


OSPF Area

Context
Multiple routers often reside on the area border and AS border of an OSPF
network for next-hop backup or traffic load balancing. A default route can be
configured to reduce routing entries and improve resource usage on the OSPF
network.
The default route is generally applied to the following scenarios:
1. An ABR in an area advertises Type 3 LSAs carrying the default route within
the area. routers in the area use the received default route to forward inter-
area packets.
2. An ASBR in an AS advertises Type 5 or Type 7 LSAs carrying the default route
within the AS. routers in the AS use the received default route to forward AS
external packets.
When no exactly matched route is discovered, the router can forward packets
through the default route.
The preference of the default route in Type 3 LSAs is higher than that of the route
in Type 5 or Type 7 LSAs.
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 5-22.

Table 5-22 Default route advertising mode

Area Generated By Advertise LSA Type Floodi


Type d By ng
Area

Comm The default-route-advertise ASBR Type 5 LSA Com


on command mon
area area

Stub Automatically ABR Type 3 LSA Stub


area area

NSSA The nssa [ default-route- ASBR Type 7 LSA NSSA


advertise ] command

Totally Automatically ABR Type 3 LSA NSSA


NSSA

Perform the following steps on the ASBR running OSPF.

Procedure
● Configuring OSPF to advertise the default route to the OSPF area

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 224


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

a. Run system-view

The system view is displayed.


b. Run ospf [ process-id ]

The OSPF process view is displayed.


c. Run the following commands as required:

▪ Run default-route-advertise [ [ always | permit-calculate-other ] |


cost cost | type type | route-policy route-policy-name [ match-
any ] ] *
OSPF is configured to advertise the default route to the OSPF area.
○ always indicates that an LSA describing the default route is
generated and then advertised regardless of whether there are
active default routes of other OSPF processes in the routing
table of the local device.
○ permit-calculate-other indicates that the local router is still
allowed to calculate the default routes advertised by other
routers after adverting its default route.
○ route-policy route-policy-name indicates that the local device
advertises default routes according to the parameters of the
configured routing policy when there are matched default
routing entries generated by other OSPF processes.

▪ Run default-route-advertise summary cost cost


The default cost of a Type 3 summary LSA is set.
Before selecting the preceding parameters, you need to configure
VPN. Otherwise, this command cannot be run.
NOTE

● An ASE LSA that describes the default route is generated and then advertised
only when there are active default routes of other OSPF processes in the
routing table of the local device.
● Before advertising a default route, OSPF compares the preferences of default
routes. Therefore, if a static default route is configured on an OSPF router, to
add the default route advertised by OSPF to the current routing table, ensure
that the preference of the configured static default route is lower than that of
the default route advertised by OSPF.

----End

5.13.3 Configuring OSPF Route Aggregation

Context
Route summarization on a large-scale OSPF network efficiently reduces routing
entries. This function minimizes consumption of system resources while
maintaining system performance. In addition, if a specific link frequently
alternates between Up and Down states, the links uninvolved in the route
summarization will not be affected. This prevents route flapping and improves
network stability.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 225


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

When an ABR sends routing information to other areas, it originates Type 3 LSAs
for each network segment. If any contiguous segments exist in this area, run the
abr-summary command to summarize these segments into one. An ABR then
sends just one summarized LSA to other areas, and no LSAs that belong to the
summarized network segment specified by this command. Therefore, the routing
table size is reduced, and router performance is improved.
Carry out the following steps on the router running OSPF.

Procedure
● Configuring ABR route aggregation
a. Run system-view
The system view is displayed.
b. Run ospf [ process-id ]
The OSPF process view is displayed.
c. Run area area-id
The OSPF area view is displayed.
d. Run abr-summary ip-address mask [ [ cost { cost | inherit-minimum } |
[ advertise [ generate-null0-route ] | not-advertise | generate-null0-
route [ advertise ] ] ] * ]
ABR route aggregation is configured.
● Configuring ASBR route aggregation
a. Run system-view
The system view is displayed.
b. Run ospf [ process-id ]
The OSPF process view is displayed.
c. (Optional) Run asbr-summary type nssa-trans-type-reference [ cost
nssa-trans-cost-reference ]
OSPF is configured to refer to Type 5 LSAs that have been translated
from Type 7 LSAs when it sets types and costs for summary routes on
ASBRs.
By default, when OSPF sets types and costs for summary routes on
ASBRs, OSPF does not refer to Type 5 LSAs that have been translated
from Type 7 LSAs.
d. Run asbr-summary ip-address mask [ not-advertise | tag tag | cost cost
| distribute-delay interval ] *
ASBR route aggregation is configured.

NOTE
After route summarization is configured, the routing table on the local OSPF
router remains unchanged. The routing table on another OSPF router, however,
contains just one summarized route, and no specific routes. This summarized
route will not be removed unless all specific routes are interrupted.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 226


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.13.4 Configuring OSPF to Filter the Received Routes

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run filter-policy { acl-number | acl-name acl-name | ip-prefix ip-prefix-name |
route-policy route-policy-name [ secondary ] } import
OSPF is configured to filter the received routes.
● The parameter acl-number specifies the number of a basic ACL.
● The parameter acl-name acl-name specifies the name of an ACL.
● The parameter ip-prefix ip-prefix-name specifies the name of an IP prefix list.
OSPF is a link-state dynamic routing protocol, with routing information carried in
the LSA. Therefore, the filter-policy import command cannot be used to filter the
advertised or received LSAs.
The filter-policy import command is used to filter the routes calculated by OSPF.
Only the routes that pass the filtering criteria are added to the routing table.
Routes that do not pass the filtering criteria cannot be added to the OSPF routing
table but can be advertised.

----End

5.13.5 Configuring OSPF to Filter the Routes to Be Advertised

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run filter-policy { acl-number | acl-name acl-name | ip-prefix ip-prefix-name |
route-policy route-policy-name } export [ protocol [ process-id ] ]
OSPF is configured to filter the routes imported through the import-route
command. Only the routes that pass the filtering criteria are advertised.
● The parameter acl-number specifies the number of a basic ACL.
● The parameter acl-name acl-name specifies the name of an ACL.
● The parameter ip-prefix ip-prefix-name specifies the name of an IP prefix list.
● The parameter route-policy route-policy-name specifies the name of the
route policy.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 227


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

You can specify the parameter protocol [ process-id ] to filter the routes of a
certain routing protocol or a certain OSPF process. If protocol [ process-id ] is not
specified, OSPF filters all the imported routes.

NOTE

● The import-route command cannot be used to import external default routes.


● OSPF filters the imported routes, and generates Type 5 LSAs to advertise only external
routes that passing the filtering criteria.

----End

5.13.6 Configuring the router to Filter LSAs to Be Sent

Context
When multiple links exist between two routers, you can configure the local router
to filter the LSAs to be sent. This prevents transmission of unnecessary LSAs and
saves bandwidth resources.
Perform the following steps on the router running OSPF.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The interface view is displayed.
Step 3 Run ospf filter-lsa-out { all | { summary [ acl { acl-number | acl-name } ] | ase
[ acl { acl-number | acl-name } ] | nssa [ acl { acl-number | acl-name } ] } * }
The LSAs to be sent are filtered.
By default, the LSAs to be sent are not filtered.

----End

5.13.7 Configuring OSPF to Filter ABR Type3 LSA

Context
After filtering conditions are set for the incoming or outgoing Type 3 LSAs
(Summary LSAs) in an area, only the Type 3 LSAs that meet the filtering
conditions can be received or advertised.
This function is applicable only to the ABR.

Procedure
Step 1 Run system-view
The system view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 228


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 2 Run ospf [ process-id ]


The OSPF process view is displayed.
Step 3 Run area area-id
The OSPF area view is displayed.
Step 4 Depending on type of desired filtering, run one of following commands to
configure OSPF to filter the Type 3 LSAs generated by ABRs.
OSPF is configured to filter the Type 3 LSAs generated by ABRs.
● Run filter { acl-number | acl-name acl-name | ip-prefix ip-prefix-name |
route-policy route-policy-name } export
The outgoing summary LSAs in the local area will be filtered.
● Run filter { acl-number | acl-name acl-name | ip-prefix ip-prefix-name |
route-policy route-policy-name } import
The incoming summary LSAs in the local area will be filtered.

----End

5.13.8 (Optional) Enabling the Mesh-Group Function

Context
When concurrent links exist between two routers, you can enable the mesh-group
function to reduce the load on the links.
The neighboring router ID identifies each mesh group. Several concurrent links are
added to a mesh group. Flooding is implemented once in the group. You can add
interfaces that meet the following conditions to the same mesh group.
● The interfaces belong to the same area and OSPF process.
● The interfaces begin to exchange DD packets.
● The interfaces are connected to the same neighboring router.
Perform the following steps on the router running OSPF.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run mesh-group enable
The mesh-group function is enabled.
By default, the mesh-group function is disabled.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 229


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.13.9 Setting the Maximum Number of External LSAs in the


LSDB

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run lsdb-overflow-limit number
The maximum number of external LSAs in the LSDB is set.

----End

5.13.10 Verifying the OSPF Routing Information Control


Configuration

Prerequisites
The configurations of controlling OSPF routing information are complete.

Procedure
● Run either of the following commands to check routing table information.
– display ospf [ process-id ] routing [ ip-address [ mask | mask-length ] ]
[ interface interface-type interface-number ] [ nexthop nexthop-
address ]
– display ospf [ process-id ] routing router-id [ router-id ]
● Run the display ospf [ process-id ] interface [ all | interface-type interface-
number ] [ verbose ] command to check OSPF interface information.
● Run the display ospf [ process-id ] asbr-summary [ ip-address mask ]
command to check OSPF ASBR summarization information.
----End

5.14 Configuring OSPF IP FRR


In the case of a link fault, a device enabled with OSPF IP FRR can fast switch
traffic to the backup link. This protects traffic and greatly improves the reliability
of OSPF networks.

Context
With the development of networks, Voice over IP (VoIP) and on-line video services
require high-quality real-time transmission. Nevertheless, if an OSPF fault occurs,
traffic can be switched to a new link only after the following processes: fault

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 230


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

detection at the millisecond level, notifying the fault to the routing control plane
at the millisecond level, generating and flooding new topology information at the
tens of milliseconds level, triggering SPF calculation at the tens of milliseconds
level, and notifying and installing a new route at the hundreds-of-milliseconds
level. As a result, it takes much more than 50 ms to recovery the link from the
fault, which cannot meet the requirement for real-time services on the network.

OSPF IP FRR can work with BFD to implement protection switchover within 50 ms.
With OSPF IP FRR that calculates a backup link in advance, devices can fast switch
traffic to the backup link without interrupting traffic when the primary link
becomes faulty. This protects traffic and thus greatly improves the reliability of
OSPF networks.

OSPF IP FRR is applicable to the services that are sensitive to packet delay and
packet loss.

NOTE
AR100&AR120&AR150&AR160&AR200 series do not support OSPF IP FRR.

Pre-configuration Tasks
Before configuring OSPF IP FRR, complete the following tasks:

● Configuring IP addresses for interfaces to ensure that neighboring nodes are


reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure

Figure 5-33 Flowchart for configuring OSPF IP FRR

Enable OSPF IP FRR

Bind OSPF IP FRR and


BFD

Block FRR on a specified


OSPF interface

Mandatory
procedure
Optional
procedure

5.14.1 Enabling OSPF IP FRR

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 231


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Context
Enabling OSPF IP FRR to generate a loop-free backup link. When this route
becomes faulty, OSPF can fast switch the traffic to a backup link.

FRR calculation consumes a large number of CPU resources. When there are
import features such as routing protocol, you need to delay FRR calculation.

After FRR calculation is delayed, devices process important services such as route
calculation first.

Do as follows on the router that needs to protect traffic to be forwarded:

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] *

An OSPF process is started and the OSPF view is displayed.

Step 3 Run frr

The OSPF IP FRR view is displayed.

Step 4 Run loop-free-alternate

OSPF IP FRR is enabled to generate a loop-free backup link.

NOTE

OSPF can generate a loop-free backup link only when the OSPF IP FRR traffic protection
inequality is met.

Step 5 (Optional) Run frr-priority static low

The Loop-Free Alternates (LFA) algorithm is used to calculate the nexthop and
outbound interface for a backup link.

The nexthop and outbound interface of an OSPF loop-free backup link can be
obtained using either of the following methods:

● For a static backup link, after IP FRR is enabled using the ip frr command in
the system view or ip frr command in VPN instance view, configure a nexthop
and an outbound interface for the static backup link.
● For a dynamic backup link, after OSPF IP FRR is enabled using the loop-free-
alternate command, enable the device to use the LFA algorithm to calculate
the nexthop and outbound interface for the dynamic backup link.

By default, static backup links take preference over dynamic backup links during
route selection. However, static backup links are less flexible than dynamic backup
links. If a link failure occurs, static backup links cannot update automatically, but
dynamic backup links can. Therefore, to ensure automatic link updates, run the
frr-priority static low command to enable dynamic backup links to take
preference over static backup links so that the LFA algorithm is used to calculate
the nexthop and outbound interface.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 232


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 6 (Optional) Run frr-policy route route-policy route-policy-name

OSPF IP FRR filtering policies are configured.

After OSPF IP FRR filtering policies are configured, only the OSPF backup routes
that match the filtering conditions can be delivered to the forwarding table. To
protect the traffic over a specific OSPF route, you can configure a filtering policy
that matches the OSPF route to ensure that the route can be added to the
forwarding table. When this route becomes faulty, OSPF can fast switch the traffic
to a backup link.

----End

5.14.2 Binding IP FRR and BFD

Context
During the configuration of OSPF IP FRR, the lower layer needs to fast respond to
the link change so that traffic can be rapidly switched to the backup link in the
case of a link failure. Bind BFD to the link status so that link faults can be
detected rapidly. This ensures that traffic is rapidly switched to the backup link in
the case of link failures.

Binding OSPF IP FRR and BFD can configure in a specified process or on a


specified interface. The priority of BFD configured on an interface is higher than
that of BFD configured in an OSPF process. If BFD is enabled on an interface, a
BFD session is established according to the BFD parameters set on the interface.

Procedure
● Bind IP FRR and BFD in an OSPF process.
a. Run system-view

The system view is displayed.


b. Run ospf [ process-id | router-id router-id | vpn-instance vpn-instance-
name ] *
The OSPF process is enabled, and the OSPF view is displayed.
c. Run bfd all-interfaces frr-binding

IP FRR and BFD are bound in the OSPF process.


● Bind IP FRR and BFD on a specified OSPF interface.
a. Run system-view

The system view is displayed.


b. Run interface interface-type interface-number

The interface view is displayed.


c. Run ospf bfd frr-binding

IP FRR and BFD are bound on the interface.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 233


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.14.3 (Optional) Blocking FRR on an OSPF Interface

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The view of an OSPF interface enabled with FRR is displayed.
Step 3 Run ospf frr block
FRR is blocked on the OSPF interface.

----End

5.14.4 Verifying the OSPF IP FRR Configuration


Prerequisites
All OSPF IP FRR configurations are complete.

Procedure
● Run the display ospf [ process-id ] routing command to check the
information about the primary link and backup link of a route after
configuring OSPF IP FRR.
----End

5.15 Configuring BFD for OSPF


If requirements for data transmission are high, and OSPF convergence speed needs
to be improved when the link status changes, you can configure BFD on OSPF
links. After detecting a link failure, BFD notifies the routing protocol of the failure,
which triggers fast convergence. When the neighbor relationship becomes Down,
the BFD session is deleted dynamically.

Applicable Environment
NOTE
BFD for routing protocols can only be configured on GRE tunnel interfaces.

OSPF enables the router to periodically send Hello packets to a neighboring router
for fault detection. Detecting a fault takes more than 1s. As technologies develop,
voice, video, and other VoD services are widely used. These services are quite
sensitive to packet loss and delays. When traffic is transmitted at gigabit rates,
long-time fault detection will cause packet loss. This prolonged detection period
cannot meet high reliability requirements of the carrier-class network.
BFD for OSPF is introduced to resolve this problem. After BFD for OSPF is
configured in a specified process or on a specified interface, the link status can be

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 234


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

rapidly detected and fault detection can be completed in milliseconds. This speeds
up OSPF convergence when the link status changes.

NOTE

If the change of bound peer IP address causes a route to switch to another link, the BFD
session is negotiated again only when the original link fails.

Pre-configuration Tasks
Before configuring BFD for OSPF, complete the following tasks:
● Configuring IP addresses for interfaces to ensure that neighboring nodes are
reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure

Figure 5-34 Flowchart of configuring BFD for OSPF


Configure global BFD

Configure BFD for OSPF

Prevent an interface from dynamically


setting up a BFD session

Configure BFD on the specified


interface

Mandatory procedure
Optional procedure

5.15.1 Configuring Global BFD

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run bfd
BFD is configured globally, and the global BFD view is displayed.

----End

5.15.2 Configuring BFD for OSPF

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 235


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF view is displayed.
Step 3 Run bfd all-interfaces enable
BFD for OSPF is enabled to establish the BFD session.
If all the interfaces in a certain process are configured with BFD and their
neighbor relationships are in the Full state, OSPF establishes BFD sessions on all
the interfaces in the process.
Run the bfd all-interfaces { min-rx-interval receive-interval | min-tx-interval
transmit-interval | detect-multiplier multiplier-value | frr-binding } * command to
set parameters for BFD sessions.
● The parameter min-rx-interval receive-interval specifies the expected
minimum interval for receiving BFD packets from the neighbor.
● The parameter min-tx-interval transmit-interval specifies the minimum
interval for sending BFD packets to the neighbor.
● The parameter detect-multiplier multiplier-value specifies the local detection
multiplier.
● The parameter frr-binding indicates that the status of the BFD session is
bound to OSPF IP FRR.

NOTE

If only the bfd all-interfaces { min-rx-interval receive-interval | min-tx-interval transmit-


interval | detect-multiplier multiplier-value | frr-binding } * command is run to set BFD
parameters, and the bfd all-interfaces enable command is not run, BFD cannot be
enabled.
AR150&AR160&AR200 series do not support OSPF IP FRR.

You can skip this step. The default interval at which BFD packets are transmitted
and the default detection multiplier are recommended.
The parameters are configured based on the network status and network
reliability requirements. A short interval at which BFD packets are transmitted can
be configured if high network reliability is required. A long interval at which BFD
packets are transmitted can be configured if high network reliability is not
required.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 236


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE

● Actual interval at which BFD packets are transmitted on the local router = Max { configured
interval transmit-interval at which BFD packets are transmitted on the local router,
configured interval receive-interval at which BFD packets are received on the peer router }
● Actual interval at which BFD packets are received on the local router = Max { configured
interval transmit-interval at which BFD packets are transmitted on the peer router,
configured interval receive-interval at which BFD packets are received on the local router }
● Actual time for detecting BFD packets = Actual interval at which BFD packets are received on
the local router x Configured detection multiplier multiplier-value on the peer router
For example:
● On the local router, the configured interval at which BFD packets are transmitted is 200 ms;
the configured interval at which BFD packets are received is 300 ms; the detection multiplier
is 4.
● On the peer router, the configured interval at which BFD packets are transmitted is 100 ms;
the interval at which BFD packets are received is 600 ms; the detection multiplier is 5.
Then:
● On the local router, the actual interval at which BFD packets are transmitted is 600 ms
calculated by using the formula max {200 ms, 600 ms}; the interval at which BFD packets
are received is 300 ms calculated by using the formula max {100 ms, 300 ms}; the detection
period is 1500 ms calculated by multiplying 300 ms by 5.
● On the peer router, the actual interval at which BFD packets are transmitted is 300 ms
calculated by using the formula max {100 ms, 300 ms}, the actual interval at which BFD
packets are received is 600 ms calculated by using the formula max {200 ms, 600 ms}, and
the detection period is 2400 ms calculated by multiplying 600 ms by 4.

----End

5.15.3 (Optional) Preventing an Interface from Dynamically


Setting Up a BFD Session

Context
After the bfd all-interfaces enable command is run in an OSPF process, BFD
sessions can be established on all the OSPF interfaces whose neighbor
relationships are Full.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The view of the interface enabled with BFD for OSPF is displayed.
Step 3 Run ospf bfd block
The interface is prevented from dynamically establishing a BFD session.

----End

5.15.4 (Optional) Configuring BFD on the Specified Interface

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 237


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Context
After BFD for OSPF is configured on a specified interface and the interface
becomes faulty, the router rapidly detects the fault and instructs OSPF to
recalculate routes. This speeds up OSPF convergence. When the OSPF neighbor
relationship goes Down, the BFD session between OSPF neighbors is dynamically
deleted.
Before configuring BFD for OSPF, enable BFD globally.
Perform the following steps on the router:

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The view of the interface enabled with BFD for OSPF is displayed.
Step 3 Run ospf bfd enable
BFD is enabled on the interface to establish the BFD session.
If all the interfaces in a certain process are configured with BFD and their
neighbor relationships are in the Full state, OSPF creates BFD sessions with default
parameter values on specified interfaces in the process.
NOTE
The priority of BFD for OSPF configured on an interface is higher than that of BFD for OSPF
configured for a process.

Run the ospf bfd { min-rx-interval receive-interval | min-tx-interval transmit-


interval | detect-multiplier multiplier-value } * command to set parameters for
BFD sessions.
You can skip this step. The default interval at which BFD packets are transmitted
and the default detection multiplier are recommended.
The parameters are configured based on the network status and network
reliability requirements. A short interval at which BFD packets are transmitted can
be configured if high network reliability is required. A long interval at which BFD
packets are transmitted can be configured if high network reliability is not
required.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 238


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE

● Actual interval at which BFD packets are transmitted on the local router = Max { configured
interval transmit-interval at which BFD packets are transmitted on the local router,
configured interval receive-interval at which BFD packets are received on the peer router }
● Actual interval at which BFD packets are received on the local router = Max { configured
interval transmit-interval at which BFD packets are transmitted on the peer router,
configured interval receive-interval at which BFD packets are received on the local router }
● Actual time for detecting BFD packets = Actual interval at which BFD packets are received on
the local router x Configured detection multiplier multiplier-value on the peer router
For example:
● On the local router, the configured interval at which BFD packets are transmitted is 200 ms;
the interval at which BFD packets are received is set to 300 ms; the detection multiplier is 4.
● On the peer router, the configured interval at which BFD packets are transmitted is 100 ms;
the interval at which BFD packets are received is 600 ms; the detection multiplier is 5.
Then:
● On the local router, the actual interval at which BFD packets are transmitted is 600 ms
calculated by using the formula max {200 ms, 600 ms}; the interval at which BFD packets
are received is 300 ms calculated by using the formula max {100 ms, 300 ms}; the detection
period is 1500 ms calculated by multiplying 300 ms by 5.
● On the peer router, the actual interval at which BFD packets are transmitted is 300 ms
calculated by using the formula max {100 ms, 300 ms}, the actual interval at which BFD
packets are received is 600 ms calculated by using the formula max {200 ms, 600 ms}, and
the detection period is 2400 ms calculated by multiplying 600 ms by 4.

----End

5.15.5 Verifying the BFD for OSPF Configuration

Prerequisites
All configurations of BFD for OSPF are complete.

Procedure
● Run either of the following commands to check the BFD session:
– display ospf [process-id ] bfd session interface-type interface-number
[ router-id ]
– display ospf [process-id ] bfd session { router-id | all }

----End

5.16 Configuring OSPF Fast Convergence

Pre-configuration Tasks
By adjusting OSPF timers, you can implement OSPF fast network convergence.

Before configuring OSPF fast convergence, complete the following tasks:

● Configuring a link layer protocol

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 239


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Configuring IP addresses for interfaces to ensure that neighboring nodes are


reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Configuration Procedure
Perform one or more configuration tasks (excluding the task of Verifying the OSPF
Fast Convergence Configuration) as required.

5.16.1 Setting the Convergence Priority of OSPF Routes

Context
With the integration of network services, different services such as data, voice, and
video run on the same network infrastructure, and have different requirements for
the network. For Video on Demand (VoD) services, the route convergence speed
of the multicast source server is the most critical factor that affects multicast
services. It is required that the routes to the multicast source should converge
rapidly when network faults occur. On the BGP or MPLS VPN bearer network
where OSPF is used to implement the IP connectivity of the backbone network,
end-to-end routes between PEs need to be converged rapidly.

You can set priorities for specific routes by setting the convergence priority of
OSPF routes so that these routes converge preferentially. This shortens the
interruption of key services and improves the reliability of the entire network.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF view is displayed.

Step 3 Run prefix-priority { critical | high | medium } ip-prefix ip-prefix-name

The convergence priority of OSPF routes is set.

After the convergence priority of OSPF routes is set, OSPF can calculate and flood
LSAs, and synchronize LSDBs according to the priorities. This speeds up route
convergence. When an LSA meets multiple priorities, the highest priority takes
effect. OSPF calculates LSAs in the sequence of intra-area routes, inter-area routes,
and AS external routes. This command makes OSPF calculate route priorities.
Convergence priorities are critical, high, medium, and low. During LSA flooding,
LSAs are placed into the corresponding critical, high, medium, and low queues
according to priorities to speed up the processing of high-priority LSAs.

NOTE

This command takes effect only on the public network.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 240


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.16.2 Setting the Interval for Sending Hello Packets

Context
Hello packets are commonly used packets, which are periodically sent on OSPF
interfaces to establish and maintain neighbor relationships. The intervals set on
the interfaces connecting two OSPF neighbors need to be the same. Otherwise,
the OSPF neighbor relationship cannot be established.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run interface interface-type interface-number

The OSPF interface view is displayed.

Step 3 Run ospf timer hello interval

The interval for sending Hello packets is set on the OSPF interface.

By default, the interval for sending Hello packets on a P2P or broadcast interface
is 10s; the interval for sending Hello packets on a P2MP or NBMA interface is 30s;
the dead time for the OSPF neighbors on the same interface is four times the
interval for sending Hello packets.

----End

5.16.3 Setting the Dead Time of the Neighbor Relationship

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run interface interface-type interface-number

The OSPF interface view is displayed.

Step 3 Run ospf timer dead interval

The dead time after which the neighbor relationship between two routers is set.

By default, the dead time of the neighbor relationship on a P2P or broadcast


interface is 40s; the dead time of the neighbor relationship on a P2MP or NBMA
interface is 120s; the dead time of the neighbor relationship on the same interface
is four times the interval for sending Hello packets.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 241


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE

Setting the dead interval of an OSPF neighbor to longer than 20s is recommended. If the
dead interval of an OSPF neighbor is shorter than 20s, the session may be closed.
Both the Hello timer and the Dead timer are restored to their respective default values
upon a change to the network type.

----End

5.16.4 Configuring Smart-discover

Context
Before Smart-discover is configured, when the neighbor status of the router
changes or the DR/BDR on the multi-access network (broadcast or NBMA
network) changes, the router does not send Hello packets to its neighbor until the
Hello timer expires. This slows down the establishment of neighbor relationships
between devices. After Smart-discover is configured, when the neighbor
relationship status of the router changes or the DR/BDR on the multi-access
network (broadcast or NBMA network) changes, the router can send Hello
packets to its neighbor immediately without waiting for the expiration of the Hello
timer. This speeds up the establishment of neighbor relationships and thus
implements fast convergence of OSPF networks.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run interface interface-type interface-number

The OSPF interface view is displayed.

Step 3 Run ospf smart-discover

Smart-discover is configured on the interface.

----End

5.16.5 Setting the Interval for Updating LSAs

Context
In OSPF, the interval for updating LSAs is defined as 5s. This aims to prevent
network connections or frequent route flapping from consuming excessive
network bandwidth or device resources.

On a stable network where routes need to be fast converged, you can cancel the
interval for updating LSAs by setting the interval to 0 seconds. In this manner,
changes to the topology or the routes can be immediately advertised on the
network through LSAs, thereby speeding up route convergence on the network.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 242


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run lsa-originate-interval { 0 | { intelligent-timer max-interval start-interval


hold-interval | other-type interval } * }
The interval for updating LSAs is set.

● The parameter intelligent-timer indicates that the interval for updating


router LSAs and network LSAs is set through an intelligent timer.
● The parameter max-interval specifies the maximum interval for updating
LSAs, in milliseconds.
● The parameter start-interval specifies the initial interval for updating LSAs, in
milliseconds.
● The parameter hold-interval specifies the hold interval for updating LSAs, in
milliseconds.
● The parameter other-type interval indicates that the interval for updating
LSAs excluding Router LSAs and Network LSAs is set.

By default, an intelligent timer is enabled. After an intelligent timer is enabled, the


default maximum interval for updating LSAs is 5000 ms, the default initial interval
is 500 ms, and the default hold interval is 1000 ms. Details about the interval for
updating LSAs are as follows:
1. The initial interval for updating LSAs is specified by start-interval.
2. The interval for updating LSAs for the nth (n ≥ 2) time is equal to hold-
interval x 2(n-2).
3. When the interval specified by hold-interval x 2(n-2) reaches the maximum
interval specified by max-interval, OSPF updates LSAs at the maximum
interval for three consecutive times. Then, OSPF goes back to step Step 3.1
and updates LSAs at the initial interval specified by start-interval.

----End

5.16.6 Setting the Interval for Receiving LSAs

Context
In OSPF, the interval for receiving LSAs is 1s. This aims to prevent network
connections or frequent route flapping from consuming excessive network
bandwidth or device resources.

On a stable network where routes need to be fast converged, you can cancel the
interval for receiving LSAs by setting the interval to 0 seconds. In this manner,
changes to the topology or the routes can be immediately advertised on the
network through LSAs, thereby speeding up route convergence on the network.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 243


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run lsa-arrival-interval { interval | intelligent-timer max-interval start-interval


hold-interval }
The interval for receiving LSAs is set.

● The parameter interval specifies the interval for receiving LSAs, in


milliseconds.
● The parameter intelligent-timer indicates that the interval for receiving
router LSAs or network LSAs is set through an intelligent timer.
● The parameter max-interval specifies the maximum interval for receiving
LSAs, in milliseconds.
● The parameter start-interval specifies the initial interval for receiving LSAs, in
milliseconds.
● The parameter hold-interval specifies the hold interval for receiving LSAs, in
milliseconds.

On a stable network where routes need to be fast converged, you can set the
interval for receiving LSAs to 0 seconds so that changes to the topology or the
routes can be detected immediately.

By default, an intelligent timer is enabled. After an intelligent timer is enabled, the


default maximum interval for receiving LSAs is 1000 ms, the default initial interval
is 500 ms, and the default hold interval is 500 ms. Details about the interval for
receiving LSAs are as follows:
1. The initial interval for receiving LSAs is specified by the parameter start-
interval.
2. The interval for receiving LSAs for the nth (n ≥ 2) time is equal to hold-
interval x 2(n-2).
3. When the interval specified by hold-interval x 2(n-2) reaches the maximum
interval specified by max-interval, OSPF receives LSAs at the maximum
interval for three consecutive times. Then, OSPF goes back to step Step 3.1
and receives LSAs at the initial interval specified by start-interval.

Step 4 (Optional) Run lsa-arrival-interval suppress-flapping suppress-interval


[ threshold threshold ]

The maximum LSA suppression period is configured.

If frequent LSA flapping occurs, the larger value between lsa-arrival-interval


suppress-flapping and lsa-arrival-interval is used to suppress LSA flapping.

By default, if the device receives an LSA, it delays route calculation for 10s.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 244


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.16.7 Setting the Interval for the SPF Calculation

Context
When the OSPF LSDB changes, the shortest path needs to be recalculated. If a
network changes frequently and the shortest path is calculated continually, many
system resources are consumed and thus system performance is degraded. By
configuring an intelligent timer and setting a correct interval for the SPF
calculation, you can prevent excessive system memory and bandwidth resources
from being occupied.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF process view is displayed.
Step 3 Run spf-schedule-interval { interval1 | intelligent-timer max-interval start-
interval hold-interval | millisecond interval2 }
The interval for the SPF calculation is set.
● The parameter interval1 specifies the interval for the SPF calculation, in
milliseconds.
● The parameter intelligent-timer indicates that the interval for the SPF
calculation is set through an intelligent timer.
● The parameter max-interval specifies the maximum interval for the SPF
calculation, in milliseconds.
● The parameter start-interval specifies the initial interval for the SPF
calculation, in milliseconds.
● The parameter hold-interval specifies the hold interval for the SPF calculation,
in milliseconds.
● The parameter millisecond interval2 specifies the interval for the SPF
calculation, in milliseconds.
By default, an intelligent timer is enabled; the maximum interval for the SPF
calculation is 10000 ms, the initial interval is 500 ms, and the hold interval is 1000
ms.
After an intelligent timer is enabled, the interval for the SPF calculation is as
follows:
1. The initial interval for the SPF calculation is specified by the parameter start-
interval.
2. The interval for the SPF calculation for the nth (n ≥ 2) time is equal to hold-
interval x 2(n-2).
3. When the interval specified by hold-interval x 2(n-2) reaches the maximum
interval specified by max-interval, OSPF performs the SPF calculation at the
maximum interval for three consecutive times. Then, OSPF goes back to step

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 245


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 3.1 and performs the SPF calculation at the initial interval specified by
start-interval.

----End

5.16.8 Verifying the OSPF Fast Convergence Configuration

Prerequisites
All configurations of OSPF fast convergence are complete.

Procedure
● Run the display ospf [ process-id ] brief command to check brief information
about the specified OSPF process.

----End

5.17 Configuring OSPF GR


Configuring OSPF GR to avoid traffic interruption and route flapping caused by
the active/standby switchover.

Applicable Environment
To avoid traffic interruption and route flapping caused by the active/standby
switchover, you can enable OSPF GR.

After the OSPF process is restarted through GR, the Restarter and the Helper
reestablish the neighbor relationship, exchange routing information, synchronize
the LSDB, and update the routing table and forwarding table. These operations
ensure the fast convergence of OSPF and the stability of the network topology.

NOTE
In practical application, in order to realize that business forwarding is not affected by
motherboard failure, it is usually possible to configure OSPF GR in the hardware
environment of dual motherboard to make sense.
All the models support the GR Helper, and only AR3200 series support the GR Restarter.

Pre-configuration Tasks
Before configuring OSPF GR, complete the following tasks:

● Configuring IP addresses for interfaces to ensure that neighboring routers are


reachable at the network layer
● Configuring Basic OSPF Functions

5.17.1 Enabling the Opaque-LSA of OSPF

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 246


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF view is displayed.
Step 3 Run opaque-capability enable
The opaque-LSA capability is enabled.
The opaque-LSA capability of OSPF needs to be enabled first because OSPF
supports GR through Type 9 LSAs.
Step 4 Run graceful-restart
The OSPF GR feature is enabled.

----End

5.17.2 (Optional) Configuring the GR Session Parameters on


the Restarter

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf [ process-id ]
The OSPF view is displayed.

Step 3 Run graceful-restart [ period period | planned-only | partial ] *

The GR session parameters are set.


● Set period, the GR period on the Restarter is set. By default, the restart time
is 120 seconds.
● Set planned-only, the Restarter supports only planned GR. By default, the
Restarter supports both planned GR and unplanned GR.
● Set partial, the Restarter supports partial GR. By default, the Restarter
supports totally GR.

----End

5.17.3 (Optional) Configuring GR Session Parameters on the


Helper

Procedure
Step 1 Run system-view

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 247


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

The system view is displayed.

Step 2 Run ospf [process-id]

The OSPF view is displayed.

Step 3 Run graceful-restart helper-role { [ { ip-prefix ip-prefix-name | acl-number acl-


number | acl-name acl-name } | ignore-external-lsa | planned-only ] * | never }

GR session parameters are configured on the Helper.

● If ACL parameters are configured, the local router can enter the Helper mode
only after neighbors pass the filtering policies of ip-prefix or acl.
● If ignore-external-lsa is configured, the Helper does not check the LSAs
outside the AS (AS-external LSA). By default, the Helper checks the LSAs
outside the AS.
● If planned-only is configured, the Helper supports only planned GR. By
default, the Helper supports both planned GR and unplanned GR.
● If never is configured, the router will not enter the Helper mode.

----End

5.17.4 Verifying the OSPF GR Configuration

Prerequisites
All configurations of OSPF GR are complete.

Procedure
● Run the display ospf [ process-id ] graceful-restart [ verbose ] command to
check information about OSPF GR.

----End

5.18 Improving the Stability of an OSPF Network


Stable OSPF networks decrease route flapping frequency, ensure normal device
operation, and improve network performance.

Applicable Environment
By configuring timers, you can reduce the number of unnecessary packets on
networks and reduce the load on the device to improve network performance.

Pre-configuration Tasks
Before improving the security of an OSPF network, complete the following task:

5.7 Configuring Basic OSPF Functions

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 248


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Configuration Procedure
Perform one or more configuration tasks (excluding the task of Verifying the OSPF
Network Stability Optimization Configuration) as required.

5.18.1 Setting the Priority of OSPF

Context
Routing protocols may share and select routing information because the router
may run multiple dynamic routing protocols at the same time. The system sets a
priority for each routing protocol. When multiple routing protocols are used to
select routes, the route selected by the routing protocol with a higher priority
takes effect.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run preference [ ase ] { preference | route-policy route-policy-name } *

The priority of OSPF is set.

● If the parameter ase is specified, it indicates that the preference of AS


external routes is set.
● The parameter preference specifies the preference of OSPF routes. The smaller
the value, the higher the preference.
● If the parameter route-policy route-policy-name is specified, it indicates that
the preference is set for specified routes according to the routing policy.

By default, the preference of OSPF routes is 10. When the parameter ase is
specified, the default preference of AS external routes is 150.

----End

5.18.2 Configuring the Delay in Transmitting LSAs on the


Interface

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run interface interface-type interface-number

The OSPF interface view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 249


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 3 Run ospf trans-delay interval

The delay in transmitting LSAs is set on the interface.

By default, the delay in transmitting LSAs is 1 second.

----End

5.18.3 Configuring the Interval for Retransmitting LSAs

Context
After sending an LSA packet to the neighboring router, the router waits for a
response. If no response is received within the set interval, the router retransmits
the LSA packet to the neighboring router.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run interface interface-type interface-number

The OSPF interface view is displayed.

Step 3 Run ospf timer retransmit interval

The interval for retransmitting LSAs between adjacent routers is set.

By default, the interval for retransmitting LSAs is 5 seconds.

NOTE

The interval for retransmitting LSAs between adjacent routers cannot be set too small.
Generally, the interval needs to be larger than the round trip time of a packet transmitted
between two routers. Otherwise, certain LSAs are retransmitted unnecessarily.

----End

5.18.4 Configuring Stub Routers

Context
After a stub router is configured, the route on the stub router will not be
preferentially selected. After the route cost is set to the maximum value 65535,
traffic generally bypasses the router. This ensures an uninterrupted route on the
router during upgrades and other maintenance operations.

Procedure
Step 1 Run system-view

The system view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 250


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run stub-router [ on-startup [ interval ] ]

A stub router is configured.

By default, no router is configured as a stub router.

If a router is configured as a stub router, the router continues to function as a stub


router for 500s.

NOTE

There is no relationship between the stub router configured through this command and the
router in a stub area.

----End

5.18.5 Prohibiting an OSPF Interface from Sending and


Receiving OSPF Packets

Context
You can prohibit an OSPF interface from sending and receiving OSPF packets to
prevent local OSPF routing information from being obtained by devices on other
networks. This restriction also prevents the local device from receiving the routing
update information advertised by other devices on the same network.

After an OSPF interface is prohibited from sending and receiving OSPF packets,
the interface can still advertise its direct routes, but not Hello packets. Therefore,
no neighbor relationship can be set up between the device and its neighbor. The
OSPF network becomes more adaptive and network resources are saved.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF view is displayed.

Step 3 Run silent-interface { all | interface-type interface-number }

An OSPF interface is prohibited from sending and receiving OSPF packets.

By default, an interface is allowed to send and receive OSPF packets.

You can prohibit an interface from sending and receiving OSPF packets in different
OSPF processes, but the silent-interface command is valid only for the OSPF
interface in the local process.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 251


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.18.6 Verifying the OSPF Network Stability Optimization


Configuration

Prerequisites
All configurations of improving the stability of an OSPF network are complete.

Procedure
● Run the display ospf [ process-id ] brief command to check brief information
about the specified OSPF process.
● Run the display ip routing-table command to check information about the
IP routing table.

----End

5.19 Improving the Security of an OSPF Network


On a network demanding high security, you can configure OSPF authentication
and the GTSM to improve the security of the OSPF network.

Applicable Environment
In a network demanding high security, you can configure OSPF authentication and
adopt the GTSM mechanism to improve the security of the OSPF network.

The GTSM mechanism defends against attacks by checking the TTL value. If an
attacker keeps sending packets to a router by simulating real OSPF unicast
packets, the router finds that itself is the destination of the packets after the
interface board receives these packets. The router directly sends the packets to the
control plane for OSPF processing without checking the validity of the packets.
The router busies itself with processing these "valid" packets. As a result, the
system is busy, and the CPU is highly occupied.

The GTSM mechanism protects a router by checking whether the TTL value in the
IP packet header is in a pre-defined range to enhance the system security.

NOTE

GTSM supports only unicast addresses; therefore, in OSPF, GTSM takes effect on the virtual
link and the sham link.

Pre-configuration Tasks
Before improving the security of an OSPF network, complete the following tasks:

● Configuring IP addresses for interfaces to ensure that neighboring nodes are


reachable at the network layer
● 5.7 Configuring Basic OSPF Functions

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 252


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Configuration Procedure
Perform one or more configuration tasks (excluding the task of Verifying the OSPF
Network Security Optimization Configuration) as required.

5.19.1 Configuring the OSPF GTSM Functions

Context
To apply GTSM functions, enable GTSM on the two ends of the OSPF connection.
The valid TTL range of the detected packets is [255 -hops + 1, 255].
GTSM checks the TTL value of only the packets that match the GTSM policy. For
the packets that do not match the GTSM policy, you can set them as "pass" or
"drop". If the GTSM default action performed on the packet is set as "drop", you
need to configure all the router connections for GTSM. If the packets sent from a
router do not match the GTSM policy, they are dropped. The connection thus
cannot be established. This ensures security but reduces the ease of use.
You can enable the log function to record information about dropped packets. This
information facilitates fault location.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run ospf valid-ttl-hops hops [ nonstandard-multicast ] [ vpn-instance vpn-
instance-name ]
OSPF GTSM functions are configured.

NOTE

The ospf valid-ttl-hops command has two functions:


● Enabling OSPF GTSM
● Configuring the TTL value to be detected
The parameter vpn-instance is valid only for the latter function.
Thus, if only the private network policy or the public network policy is configured, it is
recommended to set the default action performed on the packets that do not match the
GTSM policy as pass. This prevents the OSPF packets of other processes from being
discarded incorrectly.

The parameter nonstandard-multicast is specified the GTSM configuration is also


valid for multicast packets.
● When the nonstandard-multicast parameter is configured: The TTL values of
the multicast packets which will be sent are set as 255.
● The received multicast packets will be checked for the TTL value 1 or in the
range of [ 255-hops+1, 255 ].
Step 3 (Optional) Run gtsm default-action { drop | pass }
The default action performed on the packets that do not match the GTSM policy is
set.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 253


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

By default, the packets that do not match the GTSM policy can pass the filtering
criteria.

NOTE

If the default action is configured but the GTSM policy is not configured, GTSM does not
take effect.

Step 4 (Optional) Run gtsm log drop-packet all

The log function is enabled on the specified board in the system view. The
information about the packets dropped by GTSM is recorded in the log.

----End

5.19.2 Configuring the Area Authentication Mode

Context
In area authentication, all the routers in an area must use the same area
authentication mode and password. For example, the authentication mode of all
devices in Area 0 is simple authentication and the password is abc.

NOTICE

If plain is selected during the configuration of the area authentication mode, the
password is saved in the configuration file in plain text. This saving mode brings
security risks. It is recommended that you select cipher to save the password in
cipher text.
Simple, MD5 authentication, and HMAC-MD5 cipher text authentication have
potential security risks. HMAC-SHA256 cipher text authentication is
recommended.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run area area-id

The OSPF area view is displayed.

Step 4 Run any of the following commands to configure the authentication mode of the
OSPF area as required:
● Run authentication-mode simple [ plain plain-text | [ cipher ] cipher-text ]
Simple authentication is configured for the OSPF area.
– plain indicates the plain text password.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 254


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

– cipher indicates the cipher text password. For Message Digest 5 (MD5) or
Hashed Message Authentication Code-MD5 (HMAC-MD5)
authentication, the authentication mode is in cipher text by default.
● Run authentication-mode { md5 | hmac-md5 | hmac-sha256 } [ key-id
{ plain plain-text | [ cipher ] cipher-text } ]
The specified authentication mode is configured for the OSPF area.
– md5 indicates the MD5 cipher text authentication mode.
– hmac-md5 indicates the HMAC-MD5 cipher text authentication mode.
– hmac-sha256 indicates the HMAC-SHA256 cipher text authentication
mode.
– key-id specifies the authentication key ID of the cipher authentication.
● Run authentication-mode keychain keychain-name
Keychain authentication is configured for the OSPF area.
NOTE

Before using Keychain authentication, you need to configure Keychain information in


the system view. To establish the OSPF neighbor relationship, you need to ensure that
the key-id, algorithm, and key-string of the local ActiveSendKey are the same as
those of the remote ActiveRecvKey.

----End

5.19.3 Configuring the Interface Authentication Mode

Context
The interface authentication mode is used among neighbor routers to set the
authentication mode and password. Its priority is higher than that of the area
authentication mode.

NOTICE

If plain is selected during the configuration of the interface authentication mode,


the password is saved in the configuration file in plain text. This saving mode
brings security risks. It is recommended that you select cipher to save the
password in cipher text.
Simple, MD5 authentication, and HMAC-MD5 cipher text authentication have
potential security risks. HMAC-SHA256 cipher text authentication is
recommended.

Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The OSPF interface view is displayed.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 255


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Step 3 Run any of the following commands to configure the interface authentication
mode as required:
● Run ospf authentication-mode simple [ plain plain-text | [ cipher ] cipher-
text ]
Simple authentication is configured for the OSPF interface.
– simple indicates simple authentication.
– plain indicates the plain text password. For simple authentication, the
authentication mode is in plain text by default.
– cipher indicates the cipher text password. For MD5 or HMAC-MD5
authentication, the authentication mode is in cipher text by default.
● Run ospf authentication-mode { md5 | hmac-md5 | hmac-sha256 } [ key-id
{ plain plain-text | [ cipher ] cipher-text } ]
The specified authentication mode is configured for the OSPF interface.
– md5 indicates the MD5 cipher text authentication mode.
– hmac-md5 indicates the HMAC-MD5 cipher text authentication mode.
– hmac-sha256 indicates the HMAC-SHA256 cipher text authentication
mode.
● Run ospf authentication-mode null
The OSPF interface is not authenticated.
● Run ospf authentication-mode keychain keychain-name
Keychain authentication is configured for the OSPF area.
NOTE

Before using Keychain authentication, you need to configure Keychain information in


the system view. To establish the OSPF neighbor relationship, you need to ensure that
the key-id, algorithm, and key-string of the local ActiveSendKey are the same as
those of the remote ActiveRecvKey.

----End

5.19.4 Verifying the OSPF Network Security Optimization


Configuration

Prerequisites
The configurations for improving security of an OSPF network are complete.

Procedure
● Run the display gtsm statistics { slot-id | all } command to check the GTSM
statistics.
● Run the display ospf [ process-id ] request-queue [ interface-type interface-
number ] [ neighbor-id ] command to check the OSPF request queue.
● Run the display ospf [ process-id ] retrans-queue [ interface-type interface-
number ] [ neighbor-id ] command to check the OSPF retransmission queue.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 256


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Run the display ospf [ process-id ] error [ lsa ] command to check the OSPF
error information.

----End

5.20 Configuring the Network Management Function


of OSPF
OSPF supports the network management function. You can bind the OSPF MIB to
a certain OSPF process, and configure the trap function and log function.

Applicable Environment
OSPF supports the network management function. You can bind OSPF MIB to a
certain OSPF process. In addition, OSPF also supports the trap function and the
log function.

Pre-configuration Tasks
Before configuring the network management function of OSPF, complete the
following tasks:

● Configuring IP addresses for interfaces to make neighboring nodes reachable


● Configuring Basic OSPF Functions

Configuration Procedure
Perform one or more configuration tasks (excluding the task of Verifying the OSPF
Network Management Function Configuration) as required.

5.20.1 Configuring OSPF MIB Binding

Context
When multiple OSPF processes are enabled, you can configure OSPF MIB to select
the process to be processed, that is, configure OSPF MIB to select the process to
which it is bound.

Do as follows on the OSPF router:

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf mib-binding process-id

OSPF MIB binding is configured.

----End

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 257


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.20.2 Configuring OSPF Trap

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run snmp-agent trap enable feature-name ospf [ trap-name


{ ospfifauthfailure | ospfifconfigerror | ospfifrxbadpacket | ospfifstatechange |
ospflsdbapproachingoverflow | ospflsdboverflow | ospfmaxagelsa |
ospfnbrrestarthelperstatuschange | ospfnbrstatechange |
ospfnssatranslatorstatuschange | ospforiginatelsa | ospfrestartstatuschange |
ospftxretransmit | ospfvirtifauthfailure | ospfvirtifconfigerror |
ospfvirtifrxbadpacket | ospfvirtifstatechange | ospfvirtiftxretransmit |
ospfvirtnbrrestarthelperstatuschange | ospfvirtnbrstatechange } ]

The trap function for the OSPF module is enabled.

To enable the traps of one or more events, you can specify type-name.

----End

5.20.3 Configuring OSPF Log

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf [ process-id ]

The OSPF process view is displayed.

Step 3 Run enable log [ config | error | state | snmp-trap ]

The log function is enabled.

----End

5.20.4 Verifying the OSPF Network Management Function


Configuration

Prerequisites
The configurations for the network management function of OSPF are complete.

Procedure
● Run the display ospf [ process-id ] brief command to view information about
the binding of OSPF MIBs and OSPF processes.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 258


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● Run the display snmp-agent trap feature-name ospf all command to view
all trap messages of the OSPF module.

----End

5.21 Configuring OSPF Neighbor Relationship Flapping


Suppression
OSPF neighbor relationship flapping suppression works by delaying OSPF neighbor
relationship reestablishment or setting the link cost to the maximum value.

Usage Scenario
If an interface carrying OSPF services alternates between Up and Down, OSPF
neighbor relationship flapping occurs on the interface. During the flapping, OSPF
frequently sends Hello packets to reestablish the neighbor relationship,
synchronizes LSDBs, and recalculates routes. In this process, a large number of
packets are exchanged, adversely affecting neighbor relationship stability, OSPF
services, and other OSPF-dependent services, such as LDP and BGP. OSPF neighbor
relationship flapping suppression can address this problem by delaying OSPF
neighbor relationship reestablishment or preventing service traffic from passing
through flapping links.

NOTE
The following steps are optional, choose them as required.

Pre-configuration Tasks
Before configuring OSPF neighbor relationship flapping suppression, complete the
following tasks:

● Configure an IP address for each interface to ensure that neighboring routers


are reachable at the network layer.
● 5.7 Configuring Basic OSPF Functions

Procedure
Step 1 Run system-view

The system view is displayed.

By default, OSPF neighbor relationship flapping suppression is enabled globally. To


disable this function globally, run the suppress-flapping peer disable command.

Step 2 Run interface interface-type interface-number

The interface view is displayed.

By default, OSPF neighbor relationship flapping suppression is enabled on all


interfaces in the same OSPF process. To disable the function from one of the
interfaces, run the ospf suppress-flapping peer disable command.

Step 3 Run ospf suppress-flapping peer hold-down interval

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 259


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

The Hold-down mode is configured, and its duration is set.

Flapping suppression works in either Hold-down or Hold-max-cost mode.

● Hold-down mode: In the case of frequent flooding and topology changes


during neighbor relationship establishment, interfaces prevent neighbor
relationship reestablishment during Hold-down suppression, which minimizes
LSDB synchronization attempts and packet exchanges.
● Hold-max-cost mode: If the traffic forwarding path changes frequently,
interfaces use 65535 as the cost of the flapping link during Hold-max-cost
suppression, which prevents traffic from passing through the flapping link.

Flapping suppression can also work first in Hold-down mode and then in Hold-
max-cost mode.

By default, the Hold-max-cost mode takes effect.

To set duration for the Hold-max-cost mode or disable this mode, run the ospf
suppress-flapping peer hold-max-cost disable command.

Step 4 Run ospf suppress-flapping peer { detecting-interval detecting-interval |


threshold threshold | resume-interval resume-interval } *

Detection parameters are configured for OSPF neighbor relationship flapping


suppression.

Each OSPF interface on which OSPF neighbor relationship flapping suppression is


enabled starts a flapping counter. If the interval between two successive neighbor
status changes from Full to a non-Full state is shorter than detecting-interval, a
valid flapping_event is recorded, and the flapping_count increases by 1. When the
flapping_count reaches or exceeds threshold, flapping suppression takes effect. If
the interval between two successive neighbor status changes from Full to a non-
Full state is longer than resume-interval, the flapping_count is reset.

NOTE
The value of resume-interval must be greater than that of detecting-interval.

By default, the detection interval of OSPF neighbor relationship flapping


suppression is 60s, the suppression threshold is 10, and the interval for exiting
from suppression is 120s. Using the default detection parameters is recommended.

Step 5 Run quit

The system view is displayed.

Step 6 Run quit

The user view is displayed.

Step 7 Run reset ospf process-id suppress-flapping peer [ interface-type interface-


number ] [ notify-peer ]

Interfaces are forced to exit from OSPF neighbor relationship flapping suppression.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 260


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NOTE

Interfaces exit from flapping suppression in the following scenarios:


● The suppression timer expires.
● The corresponding OSPF process is reset.
● OSPF neighbor relationship flapping suppression is disabled globally using the suppress-
flapping peer disable command in the OSPF view.
● The reset ospf suppress-flapping peer command is run.

----End

Verifying the Configurations


Run the display ospf [ process-id ] interface interface-type interface-number
verbose command to check the status of OSPF neighbor relationship flapping
suppression.
<Huawei> display ospf interface gigabitethernet 1/0/0 verbose

OSPF Process 1 with Router ID 1.1.1.2


Interfaces

Interface: 10.0.0.2 (GigabitEthernet 1/0/0)


Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 10.0.0.2
Backup Designated Router: 10.0.0.1
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
IO Statistics
Type Input Output
Hello 161367 10436
DB Description 18 18
Link-State Req 5 6
Link-State Update 203780 210
Link-State Ack 90411 276
ALLSPF GROUP
ALLDR GROUP
OpaqueId: 1 PrevState: BDR
Effective cost: 1, enabled by OSPF Protocol.

Suppress flapping peer in the command output indicates the current suppression
mode (Hold-down), time when the flapping suppression started, and the
remaining time of the flapping suppression.

5.22 Disabling Master/Slave Board Switching Triggered


by Abnormal OSPF LSA Aging
By default, master/slave board switching triggered by abnormal OSPF LSA aging is
enabled. To disable this function, perform this task.

Context
If the local device clock is faster than usual and the aging timer expires
abnormally, the local device incorrectly clears all Router LSAs from the peer
device, which causes route flapping and service interruptions. To resolve this issue,
master/slave board switching triggered by abnormal OSPF LSA aging is
automatically enabled. Master/slave board switching is triggered to restore
network connections and service traffic when the following condition is met:

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 261


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

(Number of incorrectly cleared Router LSAs/Total number of Router LSAs) x 100%


≥ 80% (Router LSAs are those sent by the peer device to the local device)

To disable master/slave board switching triggered by abnormal OSPF LSA aging,


run the ospf maxage-lsa auto-protect disable command.

Procedure
Step 1 Run system-view

The system view is displayed.

Step 2 Run ospf maxage-lsa auto-protect disable

The master/slave board switching triggered by abnormal OSPF LSA aging is


disabled.

----End

5.23 Maintaining OSPF


Maintaining OSPF involves resetting OSPF and clearing OSPF statistics.

5.23.1 Clearing OSPF

Context

NOTICE

OSPF information cannot be restored after you clear it. So, confirm the action
before you use the command.

To clear OSPF information, run the following reset commands in the user view.

Procedure
● Run the reset ospf [ process-id ] counters [ neighbor [ interface-type
interface-number ] [ router-id ] ] command to reset OSPF counters.
– counters indicates OSPF counters.
– neighbor indicates neighbor information on the specified interface.
● Run the reset ospf [ process-id ] redistribution command in the user view to
re-import routes by OSPF.
● Run the reset gtsm statistics all command in the user view to clear the
GTSM statistics on the board.

----End

5.23.2 Resetting OSPF

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 262


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Context

NOTICE

Running the reset ospf command will tear down the OSPF adjacency relationship
between the routers. So, confirm the action before you use the command.

To reset OSPF connections, run the following reset commands in the user view.

Procedure
● Run the reset ospf [ process-id ] process [ flush-waiting-timer time |
graceful-restart ] command in the user view to restart the OSPF process.
----End

5.24 Configuration Examples for OSPF

5.24.1 Example for Configuring Basic OSPF Functions

Networking Requirements
As shown in Figure 5-35, all routers run OSPF, and the entire AS is divided into
three areas. Router A and Router B serve as ABRs to forward routes between
areas.
After the configuration, each router should learn the routes from the AS to all
network segments.

Figure 5-35 Networking diagram of configuring basic OSPF functions

Area0
RouterA GE1/0/0 RouterB
192.168.0.1/24 GE1/0/0
192.168.0.2/24

GE2/0/0 GE2/0/0
192.168.1.1/24 192.168.2.1/24
GE1/0/0 GE1/0/0
192.168.1.2/24 192.168.2.2/24
RouterC RouterD
GE2/0/0 GE2/0/0
172.16.1.1/24 172.17.1.1/24
GE2/0/0 GE2/0/0
172.16.1.2/24 172.17.1.2/24
RouterE RouterF

Area1 Area2

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 263


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Configuration Roadmap
The configuration roadmap is as follows:

1. Enable OSPF on each router.


2. Specify network segments in different areas.

Procedure
Step 1 Configure an IP address for each interface.

# Configure RouterA.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ip address 192.168.0.1 255.255.255.0
[RouterA-GigabitEthernet1/0/0] quit
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0] ip address 192.168.1.1 255.255.255.0
[RouterA-GigabitEthernet2/0/0] quit

The configurations of RouterB, RouterC, RouterD, RouterE, and RouterF are similar
to the configuration of RouterA, and are not mentioned here.

Step 2 Configure basic OSPF functions.

# Configure Router A.
[RouterA] router id 1.1.1.1
[RouterA] ospf
[RouterA-ospf-1] area 0
[RouterA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] quit
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.1] quit
[RouterA-ospf-1] quit

# Configure Router B.
[RouterB] router id 2.2.2.2
[RouterB] ospf
[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] area 2
[RouterB-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.2] quit
[RouterB-ospf-1] quit

# Configure Router C.
[RouterC] router id 3.3.3.3
[RouterC] ospf
[RouterC-ospf-1] area 1
[RouterC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] quit
[RouterC-ospf-1] quit

# Configure Router D.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 264


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterD] router id 4.4.4.4


[RouterD] ospf
[RouterD-ospf-1] area 2
[RouterD-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.2] quit
[RouterD-ospf-1] quit

# Configure Router E.
[RouterE] router id 5.5.5.5
[RouterE] ospf
[RouterE-ospf-1] area 1
[RouterE-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[RouterE-ospf-1-area-0.0.0.1] quit
[RouterE-ospf-1] quit

# Configure Router F.
[RouterF] router id 6.6.6.6
[RouterF] ospf
[RouterF-ospf-1] area 2
[RouterF-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[RouterF-ospf-1-area-0.0.0.2] quit
[RouterF-ospf-1] quit

Step 3 Verify the configuration.

# View OSPF neighbors of Router A.


[RouterA] display ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.0.1(GigabitEthernet1/0/0)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.0.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.0.2 BDR: 192.168.0.1 MTU: 0
Dead timer due in 36 sec
Retrans timer interval: 5
Neighbor is up for 00:15:04
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.1(GigabitEthernet2/0/0)'s neighbors
Router ID: 3.3.3.3 Address: 192.168.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.2 BDR: 192.168.1.1 MTU: 0
Dead timer due in 39 sec
Retrans timer interval: 5
Neighbor is up for 00:07:32
Authentication Sequence: [ 0 ]

# View the OSPF routing information of Router A.


[RouterA] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 2 Transit 192.168.1.2 3.3.3.3 0.0.0.1
172.17.1.0/24 3 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0
192.168.0.0/24 1 Transit 192.168.0.1 1.1.1.1 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1
192.168.2.0/24 2 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0
Total Nets: 5
Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0

# View the LSDB of Router A.


[RouterA] display ospf lsdb

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 265


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

OSPF Process 1 with Router ID 1.1.1.1


Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 317 48 80000003 1
Router 1.1.1.1 1.1.1.1 316 48 80000002 1
Network 192.168.0.2 2.2.2.2 399 32 800000F8 0
Sum-Net 172.16.1.0 1.1.1.1 250 28 80000001 2
Sum-Net 172.17.1.0 2.2.2.2 203 28 80000001 2
Sum-Net 192.168.2.0 2.2.2.2 237 28 80000002 1
Sum-Net 192.168.1.0 1.1.1.1 295 28 80000002 1
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 5.5.5.5 5.5.5.5 214 36 80000004 1
Router 3.3.3.3 3.3.3.3 217 60 80000008 1
Router 1.1.1.1 1.1.1.1 289 48 80000002 1
Network 192.168.1.1 1.1.1.1 202 28 80000002 0
Network 172.16.1.1 3.3.3.3 670 32 80000001 0
Sum-Net 172.17.1.0 1.1.1.1 202 28 80000001 3
Sum-Net 192.168.2.0 1.1.1.1 242 28 80000001 2
Sum-Net 192.168.0.0 1.1.1.1 300 28 80000001 1

# View the routing table of Router D and test connectivity by using the ping
command.
[RouterD] display ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 4 Inter-area 192.168.2.1 2.2.2.2 0.0.0.2
172.17.1.0/24 1 Transit 172.17.1.1 4.4.4.4 0.0.0.2
192.168.0.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.2
192.168.1.0/24 3 Inter-area 192.168.2.1 2.2.2.2 0.0.0.2
192.168.2.0/24 1 Transit 192.168.2.2 4.4.4.4 0.0.0.2
Total Nets: 5
Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
[RouterD] ping 172.16.1.1
PING 172.16.1.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=253 time=16 ms
Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=253 time=94 ms
Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=253 time=63 ms
--- 172.16.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/59/94 ms

----End

Configuration Files
● Configuration file of Router A
#
sysname RouterA
#
router id 1.1.1.1
#
interface GigabitEthernet1/0/0
ip address 192.168.0.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 266


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

network 192.168.0.0 0.0.0.255


area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
return

● Configuration file of Router B


#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet2/0/0
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

● Configuration file of Router C


#
sysname RouterC
#
router id 3.3.3.3
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet2/0/0
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
#
return

● Configuration file of Router D


#
sysname RouterD
#
router id 4.4.4.4
#
interface GigabitEthernet1/0/0
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 172.17.1.1 255.255.255.0
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
return

● Configuration file of Router E


#
sysname RouterE
#
router id 5.5.5.5

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 267


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

#
interface GigabitEthernet2/0/0
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
#
return

● Configuration file of Router F


#
sysname RouterF
#
router id 6.6.6.6
#
interface GigabitEthernet2/0/0
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

5.24.2 Example for Configuring OSPF Virtual Links

Networking Requirements
As shown in Figure 5-36, Area 2 does not connect to the backbone area directly.
Area 1 serves as a transit area to connect Area 2 and Area 0. A virtual link is
configured between Router A and Router B.

Figure 5-36 Configuring OSPF virtual links

Area1
RouterA GE1/0/0 GE1/0/0 RouterB
192.168.1.1/24 192.168.1.2/24

GE2/0/0 GE2/0/0
10.1.1.1/8 Virtual Link 172.16.1.1/16

GE2/0/0 GE2/0/0
10.1.1.2/8 172.16.1.2/16
Area0 Area2

RouterC RouterD

Configuration Roadmap
The configuration roadmap is as follows:

1. Configure basic OSPF functions on each router.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 268


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

2. Configure virtual connections on Router A and Router B to connect the


backbone area with the non-backbone area.

Procedure
Step 1 Configure an IP address for each interface.
# Configure Router A.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ip address 192.168.1.1 24
[RouterA-GigabitEthernet1/0/0] quit
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0] ip address 10.1.1.1 8
[RouterA-GigabitEthernet2/0/0] quit

The configurations of Router B, Router C, Router D, Router E, and Router F are


similar to the configuration of Router A, and are not mentioned here.
Step 2 Configure basic OSPF functions.
# Configure Router A.
[RouterA] ospf 1 router-id 1.1.1.1
[RouterA-ospf-1] area 0
[RouterA-ospf-1-area-0.0.0.0] network 10.0.0.0 0.255.255.255
[RouterA-ospf-1-area-0.0.0.0] quit
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.1] quit

# Configure Router B.
[RouterB] ospf 1 router-id 2.2.2.2
[RouterB-ospf-1] area 1
[RouterB-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.1] quit
[RouterB-ospf-1] area 2
[RouterB-ospf-1-area-0.0.0.2] network 172.16.0.0 0.0.255.255
[RouterB-ospf-1-area-0.0.0.2] quit

# Configure Router C.
[RouterC] ospf 1 router-id 3.3.3.3
[RouterC-ospf-1] area 0
[RouterC-ospf-1-area-0.0.0.0] network 10.0.0.0 0.255.255.255
[RouterC-ospf-1-area-0.0.0.0] quit

# Configure Router D.
[RouterD] ospf 1 router-id 4.4.4.4
[RouterD-ospf-1] area 2
[RouterD-ospf-1-area-0.0.0.2] network 172.16.0.0 0.0.255.255
[RouterD-ospf-1-area-0.0.0.2] quit

# View the OSPF routing table of Router A.

NOTE

The routing table of Router A does not contain routes in Area 2 because Area 2 is not
directly connected to Area 0.
[RouterA] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 269


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Routing for Network


Destination Cost Type NextHop AdvRouter Area
10.0.0.0/8 1 Transit 10.1.1.1 1.1.1.1 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0

Step 3 Configure virtual links.


# Configure Router A.
[RouterA] ospf 1
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2
[RouterA-ospf-1-area-0.0.0.1] quit
[RouterA-ospf-1] quit

# Configure Router B.
[RouterB] ospf 1
[RouterB-ospf-1] area 1
[RouterB-ospf-1-area-0.0.0.1] vlink-peer 1.1.1.1
[RouterB-ospf-1-area-0.0.0.1] quit
[RouterB-ospf-1] quit

Step 4 Verify the configuration.


# View the OSPF routing table of Router A.
[RouterA] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.0.0/16 2 Inter-area 192.168.1.2 2.2.2.2 0.0.0.2
10.0.0.0/8 1 Transit 10.1.1.1 1.1.1.1 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0

----End

Configuration Files
● Configuration file of Router A
#
sysname RouterA
#
interface GigabitEthernet1/0/0
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 10.1.1.1 255.0.0.0
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.0.0.0 0.255.255.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
vlink-peer 2.2.2.2
#
return

● Configuration file of Router B


#
sysname RouterB
#
interface GigabitEthernet1/0/0

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 270


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

ip address 192.168.1.2 255.255.255.0


#
interface GigabitEthernet2/0/0
ip address 172.16.1.1 255.255.0.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 192.168.1.0 0.0.0.255
vlink-peer 1.1.1.1
area 0.0.0.2
network 172.16.0.0 0.0.255.255
#
return
● Configuration file of Router C
#
sysname RouterC
#
interface GigabitEthernet2/0/0
ip address 10.1.1.2 255.0.0.0
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.0.0.0 0.255.255.255
#
return
● Configuration file of Router D
#
sysname RouterD
#
interface GigabitEthernet2/0/0
ip address 172.16.1.2 255.255.0.0
#
ospf 1 router-id 4.4.4.4
area 0.0.0.2
network 172.16.0.0 0.0.255.255
#
return

5.24.3 Example for Configuring DR Election of OSPF

Networking Requirements
As shown in Figure 5-37, Router A has the highest priority (100) in the network
and is elected as the DR. Router C has the second highest priority, and is elected
as the BDR. The priority of Router B is 0, and Router B cannot be elected as the
DR or BDR. The priority of Router D is not configured and its default value is 1.

Figure 5-37 Configuring DR election of OSPF


RouterA RouterB

GE1/0/0 GE1/0/0
192.168.1.1/24 192.168.1.2/24
GE1/0/0 GE1/0/0
192.168.1.3/24 192.168.1.4/24

RouterC RouterD

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 271


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the router ID on each router, enable OSPF, and specify the network
segment.
2. Check the DR/BDR status of each router with the default priority.
3. Configure the DR priority of the interface and check the DR/BDR status.

Procedure
Step 1 Configure an IP address for each interface.
# Configure IP addresses for all interfaces of RouterA.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ip address 192.168.1.1 255.255.255.0
[RouterA-GigabitEthernet1/0/0] quit

The configurations of RouterB, RouterC and RouterD are similar to the


configuration of RouterA, and are not mentioned here.
Step 2 Configure basic OSPF functions.
# Configure Router A.
[RouterA] router id 1.1.1.1
[RouterA] ospf
[RouterA-ospf-1] area 0
[RouterA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] quit
[RouterA-ospf-1] quit

# Configure Router B.
[RouterB] router id 2.2.2.2
[RouterB] ospf
[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] quit

# Configure Router C.
[RouterC] router id 3.3.3.3
[RouterC] ospf
[RouterC-ospf-1] area 0
[RouterC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] quit
[RouterC-ospf-1] quit

# Configure Router D.
[RouterD] router id 4.4.4.4
[RouterD] ospf
[RouterD-ospf-1] area 0
[RouterD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.0] quit
[RouterD-ospf-1] quit

# View the DR/BDR status.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 272


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterA] display ospf peer


OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.1.1(GigabitEthernet1/0/0)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.1.2
State: 2-Way Mode:Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 32 sec
Retrans timer interval: 5
Neighbor is up for 00:04:21
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:04:06
Authentication Sequence: [ 0 ]
Router ID: 4.4.4.4 Address: 192.168.1.4
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:03:53
Authentication Sequence: [ 0 ]

# View the neighbor information of Router A. You can see the priority of DR and
the neighbor status. The Router D is the DR, and Router C is the BDR.

NOTE

When the priority is the same, the router with a higher router ID is elected as the DR. If a
new router is added after the DR/BDR election is complete, the new router cannot become
the DR even if it has the highest priority.

Step 3 Configure DR priorities on interfaces.


# Configure Router A.
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ospf dr-priority 100
[RouterA-GigabitEthernet1/0/0] quit

# Configure Router B.
[RouterB] interface gigabitethernet 1/0/0
[RouterB-GigabitEthernet1/0/0] ospf dr-priority 0
[RouterB-GigabitEthernet1/0/0] quit

# Configure Router C.
[RouterC] interface gigabitethernet 1/0/0
[RouterC-GigabitEthernet1/0/0] ospf dr-priority 2
[RouterC-GigabitEthernet1/0/0] quit

# View the DR/BDR status.


[RouterD] display ospf peer
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.0 interface 192.168.1.4(GigabitEthernet1/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 100
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Retrans timer interval: 5
Neighbor is up for 00:11:17
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.2

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 273


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

State: Full Mode:Nbr is Slave Priority: 0


DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:11:19
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Slave Priority: 2
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 33 sec
Retrans timer interval: 5
Neighbor is up for 00:11:15
Authentication Sequence: [ 0 ]

Step 4 Restart OSPF processes.

In the user view of each router, run the reset ospf 1 process command to restart
the OSPF process.

Step 5 View the configuration.

# View the status of OSPF neighbors.


[RouterD] display ospf peer
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.0 interface 192.168.1.4(GigabitEthernet1/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave Priority: 100
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:07:19
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.2
State: 2-Way Mode:Nbr is Master Priority: 0
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:07:19
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Slave Priority: 2
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:07:17
Authentication Sequence: [ 0 ]

# View the status of the OSPF interface.


[RouterA] display ospf interface
OSPF Process 1 with Router ID 1.1.1.1
Interfaces
Area: 0.0.0.0
IP Address Type State Cost Pri DR BDR
192.168.1.1 Broadcast DR 1 100 192.168.1.1 192.168.1.3
[RouterB] display ospf interface
OSPF Process 1 with Router ID 2.2.2.2
Interfaces
Area: 0.0.0.0
IP Address Type State Cost Pri DR BDR
192.168.1.2 Broadcast DROther 1 0 192.168.1.1 192.168.1.3

If all neighbors are in the Full state, it indicates that Router A establishes the
neighbor relationship with its neighbor. If the neighbor stays "2-Way", it indicates
both of them are not the DR or BDR. They need not exchange LSAs.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 274


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

If the status of the OSPF interface is DROther, it indicates that it is neither DR nor
BDR.

----End

Configuration Files
● Configuration file of Router A
#
sysname RouterA
#
router id 1.1.1.1
#
interface GigabitEthernet1/0/0
ip address 192.168.1.1 255.255.255.0
ospf dr-priority 100
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return

● Configuration file of Router B


#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0
ospf dr-priority 0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return

● Configuration file of Router C


#
sysname RouterC
#
router id 3.3.3.3
#
interface GigabitEthernet1/0/0
ip address 192.168.1.3 255.255.255.0
ospf dr-priority 2
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return

● Configuration file of Router D


#
sysname RouterD
#
router id 4.4.4.4
#
interface GigabitEthernet1/0/0
ip address 192.168.1.4 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 275


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

#
return

5.24.4 Example for Configuring OSPF Stub Areas

Networking Requirements
As shown in Figure 5-38, all routers run OSPF, and the entire AS is divided into
three areas. Router A and Router B serve as ABRs to forward routes between
areas. Router D serves as an ASBR to import external routes (static routes).

It is required to configure Area 1 as a stub area to reduce the LSAs advertised to


this area without affecting the route reachability.

Figure 5-38 Configuring OSPF stub areas

Area0

RouterA GE1/0/0 RouterB


192.168.0.1/24 GE1/0/0
Area1 192.168.0.2/24
Area2
GE2/0/0 GE2/0/0
192.168.1.1/24 192.168.2.1/24
GE1/0/0 GE1/0/0
192.168.1.2/24 192.168.2.2/24
RouterD
RouterC
ASBR
GE2/0/0 GE2/0/0
172.16.1.1/24 Stub 172.17.1.1/24
GE2/0/0 GE2/0/0
172.16.1.2/24 172.17.1.2/24
RouterE RouterF

Configuration Roadmap
The configuration roadmap is as follows:

1. Enable OSPF on each router, and configure basic OSPF functions.


2. Configure static routes on Router D, and import them into OSPF.
3. Configure Area 1 as a stub area, and check the OSPF routing information on
Router C.
4. Stop Router A from advertising Type 3 LSAs to the stub area, and check the
OSPF routing information on Router C.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 276


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Configure an IP address for each interface.
# Configure Router A.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ip address 192.168.0.1 24
[RouterA-GigabitEthernet1/0/0] quit
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0] ip address 192.168.1.1 24
[RouterA-GigabitEthernet2/0/0] quit

The configurations of Router B, Router C, Router D, Router E, and Router F are


similar to the configuration of Router A, and are not mentioned here.
Step 2 Configure basic OSPF functions.
# Configure Router A.
[RouterA] router id 1.1.1.1
[RouterA] ospf
[RouterA-ospf-1] area 0
[RouterA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] quit
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.1] quit
[RouterA-ospf-1] quit

# Configure Router B.
[RouterB] router id 2.2.2.2
[RouterB] ospf
[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] area 2
[RouterB-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.2] quit
[RouterB-ospf-1] quit

# Configure Router C.
[RouterC] router id 3.3.3.3
[RouterC] ospf
[RouterC-ospf-1] area 1
[RouterC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] quit
[RouterC-ospf-1] quit

# Configure Router D.
[RouterD] router id 4.4.4.4
[RouterD] ospf
[RouterD-ospf-1] area 2
[RouterD-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[RouterD-ospf-1-area-0.0.0.2] quit
[RouterD-ospf-1] quit

# Configure Router E.
[RouterE] router id 5.5.5.5
[RouterE] ospf
[RouterE-ospf-1] area 1

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 277


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterE-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255


[RouterE-ospf-1-area-0.0.0.1] quit
[RouterE-ospf-1] quit

# Configure Router F.
[RouterF] router id 6.6.6.6
[RouterF] ospf
[RouterF-ospf-1] area 2
[RouterF-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[RouterF-ospf-1-area-0.0.0.2] quit
[RouterF-ospf-1] quit

Step 3 Configure Router D to import static routes.


[RouterD] ip route-static 200.0.0.0 8 null 0
[RouterD] ospf
[RouterD-ospf-1] import-route static type 1
[RouterD-ospf-1] quit

# View ABR/ASBR information on Router C.


[RouterC] display ospf abr-asbr
OSPF Process 1 with Router ID 3.3.3.3
Routing Table to ABR and ASBR
RtType Destination Area Cost Nexthop Type
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

# View the OSPF routing table of Router C.

NOTE

When Router C is in a common area, there are AS external routes in the routing table.
[RouterC] 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.16.1.0/24 1 Transit 172.16.1.1 3.3.3.3 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.1.0/24 1 Transit 192.168.1.2 3.3.3.3 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
200.0.0.0/8 4 Type1 1 192.168.1.1 4.4.4.4
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0

Step 4 Configure Area 1 as a stub area.


# Configure Router A.
[RouterA] ospf
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] stub
[RouterA-ospf-1-area-0.0.0.1] quit
[RouterA-ospf-1] quit

# Configure Router C.
[RouterC] ospf
[RouterC-ospf-1] area 1
[RouterC-ospf-1-area-0.0.0.1] stub
[RouterC-ospf-1-area-0.0.0.1] quit
[RouterC-ospf-1] quit

# Configure Router E.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 278


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterE] ospf
[RouterE-ospf-1] area 1
[RouterE-ospf-1-area-0.0.0.1] stub
[RouterE-ospf-1-area-0.0.0.1] quit
[RouterE-ospf-1] quit

# View the routing table of Router C.

NOTE

After the area where Router C resides is configured as a stub area, AS external routes are
invisible. Instead, there is a default route.
[RouterC] 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.16.1.0/24 1 Transit 172.16.1.1 3.3.3.3 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.1.0/24 1 Transit 192.168.1.2 3.3.3.3 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: 6
Intra Area: 2 Inter Area: 4 ASE: 0 NSSA: 0

Step 5 Stop Router A from advertising Type 3 LSAs to the stub area.
[RouterA] ospf
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] stub no-summary
[RouterA-ospf-1-area-0.0.0.1] quit
[RouterA-ospf-1] quit

Step 6 Verify the configuration.


# View the OSPF routing table of Router C.
[RouterC] 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.16.1.0/24 1 Transit 172.16.1.1 3.3.3.3 0.0.0.1
192.168.1.0/24 1 Transit 192.168.1.2 3.3.3.3 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0

NOTE

After the advertisement of summary LSAs to a stub area is disabled, the routing entries of
the stub router are further reduced, and only the default route to a destination outside the
AS is reserved.

----End

Configuration Files
● Configuration file of Router A
#
sysname RouterA
#
router id 1.1.1.1
#
interface GigabitEthernet1/0/0
ip address 192.168.0.1 255.255.255.0

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 279


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

#
interface GigabitEthernet2/0/0
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
● Configuration file of Router B
#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet2/0/0
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
● Configuration file of Router C
#
sysname RouterC
#
router id 3.3.3.3
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet2/0/0
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
● Configuration file of Router D
#
sysname RouterD
#
router id 4.4.4.4
#
interface GigabitEthernet1/0/0
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet2/0/0
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

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 280


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

#
ip route-static 200.0.0.0 255.0.0.0 NULL0
#
return

● Configuration file of Router E


#
sysname RouterE
#
router id 5.5.5.5
#
interface GigabitEthernet2/0/0
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

● Configuration file of Router F


#
sysname RouterF
#
router id 6.6.6.6
#
interface GigabitEthernet2/0/0
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

5.24.5 Example for Configuring an OSPF NSSA

Networking Requirements
Stub areas and NSSAs are described as follows:
Stub area
● Does not transmit external routes from other areas.
● Does not transmit AS external routes imported by ASBRs.
Type 5 LSAs are not transmitted in stub areas.
NSSA
● Does not transmit external routes from other areas.
● Transmits AS external routes imported by ASBRs.
Type 7 LSAs generated by ASBRs in an NSSA are transmitted only within the
NSSA. After receiving the Type 7 LSAs, ABRs in the NSSA translate them into
Type 5 LSAs to advertise external routes to other areas on the OSPF network.
Configuring an area as an NSSA prevents a large number of external routes from
consuming the bandwidth and storage resources of the router.
In Figure 5-39, OSPF runs on all routers, and the entire AS is partitioned into two
areas. Router A and Router B function as ABRs to forward inter-area routes; Router

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 281


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

C and Router D function as ASBRs and import external static routes 10.0.0.0/8 and
20.0.0.0/8. To import AS external routes but reduce the number of LSAs to be
advertised to area 1 without affecting route reachability, configure area 1 as an
NSSA and configure Router A as an LSA translator in the NSSA.

Figure 5-39 Networking for configuring an OSPF NSSA

RouterA
GE2/0/0 GE1/0/0
192.168.3.1/24 192.168.0.1/24
GE1/0/0
192.168.3.2/24 GE3/0/0 GE1/0/0
192.168.1.1/24 192.168.0.2/24
RouterD RouterC
ASBR ASBR
GE1/0/0
192.168.1.2/24 GE2/0/0
GE2/0/0 192.168.2.2/24
192.168.4.1/24
GE3/0/0 GE2/0/0
Area1
NSSA 192.168.4.2/24 192.168.2.1/24 Area0
RouterB

Configuration Roadmap
The configuration roadmap is as follows:
1. Enable OSPF and configure basic OSPF functions on each router
2. Configure Area 1 as an NSSA.
3. Configure Router D to import the static route 10.0.0.0/8.
4. Configure Router C to import the static route 20.0.0.0/8.
5. Configure Router A as an LSA translator in the NSSA.
6. Disable Type 3 LSA advertisement to the NSSA to reduce the routing table
size.

Data Preparation
To complete the configuration, you need the following data:
● Router ID 1.1.1.1 of Router A; OSPF process ID 1; network segment
192.168.0.0/24 of area 0; network segments 192.168.1.0/24 and
192.168.3.0/24 of Area 1
● Router ID 2.2.2.2 of Router B; OSPF process ID 1; network segment
192.168.2.0/24 of area 0; network segments 192.168.1.0/24 and
192.168.4.0/24 of Area 1
● Router ID 3.3.3.3 of Router C; OSPF process ID 1; network segments
192.168.0.0/24 and 192.168.2.0/24 of area 0
● Router ID 4.4.4.4 of Router D; OSPF process ID 1; network segments
192.168.3.0/24 and 192.168.4.0/24 of Area 1

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 282


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Procedure
Step 1 Configure an IP address for each interface.
Assign an IP address to each interface according to Figure 5-39. For configuration
details, see "Configuration Files" in this section.
Step 2 Configure basic OSPF functions.
Configuring Basic OSPF Functions shows how to configure basic OSPF functions.
For details about the configuration, see Configuration Files in this section.
Step 3 Configure Router C to import the static route 20.0.0.0/8.
<Huawei> system-view
[Huawei] sysname RouterC
[RouterC] ip route-static 20.0.0.0 8 null 0
[RouterC] ospf 1
[RouterC-ospf-1] import-route static
[RouterC-ospf-1] quit

Step 4 Configure Router D to import the static route 10.0.0.0/8.


[RouterD] ip route-static 10.0.0.0 8 null 0
[RouterD] ospf 1
[RouterD-ospf-1] import-route static
[RouterD-ospf-1] quit

# Display the OSPF routing table of Router C.


[RouterC] display ospf routing

OSPF Process 1 with Router ID 3.3.3.3


Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.0.0/24 1 Transit 192.168.0.2 3.3.3.3 0.0.0.0
192.168.2.0/24 1 Transit 192.168.2.2 3.3.3.3 0.0.0.0
192.168.1.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0
192.168.1.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0
192.168.3.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0
192.168.4.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0

Routing for ASEs


Destination Cost Type Tag NextHop AdvRouter
10.0.0.0/8 1 Type2 1 192.168.0.1 2.2.2.2

Total Nets: 7
Intra Area: 2 Inter Area: 4 ASE: 1 NSSA: 0

After an NSSA is configured, the OSPF routing table of RouterRouter C contains


the AS external static route 10.0.0.0/8 imported by Router D.
# Display the OSPF routing table of Router D.
[RouterD] display ospf routing

OSPF Process 1 with Router ID 4.4.4.4


Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.3.0/24 1 Transit 192.168.3.2 4.4.4.4 0.0.0.1
192.168.4.0/24 1 Transit 192.168.4.1 4.4.4.4 0.0.0.1
192.168.0.0/24 2 Inter-area 192.168.3.1 1.1.1.1 0.0.0.1
192.168.1.0/24 2 Transit 192.168.4.2 2.2.2.2 0.0.0.1
192.168.1.0/24 2 Transit 192.168.3.1 2.2.2.2 0.0.0.1

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 283


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

192.168.2.0/24 2 Inter-area 192.168.4.2 2.2.2.2 0.0.0.1

Routing for ASEs


Destination Cost Type Tag NextHop AdvRouter
20.0.0.0/8 1 Type2 1 192.168.3.1 1.1.1.1

Total Nets: 7
Intra Area: 2 Inter Area: 4 ASE: 1 NSSA: 0

After an NSSA is configured, the OSPF routing table of Router D contains the AS
external static route 20.0.0.0/8 imported by Router C.
Step 5 Configure Area 1 as an NSSA.
# Configure Router A.
[RouterA] ospf 1
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] nssa

# Configure Router B.
[RouterB] ospf 1
[RouterB-ospf-1] area 1
[RouterB-ospf-1-area-0.0.0.1] nssa

# Configure Router D.
[RouterD] ospf 1
[RouterD-ospf-1] area 1
[RouterD-ospf-1-area-0.0.0.1] nssa

NOTE

NSSA attributes must be configured on all routers in the NSSA using the nssa command.

# Display the OSPF routing table of Router C.


[RouterC] display ospf routing

OSPF Process 1 with Router ID 3.3.3.3


Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.0.0/24 1 Transit 192.168.0.2 3.3.3.3 0.0.0.0
192.168.2.0/24 1 Transit 192.168.2.2 3.3.3.3 0.0.0.0
192.168.1.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0
192.168.1.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0
192.168.3.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0
192.168.4.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0

Routing for ASEs


Destination Cost Type Tag NextHop AdvRouter
10.0.0.0/8 1 Type2 1 192.168.0.1 2.2.2.2

Total Nets: 7
Intra Area: 2 Inter Area: 4 ASE: 1 NSSA: 0

After an NSSA is configured, the OSPF routing table of Router C still contains the
AS external static route 10.0.0.0/8 imported by Router D, indicating that the NSSA
can transmit AS external routes imported by ASBRs.
The AdvRouter field shows that the router ID of the advertiser is 2.2.2.2. Router B
functions as the LSA translator in the NSSA because OSPF selects the ABR with the
largest router ID as an LSA translator by default.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 284


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

# Display the OSPF routing table of Router D.


[RouterD] display ospf routing

OSPF Process 1 with Router ID 4.4.4.4


Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.3.0/24 1 Transit 192.168.3.2 4.4.4.4 0.0.0.1
192.168.4.0/24 1 Transit 192.168.4.1 4.4.4.4 0.0.0.1
192.168.0.0/24 2 Inter-area 192.168.3.1 1.1.1.1 0.0.0.1
192.168.1.0/24 2 Transit 192.168.4.2 2.2.2.2 0.0.0.1
192.168.1.0/24 2 Transit 192.168.3.1 2.2.2.2 0.0.0.1
192.168.2.0/24 2 Inter-area 192.168.4.2 2.2.2.2 0.0.0.1

Routing for NSSAs


Destination Cost Type Tag NextHop AdvRouter
0.0.0.0/0 1 Type2 1 192.168.4.2 2.2.2.2
0.0.0.0/0 1 Type2 1 192.168.3.1 1.1.1.1

Total Nets: 8
Intra Area: 4 Inter Area: 2 ASE: 0 NSSA: 2

After an NSSA is configured, the OSPF routing table of Router D does not contain
the AS external static route 20.0.0.0/8 imported by Router C, indicating that the
NSSA cannot transmit external routes from other areas.
Step 6 Configure Router A as an LSA translator in the NSSA.
[RouterA] ospf 1
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] nssa default-route-advertise translator-always

# Display the OSPF routing table of Router C.


[RouterC] display ospf routing

OSPF Process 1 with Router ID 3.3.3.3


Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.0.0/24 1 Transit 192.168.0.2 3.3.3.3 0.0.0.0
192.168.2.0/24 1 Transit 192.168.2.2 3.3.3.3 0.0.0.0
192.168.1.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0
192.168.1.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0
192.168.3.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0
192.168.4.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0

Routing for ASEs


Destination Cost Type Tag NextHop AdvRouter
10.0.0.0/8 1 Type2 1 192.168.0.1 1.1.1.1

Total Nets: 7
Intra Area: 2 Inter Area: 4 ASE: 1 NSSA: 0

The AdvRouter field shows that the router ID of the advertiser has become
1.1.1.1, indicating that Router A functions an LSA translator in the NSSA.
Step 7 Disable Type 3 LSA advertisement to the NSSA.
# Display the OSPF routing table of Router D.
[RouterD] display ospf routing

OSPF Process 1 with Router ID 4.4.4.4

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 285


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.3.0/24 1 Transit 192.168.3.2 4.4.4.4 0.0.0.1
192.168.4.0/24 1 Transit 192.168.4.1 4.4.4.4 0.0.0.1
192.168.0.0/24 2 Inter-area 192.168.3.1 1.1.1.1 0.0.0.1
192.168.1.0/24 2 Transit 192.168.4.2 2.2.2.2 0.0.0.1
192.168.1.0/24 2 Transit 192.168.3.1 2.2.2.2 0.0.0.1
192.168.2.0/24 2 Inter-area 192.168.4.2 2.2.2.2 0.0.0.1

Routing for NSSAs


Destination Cost Type Tag NextHop AdvRouter
0.0.0.0/0 1 Type2 1 192.168.4.2 2.2.2.2
0.0.0.0/0 1 Type2 1 192.168.3.1 1.1.1.1

Total Nets: 8
Intra Area: 4 Inter Area: 2 ASE: 0 NSSA: 2

# Disable Type 3 LSA advertisement to the NSSA to reduce the routing table size.
[RouterA] ospf
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] nssa default-route-advertise no-summary

NOTE

Configuring the no-summary parameter may result in route flapping.

Step 8 Verify the configuration.


# Display the OSPF routing table of Router D.
[RouterD] display ospf routing

OSPF Process 1 with Router ID 4.4.4.4


Routing Tables

Routing for Network


Destination Cost Type NextHop AdvRouter Area
192.168.3.0/24 1 Transit 192.168.3.2 4.4.4.4 0.0.0.1
192.168.4.0/24 1 Transit 192.168.4.1 4.4.4.4 0.0.0.1
0.0.0.0/0 2 Inter-area 192.168.4.2 2.2.2.2 0.0.0.1
0.0.0.0/0 2 Inter-area 192.168.3.1 1.1.1.1 0.0.0.1
192.168.1.0/24 2 Transit 192.168.4.2 2.2.2.2 0.0.0.1
192.168.1.0/24 2 Transit 192.168.3.1 2.2.2.2 0.0.0.1

Total Nets: 6
Intra Area: 4 Inter Area: 2 ASE: 0 NSSA: 0

The command output shows that ABRs no longer transmit Type 3 LSAs to the
NSSA and that the routing table size is reduced.

----End

Configuration Files
● Router A configuration file
#
sysname RouterA
#
router id 1.1.1.1
#
interface GigabitEthernet1/0/0
ip address 192.168.0.1 255.255.255.0
#

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 286


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

interface GigabitEthernet2/0/0
ip address 192.168.3.1 255.255.255.0
#
interface GigabitEthernet3/0/0
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
network 192.168.3.0 0.0.0.255
nssa default-route-advertise translator-always
nssa default-route-advertise no-summary
#
return
● Router B configuration file
#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 192.168.4.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.2.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 192.168.4.0 0.0.0.255
nssa
#
return
● Router C configuration file
#
sysname RouterC
#
router id 3.3.3.3
#
interface GigabitEthernet1/0/0
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.2.2 255.255.255.0
#
ospf 1
import-route static
area 0.0.0.0
network 192.168.0.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
ip route-static 20.0.0.0 255.0.0.0 NULL0
#
return
● Router D configuration file
#
sysname RouterD
#
router id 4.4.4.4
#

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 287


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

interface GigabitEthernet1/0/0
ip address 192.168.3.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.4.1 255.255.255.0
#
ospf 1
import-route static
area 0.0.0.1
network 192.168.3.0 0.0.0.255
network 192.168.4.0 0.0.0.255
nssa
#
ip route-static 10.0.0.0 255.0.0.0 NULL0
#
return

5.24.6 Example for Configuring OSPF IP FRR


Networking Requirements
When a fault occurs on the network, OSPF IP FRR can fast switch traffic to the
backup link without waiting for route convergence. This ensures uninterrupted
traffic transmission.
As shown in Figure 5-40:
● OSPF runs on the four routers in the same area.
● If the link between Router A and Router C becomes faulty, the traffic
forwarded by Router A is rapidly switched to the backup link and forwarded
through Router B.

Figure 5-40 Networking diagram for configuring OSPF IP FRR


RouterA RouterC GE1/0/2 RouterD
Router-id 10.4.1.3/24 Router-id
10.1.1.1 GE1/0/2 Cost = 4 GE1/0/1 Cost = 55 10.4.4.4
GE1/0/1
GE1/0/1 10.3.1.1/24 10.3.1.3/24 GE1/0/3
10.4.1.4/24
10.2.1.1/24 10.5.1.1/24
5
Co

t=

Router-id
st

s
Co

Router-id 10.3.3.3
=
9

10.2.2.2
GE1/0/1 GE1/0/2
10.2.1.2/24 10.5.1.2/24
RouterB

Configuration Roadmap
The configuration roadmap is as follows:
1. Configure basic OSPF functions on each router.
2. Set the cost to ensure that the link from Router A to Router C is preferred.
3. Enable OSPF IP FRR on Router A to protect the traffic forwarded by Router A.

Procedure
Step 1 Configure an IP address and the cost for each interface.
# Configure IP addresses for all interfaces of RouterA.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 288


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/1
[RouterA-GigabitEthernet1/0/1] ip address 10.2.1.1 255.255.255.0
[RouterA-GigabitEthernet1/0/1] ospf cost 9
[RouterA-GigabitEthernet1/0/1] quit
[RouterA] interface gigabitethernet 1/0/2
[RouterA-GigabitEthernet1/0/2] ip address 10.3.1.1 255.255.255.0
[RouterA-GigabitEthernet1/0/2] ospf cost 4

The configurations of RouterB, RouterC and RouterD are similar to the


configuration of RouterA, and are not mentioned here.
Step 2 Configure basic OSPF functions.
# Configure Router A.
[RouterA] router id 10.1.1.1
[RouterA] ospf
[RouterA-ospf-1] area 1
[RouterA-ospf-1-area-0.0.0.1] network 10.2.1.1 0.0.0.255
[RouterA-ospf-1-area-0.0.0.1] network 10.3.1.1 0.0.0.255
[RouterA-ospf-1-area-0.0.0.1] quit
[RouterA-ospf-1] quit

# Configure Router B.
[RouterB] router id 10.2.2.2
[RouterB] ospf
[RouterB-ospf-1] area 1
[RouterB-ospf-1-area-0.0.0.1] network 10.5.1.2 0.0.0.255
[RouterB-ospf-1-area-0.0.0.1] network 10.2.1.2 0.0.0.255
[RouterB-ospf-1-area-0.0.0.1] quit
[RouterB-ospf-1] quit

# Configure Router C.
[RouterC] router id 10.3.3.3
[RouterC] ospf
[RouterC-ospf-1] area 1
[RouterC-ospf-1-area-0.0.0.1] network 10.3.1.3 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] network 10.4.1.3 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] network 10.5.1.1 0.0.0.255
[RouterC-ospf-1-area-0.0.0.1] quit
[RouterC-ospf-1] quit

# Configure Router D.
[RouterD] router id 10.4.4.4
[RouterD] ospf
[RouterD-ospf-1] area 1
[RouterD-ospf-1-area-0.0.0.1] network 10.4.1.4 0.0.0.255
[RouterD-ospf-1-area-0.0.0.1] quit
[RouterD-ospf-1] quit

Step 3 Enable OSPF IP FRR on Router A.


# Enable OSPF IP FRR on Router A.
[RouterA] ospf
[RouterA-ospf-1] frr
[RouterA-ospf-1-frr] loop-free-alternate
[RouterA-ospf-1-frr] quit
[RouterA-ospf-1] quit

Step 4 Verify the configuration.


# View information about the route from Router A to Router D. You can find that
OSPF generates a backup route because OSPF IP FRR is enabled.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 289


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterA] display ospf routing router-id 10.4.4.4

OSPF Process 1 with Router ID 10.1.1.1

Destination : 10.4.4.4 Route Type : Intra-area


Area : 0.0.0.1 AdvRouter : 10.4.4.4
Type : Normal Age : 00h31m27s
URT Cost : 59
NextHop : 10.3.1.3 Interface : GigabitEthernet1/0/2
Backup Nexthop : 10.2.1.2 Backup Interface : GigabitEthernet1/0/1
Backup Type : LFA LINK

The preceding display shows that a backup route is generated on Router A.

----End

Configuration Files
● Configuration file of Router A
#
sysname RouterA
#
router id 10.1.1.1
#
interface GigabitEthernet1/0/1
ip address 10.2.1.1 255.255.255.0
ospf cost 9
#
interface GigabitEthernet1/0/2
ip address 10.3.1.1 255.255.255.0
ospf cost 4
#
ospf 1
frr
loop-free-alternate
area 0.0.0.1
network 10.2.1.1 0.0.0.255
network 10.3.1.1 0.0.0.255
#
return

● Configuration file of Router B


#
sysname RouterB
#
router id 10.2.2.2
#
interface GigabitEthernet1/0/1
ip address 10.2.1.2 255.255.255.0
ospf cost 9
#
interface GigabitEthernet1/0/2
ip address 10.5.1.2 255.255.255.0
ospf cost 5
#
ospf 1
area 0.0.0.1
network 10.5.1.2 0.0.0.255
network 10.2.1.2 0.0.0.255
#
return

● Configuration file of Router C


#
sysname RouterC
#
router id 10.3.3.3
#

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 290


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

interface GigabitEthernet1/0/1
ip address 10.3.1.3 255.255.255.0
ospf cost 4
#
interface GigabitEthernet1/0/2
ip address 10.4.1.3 255.255.255.0
ospf cost 55
#
interface GigabitEthernet1/0/3
ip address 10.5.1.1 255.255.255.0
ospf cost 5
#
ospf 1
area 0.0.0.1
network 10.3.1.3 0.0.0.255
network 10.4.1.3 0.0.0.255
network 10.5.1.1 0.0.0.255
#
return

● Configuration file of Router D


#
sysname RouterD
#
router id 10.4.4.4
#
interface GigabitEthernet1/0/1
ip address 10.4.1.4 255.255.255.0
ospf cost 55
#
ospf 1
area 0.0.0.1
network 10.4.1.4 0.0.0.255
#
return

5.24.7 Example for Configuring BFD for OSPF

Networking Requirements
As shown in Figure 5-41, it is required as follows:
● Run OSPF between Router A, Router B, and Router C.
● Enable BFD of the OSPF process on Router A, Router B, and Router C.
● Traffic is transmitted on the active link Router A -> Router B. The link Router
A -> Router C -> Router B acts as the standby link.
● BFD of the interface is configured on the link between Router A and Router B.
When a fault occurs on the link, BFD can quickly detect the fault and notify
OSPF of the fault; therefore, the traffic is transmitted on the standby link.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 291


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-41 Networking diagram for configuring BFD for OSPF

RouterA RouterB GE3/0/0


172.16.1.1/24
GE2/0/0 GE2/0/0
GE1/0/0 10.3.3.1/24 10.3.3.2/24 GE1/0/0
10.1.1.1/24 10.2.2.2/24

GE1/0/0 GE2/0/0
10.1.1.2/24 10.2.2.1/24 Area0
RouterC

Configuration Roadmap
The configuration roadmap is as follows:
1. Enable the basic OSPF functions on each router.
2. Enable global BFD.
3. Enable the detection mechanism on Router A and Router B.

Procedure
Step 1 Assign an IP address to each router interface.
# Configure IP addresses for all interfaces of RouterA.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ip address 10.1.1.1 255.255.255.0
[RouterA-GigabitEthernet1/0/0] quit
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0] ip address 10.3.3.1 255.255.255.0
[RouterA-GigabitEthernet2/0/0] quit

The configurations of RouterB and RouterC are similar to the configuration of


RouterA, and are not mentioned here.
Step 2 Configure the basic OSPF functions.
# Configure Router A.
[RouterA] router id 10.1.1.1
[RouterA] ospf
[RouterA-ospf-1] area 0
[RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] network 10.3.3.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] quit
[RouterA-ospf-1] quit

# Configure Router B.
[RouterB] router id 10.2.2.2
[RouterB] ospf

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 292


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] network 10.3.3.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] quit

# Configure Router C.
[RouterC] router id 10.3.3.3
[RouterC] ospf
[RouterC-ospf-1] area 0
[RouterC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] quit
[RouterC-ospf-1] quit

# After the preceding configurations are complete, run the display ospf peer
command. You can view that the neighboring relationship is set up between
Router A, Router B, and Router C. Take the display of Router A as an example:
<RouterA> display ospf peer
OSPF Process 1 with Router ID 10.1.1.1
Neighbors
Area 0.0.0.0 interface 10.1.1.1(GigabitEthernet1/0/0)'s neighbors
Router ID: 10.3.3.3 Address: 10.1.1.2
State: Full Mode:Nbr is Master Priority: 1
DR: 10.1.1.1 BDR: 10.1.1.2 MTU: 0
Dead timer due in 38 sec
Retrans timer interval: 5
Neighbor is up for 00:00:15
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 10.3.3.1(GigabitEthernet2/0/0)'s neighbors
Router ID: 10.2.2.2 Address: 10.3.3.2
State: Full Mode:Nbr is Master Priority: 1
DR: 10.3.3.1 BDR: 10.3.3.2 MTU: 0
Dead timer due in 25 sec
Retrans timer interval: 5
Neighbor is up for 00:00:59
Authentication Sequence: [ 0 ]

# Display the information in the OSPF routing table on Router A. You can view the
routing entries to Router B and Router C. The next hop address of the route to
172.16.1.0/24 is 10.3.3.2 and traffic is transmitted on the active link Router A ->
Router B.
<RouterA> display ospf routing
OSPF Process 1 with Router ID 10.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 2 Transit 10.3.3.2 10.2.2.2 0.0.0.0
10.3.3.0/24 1 Transit 10.3.3.1 10.1.1.1 0.0.0.0
10.2.2.0/24 2 Transit 10.3.3.2 10.2.2.2 0.0.0.0
10.2.2.0/24 2 Transit 10.1.1.2 10.2.2.2 0.0.0.0
10.1.1.0/24 1 Transit 10.1.1.1 10.1.1.1 0.0.0.0
Total Nets: 5
Intra Area: 5 Inter Area: 0 ASE: 0 NSSA: 0

Step 3 Configure OSPF BFD.


# Enable global BFD on Router A.
[RouterA] bfd
[RouterA-bfd] quit
[RouterA] ospf
[RouterA-ospf-1] bfd all-interfaces enable

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 293


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

[RouterA-ospf-1] quit

# Enable global BFD on Router B.


[RouterB] bfd
[RouterB-bfd] quit
[RouterB] ospf
[RouterB-ospf-1] bfd all-interfaces enable
[RouterB-ospf-1] quit

# Enable global BFD on Router C.


[RouterC] bfd
[RouterC-bfd] quit
[RouterC] ospf
[RouterC-ospf-1] bfd all-interfaces enable
[RouterC-ospf-1] quit

# After the preceding configurations are complete, run the display ospf bfd
session all command on Router A or Router B. You can view that the status of the
BFD session is Up.
Take the display of Router A as an example:
[RouterA] display ospf bfd session all
OSPF Process 1 with Router ID 10.1.1.1
Area 0.0.0.0 interface 10.1.1.1(GigabitEthernet1/0/0)'s BFD Sessions
NeighborId:10.3.3.3 AreaId:0.0.0.0 Interface:GigabitEthernet1/0/0
BFDState:up rx :500 tx :500
Multiplier:4 BFD Local Dis:8195 LocalIpAdd:10.1.1.1
RemoteIpAdd:10.1.1.2 Diagnostic Info:No diagnostic information
Area 0.0.0.0 interface 10.3.3.1(GigabitEthernet2/0/0)'s BFD Sessions
NeighborId:10.2.2.2 AreaId:0.0.0.0 Interface:GigabitEthernet2/0/0
BFDState:up rx :500 tx :500
Multiplier:4 BFD Local Dis:8194 LocalIpAdd:10.3.3.1
RemoteIpAdd:10.3.3.2 Diagnostic Info:No diagnostic information

Step 4 Configure BFD of the interface.


# Configure BFD on GE 2/0/0 of Router A, set the minimum interval for sending
the packets and the minimum interval for receiving the packets to 500 ms, and set
the local detection time multiple to 4.
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0] ospf bfd enable
[RouterA-GigabitEthernet2/0/0] ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4
[RouterA-GigabitEthernet2/0/0] quit

# Configure BFD on GE 2/0/0 of Router B, set the minimum interval for sending
the packets and the minimum interval for receiving the packets to 500 ms, and set
the local detection time multiple to 4.
[RouterB] interface gigabitethernet 2/0/0
[RouterB-GigabitEthernet2/0/0] ospf bfd enable
[RouterB-GigabitEthernet2/0/0] ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4
[RouterB-GigabitEthernet2/0/0] quit

# After the preceding configurations are complete, run the display ospf bfd
session all command on Router A or Router B. You can view that the status of the
BFD session is Up.
Take the display of Router B as an example:
[RouterB] display ospf bfd session all

OSPF Process 1 with Router ID 10.2.2.2


Area 0.0.0.0 interface 10.3.3.2(GigabitEthernet2/0/0)'s BFD Sessions

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 294


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

NeighborId:10.1.1.1 AreaId:0.0.0.0 Interface: GigabitEthernet2/0/0


BFDState:up rx :500 tx :500
Multiplier:4 BFD Local Dis:8198 LocalIpAdd:10.3.3.2
RemoteIpAdd:10.3.3.1 Diagnostic Info:No diagnostic information

Step 5 Verify the configuration.


# Run the shutdown command on GE 2/0/0 of Router B to simulate the active
link failure.
[RouterB] interface gigabitethernet 2/0/0
[RouterB-GigabitEthernet2/0/0] shutdown

# Display the routing table on Router A. The standby link Router A -> Router C ->
Router B takes effect after the active link fails. The next hop address of the route
to 172.16.1.0/24 becomes 10.1.1.2.
<RouterA> display ospf routing
OSPF Process 1 with Router ID 10.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 3 Transit 10.1.1.2 10.2.2.2 0.0.0.0
10.3.3.0/24 1 Transit 10.3.3.1 10.1.1.1 0.0.0.0
10.2.2.0/24 2 Transit 10.1.1.2 10.2.2.2 0.0.0.0
10.1.1.0/24 1 Transit 10.1.1.1 10.1.1.1 0.0.0.0
Total Nets: 4
Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0

----End

Configuration Files
● Configuration file of Router A
#
sysname RouterA
#
router id 10.1.1.1
#
bfd
#
interface GigabitEthernet1/0/0
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 10.3.3.1 255.255.255.0
ospf bfd enable
ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4
#
ospf 1
bfd all-interfaces enable
area 0.0.0.0
network 10.3.3.0 0.0.0.255
network 10.1.1.0 0.0.0.255
#
return

● Configuration file of Router B


#
sysname RouterB
#
router id 10.2.2.2
#
bfd
#
interface GigabitEthernet1/0/0

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 295


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

ip address 10.2.2.2 255.255.255.0


#
interface GigabitEthernet2/0/0
ip address 10.3.3.2 255.255.255.0
ospf bfd enable
ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4
#
interface GigabitEthernet3/0/0
ip address 172.16.1.1 255.255.255.0
#
ospf 1
bfd all-interfaces enable
area 0.0.0.0
network 10.3.3.0 0.0.0.255
network 10.2.2.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
return

● Configuration file of Router C


#
sysname RouterC
#
router id 10.3.3.3
#
bfd
#
interface GigabitEthernet1/0/0
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 10.2.2.1 255.255.255.0
#
ospf 1
bfd all-interfaces enable
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.2.2.0 0.0.0.255
#
return

5.24.8 Example for Configuring OSPF GTSM

Networking Requirements
On the network shown in Figure 5-42, routers run OSPF and GTSM is enabled on
RouterA, RouterB, and RouterC.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 296


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Figure 5-42 Networking diagram of OSPF GTSM

RouterB

Virtual Link
GE1/0/0
192.168.1.2/24

GE1/0/0 GE3/0/0 GE1/0/0


10.1.1.2/8 10.1.1.1/8 192.168.1.1/24
Network
GE2/0/0
RouterA 192.168.2.1/24
RouterD

Area0 GE2/0/0
192.168.2.2/24
Virtual Link

RouterC
Area1

Configuration Roadmap
The configuration roadmap is as follows:
1. Configure OSPF.
2. Enable GTSM on each router and specify a valid TTL range for packets.

Procedure
Step 1 Configure an IP address for each interface.
# Configure IP addresses for all interfaces of RouterA.
<Huawei> system-view
[Huawei] sysname RouterA
[RouterA] interface gigabitethernet 1/0/0
[RouterA-GigabitEthernet1/0/0] ip address 192.168.1.1 255.255.255.0
[RouterA-GigabitEthernet1/0/0] quit
[RouterA] interface gigabitethernet 2/0/0
[RouterA-GigabitEthernet2/0/0] ip address 192.168.2.1 255.255.255.0
[RouterA-GigabitEthernet2/0/0] quit
[RouterA] interface gigabitethernet 3/0/0
[RouterA-GigabitEthernet3/0/0] ip address 10.1.1.1 255.0.0.0.0
[RouterA-GigabitEthernet3/0/0] quit

The configurations of RouterB, RouterC and RouterD are similar to the


configuration of RouterA, and are not mentioned here.
Step 2 Configure basic OSPF functions (see Example for Configuring Basic OSPF
Functions).
Step 3 Configure OSPF GTSM.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 297


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

# On RouterA, set the maximum valid TTL range for packets from RouterA to
other routers is 255 to 255.
[RouterA] ospf valid-ttl-hops 1

# On RouterB, set the maximum valid TTL range for packets from RouterB to
other routers is 254 to 255.
[RouterB] ospf valid-ttl-hops 2

# On RouterC, set the maximum valid TTL range for packets from RouterC to
other routers is 254 to 255.
[RouterC] ospf valid-ttl-hops 2

Step 4 Verify the configuration.


# Check whether OSPF neighbor relationships between routers are successfully
established. Take the display of RouterC as an example. The neighbor relationship
is Full, indicating that the neighbor relationship is successfully established.
[RouterC] display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.2.2(GigabitEthernet2/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.2.1
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.2.2 BDR: 192.168.2.1 MTU: 0
Dead timer due in 36 sec
Retrans timer interval: 5
Neighbor is up for 00:15:04
Authentication Sequence: [ 0 ]

# On Router C, run the display gtsm statistics all command. You can view GTSM
statistics on RouterC. The default behavior is pass, no illegal packets exist, and the
number of discarded packets is 0.
<RouterC> display gtsm statistics all
GTSM Statistics Table
----------------------------------------------------------------
SlotId Protocol Total Counters Drop Counters Pass Counters
----------------------------------------------------------------
0 BGP 0 0 0
0 BGPv6 0 0 0
0 OSPF 0 0 0
0 LDP 0 0 0
1 BGP 0 0 0
1 BGPv6 0 0 0
1 OSPF 0 0 0
1 LDP 0 0 0
2 BGP 0 0 0
2 BGPv6 0 0 0
2 OSPF 0 0 0
2 LDP 0 0 0
3 BGP 0 0 0
3 BGPv6 0 0 0
3 OSPF 0 0 0
3 LDP 0 0 0
----------------------------------------------------------------

----End

Configuration files
● Configuration file of RouterA
#

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 298


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

sysname RouterA
#
router id 1.1.1.1
#
interface GigabitEthernet1/0/0
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 10.1.1.1 255.0.0.0
#
ospf 1
area 0.0.0.0
network 10.0.0.0 0.255.255.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
ospf valid-ttl-hops 1
#
return
● Configuration file of RouterB
#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
ospf valid-ttl-hops 2
#
return
● Configuration file of RouterC
#
sysname RouterC
#
router id 3.3.3.3
#
interface GigabitEthernet2/0/0
ip address 192.168.2.2 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.2.0 0.0.0.255
#
ospf valid-ttl-hops 2
#
return
● Configuration file of RouterD
#
sysname RouterD
#
router id 4.4.4.4
#
interface GigabitEthernet1/0/0
ip address 10.1.1.2 255.0.0.0
#
ospf 1
area 0.0.0.0
network 10.0.0.0 0.255.255.255

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 299


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

#
return

5.25 Troubleshooting OSPF

5.25.1 OSPF Neighbor Relationship Cannot Be Established


Fault Symptom
OSPF neighbor relationship cannot be established between two devices.

Procedure
Step 1 Check whether the physical status and protocol status of interfaces on both ends
are Up and stable, whether packets are lost on the interfaces, and whether the
two devices can ping each other with large packets.

If the physical status of the interfaces is not Up or unstable (interfaces flap for
example), check the physical link and link layer protocol and ensure that the
physical status and protocol status of the interfaces are Up and the interfaces
have no error packet statistics.

You can perform a ping test for a long time to check whether packets are lost on
the interfaces and ping with large packets (longer than 1500 bytes) to check
whether the two devices can ping each other with large packets.

Step 2 Check whether the two devices have the same OSPF process router ID.

Run the display ospf [ process-id ] brief command on the two devices to check
the OSPF process router ID.

Each router ID in an OSPF process must be unique. Otherwise, devices on both


ends cannot establish OSPF neighbor relationships and routing information will be
incorrect. You need to configure a unique router ID for each OSPF process on the
devices.

If the two devices have the same OSPF process router ID, run the ospf [ process-
id ] router-id router-id command in the system view to change the OSPF process
router ID and ensure that the two devices have different OSPF process router IDs.

After changing the OSPF process router ID, you must run the reset ospf [ process-
id ] process command in the user view to make the configured router ID take
effect.

Step 3 Check whether the two devices have the same OSPF area ID.

Run the display ospf [ process-id ] brief command on the two devices to check
the OSPF area ID.

If the two devices have different OSPF area IDs, run the area area-id command in
the OSPF view to change the OSPF area ID and ensure that the two devices have
the same OSPF area ID.

Step 4 Check whether OSPF interfaces on both ends have the same network type.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 300


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Run the display ospf [ process-id ] interface command on the two devices to
check the OSPF interface network type.
The network types of the OSPF interfaces on both ends of a link must be the
same; otherwise, the two interfaces cannot establish an OSPF neighbor
relationship.
● When the network type of an OSPF interface on one end is broadcast and
that of an OSPF interface on the other end is P2P, the two interfaces can still
establish an OSPF neighbor relationship but cannot learn routing information
from each other.
● When the network type of an OSPF interface on one end is P2MP and that of
an OSPF interface on the other end is P2P, the two interfaces can still
establish an OSPF neighbor relationship but cannot learn routing information
from each other. To ensure that the two interfaces learn routing information
from each other, configure the same interval for sending hello packets and
same neighbor holddown time on the two interfaces.
If the network types of the two OSPF interfaces are different, run the ospf
network-type { broadcast | nbma | p2mp | p2p } command in the OSPF interface
view to change the OSPF interface network type and ensure that the two OSPF
interfaces have the same network type.

NOTE

If the network types of OSPF interfaces on both ends are both NBMA, you must run the
peer ip-address [ dr-priority priority ] command in the OSPF view to configure NBMA
neighbors.

Step 5 Check whether OSPF interfaces on both ends have the same IP address mask.
Run the display current-configuration interface interface-type interface-number
command on the two devices to check the IP address of the specified OSPF
interface.
The IP address masks of the OSPF interfaces on both ends of a link must be the
same; otherwise, the two interfaces cannot establish an OSPF neighbor
relationship. On a P2MP network, however, you can run the ospf p2mp-mask-
ignore command in the OSPF interface view to disable a device from checking the
network mask so that an OSPF neighbor relationship can be established.
If the two OSPF interfaces have different IP address masks, run the ip address ip-
address { mask | mask-length } command in the OSPF interface view to change
the IP address mask and ensure that the two OSPF interfaces have the same IP
address mask.
Step 6 Check whether IP addresses of OSPF interfaces on both ends belong to the
network segment specified by the network command.
Run the display current-configuration interface interface-type interface-number
command on devices on both ends to check IP addresses of OSPF interfaces on
both ends and run the display current-configuration configuration ospf
command on the two devices to check the OSPF process configuration.
OSPF can run on an interface only when the following conditions are met:
● The mask length of the IP address of the interface is longer than or equal to
that specified by the network command. OSPF uses reverse mask. For
example 0.0.0.255 indicates that the mask length is 24 bits.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 301


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

● The primary IP address of the interface belongs to the network segment


specified by the network command.

If the IP address of the interface does not meet the preceding conditions, run the
ip address ip-address { mask | mask-length } command in the OSPF-enabled
interface view to change the IP address of the interface or run the network
command in the view of the area that the OSPF process belongs to change the
configured network segment so that the IP address of the interface can meet the
preceding conditions.

Step 7 Check whether the DR priorities of OSPF interfaces on both ends are both 0.

Run the display ospf [ process-id ] interface command on the two devices to
check the OSPF interface DR priority.

On a broadcast or NBMA network, there must be at least one OSPF interface of


which the DR priority is not 0 to ensure that the DR can be elected. Otherwise, the
neighbor status of devices on both ends can be only 2-Way.

If the DR priorities of the two OSPF interfaces are both 0, run the ospf dr-priority
priority command in the OSPF interface view to change the DR priority and ensure
that there is at least one OSPF interface of which the DR priority is not 0.

----End

5.25.2 OSPF Cannot Find Routes of a Non-Local Area

Symptom
When the link is normal, OSPF cannot find routes of a non-local area.

Procedure
Step 1 Check whether the area where the device resides is connected to the backbone
area.

Run the display ospf [ process-id ] brief command on the ABR in the area where
the device resides to check area configuration.

OSPF requires that all non-backbone areas remain connected to the backbone
area.

If no backbone area information is configured on the ABR, run the area area-id
command in the OSPF view to modify the OSPF area information. Ensure that at
least one interface on the ABR runs in the backbone area.

NOTE

If some non-backbone areas cannot be connected to the backbone area due to networking
restrictions, configure OSPF virtual links to resolve this problem.

Step 2 Check whether the area where the device resides is a totally stub area.

Run the display current-configuration configuration ospf [ process-id ]


command on the device to check the OSPF process configuration.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 302


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

If you specify the parameter no-summary (run the stub no-summary command
in the OSPF area view) when configuring a non-backbone area as a stub area on
the ABR, the area is configured as a totally stub area.
A totally stub area allows only intra-area routes to be advertised within the area.
If the area where the device resides is configured as a totally stub area, perform
the following configuration based on service requirements:
● To restore the totally stub area to a common area, run the undo stub
command in the OSPF area view on all devices in the area.
● To restore a totally stub area to a stub area, run the undo stub command in
the OSPF area view on the ABR in the area and then run the stub command.
Step 3 Check whether the area where the device resides is a totally NSSA.
Run the display current-configuration configuration ospf [ process-id ]
command on the device to check the OSPF process configuration.
If you specify the parameter no-summary (run the nssa no-summary command
in the OSPF area view) when configuring a non-backbone area as an NSSA on the
ABR, the area is configured as a totally NSSA.
A totally NSSA allows only intra-area routes to be advertised within the area.
If the area where the device resides is configured as a totally NSSA, perform the
following configuration based on service requirements:
● To restore the totally NSSA to a common area, run the undo nssa command
in the OSPF area view on all devices in the area.
● To restore a totally NSSA to a stub area, run the undo nssa command in the
OSPF area view on the ABR in the area and then run the nssa command.

----End

5.26 FAQ About OSPF

5.26.1 Which OSPF Interfaces Require Peers?


You must configure peers on interfaces in the open shortest path first (OSPF)
view, if the link type of the network is Non-Broadcast Multi-Access (NBMA).

5.26.2 How Do I Calculate the Cost of an IGP Route?


IGP protocols include RIP, IS-IS, and OSPF.

Calculating the Cost of a RIP Route


RIP measures the distance from the local end to the destination by hop count. The
hop count is also called the metric. RIP defines that the hop count from a router
to a directly connected network is 0, and the hop count from a router to a
network that can be reached through another router is 1. The hop count increases
with the number of routers between the local router and the destination network.
To limit the convergence time, RIP defines that the hop count must be an integer

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 303


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

ranging from 0 to 15. A hop count of 16 or greater is defined as infinite. That is,
the destination network or host is unreachable.

An interface does not add the cost to RIP routes to be received, but increases the
cost by 1 for the sent RIP routes. You can run the following commands to change
the cost of routes:
● After you run the rip metricin command, the AR adds an additional metric to
a received route, and then adds the route to the routing table. Then the
metric of the route changes in the routing table. This command affects route
selection on the local device and other devices.
● After you run the rip metricout command, the AR adds an additional metric
to a route when advertising the route. The metric of the route, however, does
not change in the routing table. This command does not affect route selection
on the local device, but affects route selection on other devices.

NOTE

You can run one of the following commands to set the metric of the imported routes. The
following commands are listed in descending order of priority:
● Run the apply cost command to set the route cost.
● Run the import-route (RIP) command to set the cost for imported routes.
● Run the default-cost (RIP) command to set the cost for default routes.

Calculating the Cost of an IS-IS Route


On an IS-IS network, the default cost of an IS-IS interface is 10. The cost of an IS-
IS route is the sum of costs of all links between the source device and the
destination device.

The link cost of an IS-IS interface can be calculated in the following modes in
descending order of priority:
● Run the isis cost command to set the link cost for a specified IS-IS interface.
● Run the circuit-cost command to set the link cost for all IS-IS interfaces.
● Run the auto-cost enable command to enable automatic calculation of the
link cost of an interface.
Before using the auto-cost enable command, run the bandwidth-reference
command to set the bandwidth reference value. By default, the bandwidth
reference value is 100 Mbit/s. The bandwidth reference value takes effect only
when the cost type is wide or wide-compatible. The cost of each interface is
calculated as follows:
– Cost of each interface = (Bandwidth reference value/Interface bandwidth)
x 10
If the cost type is narrow, narrow-compatible, or compatible, the cost of each
interface can be obtained from Table 5-23.

Table 5-23 Relationship between the IS-IS interface cost and interface
bandwidth

Cost Bandwidth Range

60 Interface bandwidth ≤ 10 Mbit/s

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 304


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Cost Bandwidth Range

50 10 Mbit/s < interface bandwidth ≤ 100


Mbit/s

40 100 Mbit/s < interface bandwidth ≤


155Mbit/s

30 155 Mbit/s < interface bandwidth ≤ 622


Mbit/s

20 622 Mbit/s < Interface bandwidth ≤ 2.5


Gbit/s

10 Interface bandwidth > 2.5 Gbit/s

NOTE

A Level-1 router in the Level-1 area must communicate with a router outside the Level-1
area through the default route generated on the Level-1-2 router. Therefore, the cost of the
route from the Level-1 router to the router outside the Level-1 area is the cost of the route
from the Level-1 router to the closest Level-1-2 router.
IS-IS can be configured to specify the cost for the imported route or retain the original cost
of the imported route.

Calculating the Cost of an OSPF Route


Similar to the cost of an IS-IS route, the cost of an OSPF route is the sum of costs
of all links along the route. By default, the link cost of an OSPF interface is 1.
You can run the ospf cost command to set the cost for a specified OSPF interface.
If no interface cost is configured, the system calculates the interface cost using the
following formula:
● Cost of each interface = Bandwidth reference value/Interface bandwidth
The integer portion of the calculation result is taken as the cost of the interface. If
the value is smaller than 1, OSPF takes 1 as the interface cost. By default, the
bandwidth reference value is 100 Mbit/s. You can change the cost of an OSPF
interface by running the bandwidth-reference command to change the
bandwidth reference value.

NOTE

Packets between a stub router (or totally stub router) and a router outside an AS and
packets between areas are forwarded through the default route generated on the closest
ABR. Therefore, the cost of the route from the stub router (or totally stub router) to the
router outside the AS and the cost of an inter-area route is the cost of the route from the
stub router (or totally stub router) to the closest ABR. Similarly, the cost of the route from
an NSSA router to a router in another area or AS is the cost of the route from the NSSA
router to the closest ABR or ASBR.

5.26.3 Why Cannot Interfaces of Different Types Generate


Equal-Cost Routes and Establish OSPF Load Balancing?
OSPF can automatically calculate the cost of an interface based on the interface
bandwidth. The calculation formula is: Interface cost = Bandwidth reference value/

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 305


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

Interface bandwidth. The bandwidth reference value is configurable. The default


value is 100 Mbit/s. Routes generated by OSPF have the same priority (10 by
default). The interface cost, however, depends on the interface type. Interfaces of
different types have different costs; therefore, the interfaces cannot generate
equal-cost routes, leading to failure in establishing load balancing.

5.26.4 How Can I Set the cost Value When OSPF Imports
External Routes?
When OSPF imports external routes, the cost of original routes is not used. By
default, the cost of the external routes imported by OSPF is 1.
To change the default cost value of external routes imported by OSPF, run the
default { cost { cost | inherit-metric } command. In the preceding command:
● cost: specifies the cost of the imported external routes. The value is an integer
ranging from 0 to 16777214.
● inherit-metric: indicates that the cost of the imported external routes is the
cost carried in the route.

5.26.5 What Are the Rules for Selecting Routes Belonging to


Different OSPF Processes?
OSPF supports multi-processes. Multiple OSPF processes can run on the same
router independently.
Assume that a router is configured with two OSPF processes: process 1 and
process 2. They are independent of each other. Therefore, both of the routes
belonging to process 1 and process 2 are advertised to the routing management
(RM) module. Route selection between the two processes complies with the
following rules:
1. The RM module checks the protocol preference of process 1 and process 2.
The route belonging to the process with higher protocol preference is selected
as the optimal route.
NOTE

To set the preference of an OSPF route in the specified process, run the preference
[ ase ] { preference | route-policy route-policy-name } * command. The default
preference of an OSPF route is 10. When an ASE is specified, the default value is 150.
2. When the protocol preferences of the two processes are the same, the RM
module compares the cost of the two routes. The route with smaller cost
value is selected as the optimal route.
NOTE

When selecting the optimal route, the RM module first compares the protocol
preference. The RM module compares the cost of routes only when the protocol
preferences are the same.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 306


Huawei AR Series Access Routers
CLI-based Configuration Guide - IP Unicast Routing 5 OSPF Configuration

5.26.6 Why the Number of Routes in the OSPF Routing Table


of the OSPF VPN Multi-instance Is Less than the Predicted
Number?
In the OSPF VPN multi-instance, loops may occur if PEs and CEs learn BGP and
OSPF routes from each other. You can set the DN in Type3, Type5, or Type7 LSAs
advertised by PEs to 1 so that CEs ignore the LSAs with the DN value of 1. These
LSAs are not used in route calculation, which prevents loops.
If the preceding method is used to prevent loops, the number of routes in the
OSPF routing table is less than the predicted number. To use the LSAs with DN 1
in route calculation, run the vpn-instance-capability simple command on CEs to
disable routing loop detection.

5.26.7 How Much Time Will It Take for OSPF to Import


External Routes?
OSPF will import external routes within milliseconds.

Issue 12 (2024-08-30) Copyright © Huawei Technologies Co., Ltd. 307

You might also like