HUAWEI - OSPF Configuration
HUAWEI - OSPF Configuration
HUAWEI - OSPF Configuration
5 OSPF Configuration
Definition
The Open Shortest Path First (OSPF) protocol, developed by the Internet Engineering Task
Force (IETF), is a link-state Interior Gateway Protocol (IGP).
At present, OSPF Version 2, defined in RFC 2328, is intended for IPv4, and OSPF Version 3,
defined in RFC 2740, is intended for IPv6. Unless otherwise stated, OSPF stated in this
document refers to OSPF Version 2.
Purpose
Before the emergence of OSPF, the Routing Information Protocol (RIP) is widely used on
networks as an IGP.
RIP is a routing protocol based on the distance vector algorithm. Due to its slow convergence,
routing loops, and poor scalability, RIP is gradually replaced by OSPF.
As a link-state protocol, OSPF can solve many problems encountered by RIP. Additionally,
OSPF features the following advantages:
l Receives or sends packets in multicast mode to reduce load on the Router that does not
run OSPF.
l Supports Classless Interdomain Routing (CIDR).
l Supports load balancing among equal-cost routes.
l Supports packet encryption.
With the preceding advantages, OSPF is widely accepted and used as an IGP.
5.2 Principle
Packet Type
Database Description (DD) packet Contains brief information about the local link-state
database (LSDB) and synchronizes the LSDBs on
two devices.
Link State Request (LSR) packet Requests the required LSAs from neighbors.
LSR packets are sent only after DD packets are
exchanged successfully.
Link State Update (LSU) packet Sends the required LSAs to neighbors.
LSA Type
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.
Router Type
Figure 5-1 lists common Router types used in OSPF.
Area1 Area4
Area0
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.
ASBR (AS Boundary An ASBR exchanges routing information with other ASs.
Router) 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 has imported external routing information will
become an ASBR.
Route Type
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-4 lists route types in descending priority order.
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 Type
Common area OSPF areas are common areas by default. Common areas include
standard areas and backbone areas.
l A standard area is the most common area and transmits intra-
area routes, inter-area routes, and external routes.
l 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 only intra-
area and inter-area routes.
Compared with a non-stub area, the 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.
Totally stub area A totally stub area does not advertise AS external routes or inter-
area routes, but only intra-area routes.
Compared with a non-stub area, the 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.
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 the totally stub areas 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.
Non-Broadcast Multi- A network with the link layer protocol of frame relay (FR), X.25
Access (NBMA) is an NBMA network by default.
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-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.
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.
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.
OSPF has eight state machines: Down, Attempt, Init, 2-way, Exstart, Exchange, Loading, and
Full.
l Down: It is in the initial stage of setting up sessions between neighbors. The state
machine is Down when a router fails to receive Hello packets from its neighbor before
the dead interval expires.
l Attempt: It occurs only on an NBMA network. The state machine is Attempt when a
neighbor does not reply with Hello packets after the dead interval has expired. The local
router, however, keeps sending Hello packets to the neighbor at every poll interval.
l Init: The state machine is Init after a router receives Hello packets.
l 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 neighbor
relationship is established, and will become Exstart if a neighbor relationship is
established.
l 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.
l 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.
l Loading: The state machine is Loading after a router has finished exchanging DD
packets with its neighbor.
l Full: The state machine is Full when the LSA retransmission list is empty.
l Area-based authentication
l Interface-based authentication
When both area-based and interface-based authentication methods are configured, interface-
based authentication takes effect.
l An ABR advertises default Type 3 Summary LSAs to instruct routers within an area to
forward packets between areas.
l 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.
Table 5-7 lists principles for advertising default routes in different areas.
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.
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 LSAs 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.
Routing policies used by OSPF include the route-policy, access-list, and prefix-list.
l 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.
l 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.
l 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.
l Learning inter-area LSAs
You can run a command to 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-8 Differences between inter-area LSA learning and route learning
Inter-area LSA Route Learning
Learning
Directly filters the Filters the routes that are calculated based on LSAs, but does
incoming LSAs. not filter LSAs. This means that all incoming LSAs are
learned.
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.
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.
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.
l After RFC 1583 compatibility is enabled, OSPF use the route selection rules defined in
RFC 1583.
l 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:
l The Router selects a route to the ASBR that originates the LSA, or to the forwarding
address (FA) described in the LSA.
l The Router selects external routes to the same destination.
By default, OSPF uses the route selection rules defined in RFC 1583.
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.
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-9 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, the At the second level
with BFD timeout period of the timer is 40s.
Principle
GE1/0/0 GE2/0/0
10.1.1.2/24 10.2.2.1/24
Area0
RouterC
Definition
Generally, Routers periodically send Hello packets through OSPF interfaces. That is, a Router
sends Hello packets at the Hello interval set by a Dead timer. Because Hello packets are sent
at a fixed interval, the speed at which OSPF neighbor relationship is established is lowered.
Smart-discover is not configured l Hello packets are sent only when the Hello timer
expires.
l The gap between the sending of two Hello packets
is the Hello interval.
l Neighbors keep waiting to receive Hello packets
within the Hello interval.
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:
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 support other
routing protocols for interworking with PEs. This simplifies management and configuration of
CEs.
Running OSPF between PEs and CEs has the following benefits:
l 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.
l 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.
l 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-3, 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.
Area0 Area0
MPLS VPN
OSPF 100 VPN1
OSPF 100 VPN1 Backbone
CE2 CE4
Area1 Area2
Site2 VPN1 Site4
VPN2
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.
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-4.
VPN
PE1 backbone PE2
Area0 Area0
Area1
Virtual link
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.
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.
l If local domain IDs are the same as or compatible with remote domain IDs in BGP
routes, PEs advertise Type 3 routes.
l Otherwise, PEs advertise Type 5 or Type 7 routes.
Both the local and remote domain IDs are The same Inter-area route
null.
The remote domain ID is the same as the The same Inter-area route
local primary domain ID or one of the local
secondary domain IDs.
The remote domain ID is different from the Not the If the local area is a non-
local primary domain ID or any of the local same NSSA, external routes are
secondary domain IDs. generated.
If the local area is an NSSA,
NSSA routes are generated.
PE1
VPN
backbone
CE1
PE2
As shown in Figure 5-5, 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.
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-12.
VPN Route Tag The VPN route tag is carried in Type When a PE detects that the
5 or Type 7 LSAs generated by PEs VPN route tag in the
according to the received BGP private incoming LSA is the same
route. as that in the local LSA, the
Not transmitted in BGP extended PE ignores this LSA.
community attributes, the VPN route Consequently, routing loops
tag is valid only on the PEs that are avoided.
receive BGP routes and generate
OSPF LSAs.
Default Route A route with the destination address PEs do not calculate default
and mask being all 0s is a default routes.
route. Default routes are used to
forward the traffic from CEs
or the sites where CEs
reside to the VPN backbone
network.
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-6, inter-AS VPN Option A is deployed. OSPF is running between PE1
and CE1. CE1 sends VPN routes to CE2.
VPN1
CE1 VPN1
BGP/MPLS CE3
BGP/MPLS
backbone backbone
PE1 AS: 100 AS: 200
PE3
ASBR1 ASBR2
MP-IBGP MP-IBGP
OSPF
PE2
PE4
CE4
CE2
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.
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:
l 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.
l 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-7, 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-7. 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-7 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: 100 AS: 200
ASBR3 ASBR4
OSPF Router ID OSPF Router ID
10.3.3.3 10.4.4.4
Multi-VPN-Instance CE
OSPF multi-instance generally runs on PEs. The devices that run OSPF multi-instance within
the LANs of users 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:
l MCEs do not need to support OSPF-BGP synchronization.
l 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.
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.
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.
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
l Type 7 LSAs are a new type of LSAs that can only be used in NSSAs and describe the
imported external routes.
l Type 7 LSAs are generated by ASBRs in an NSSA and flooded only in the NSSA where
the ASBRs reside.
l 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.
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 ExStart or Down. The flapping_event triggers flapping detection.
Threshold: flapping suppression threshold. When the flapping_count exceeds the threshold,
flapping suppression takes effect.
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.
NOTE
The value of resume-interval must be greater than that of detecting-interval.
Flapping suppression
l 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.
l 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:
l The suppression timer expires.
l The corresponding OSPF process is reset.
l A command is run to exit from flapping suppression.
Typical Scenarios
Basic scenario
In Figure 5-9, 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 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.
l 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.
l 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.
Router C
cost=10 cost=10
Router D
NOTE
Router A Router E
cost=65535
Router B Router C
Broadcast scenario
In Figure 5-11, 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.
Router A Router B
Router C Router D
Multi-area scenario
In Figure 5-12, 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 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.
Router C
Router A Router F
cost=10 cost=10
Area 1
Device
Area Router B Device
Router E
Area 0 B
0 cost=10
cost=10 cost=10
Router D
Scenario with both LDP-IGP synchronization and OSPF neighbor relationship flapping
suppression configured
In Figure 5-13, 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-13
lists the suppression modes that take effect in different situations.
Table 5-13 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
For example, the link between PE1 and P1 frequently flaps in Figure 5-13, 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.
Figure 5-13 Scenario with both LDP-IGP synchronization and OSPF neighbor relationship
flapping suppression configured
P1 P2
cost=10
cost=10 cost=10
P4 P3
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-14, 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.
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-14, 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.10 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.
Classification of OSPF GR
l Totally GR: indicates that when a neighbor of a router does not support GR, the router
exits from GR.
l 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.
l 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.
l Unplanned GR: indicates that a router restarts or performs the master/slave switchover
because of faults. A router performs the master/slave switchover, 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
l 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.
l The GR process runs, as shown in Figure 5-15.
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 Exit the Helper
successfully, Flush Grace-LSA successfully and
calculate routes, and generate Router-
generate LSA LSA
GR Before GR expires, the Restarter re- After the Helper receives the
succeed establishes neighbor relationships with Grace-LSA with the Age being
s. all neighbors before master/slave 3600s from the Restarter, the
switchover. neighbor relationship between
the Helper and Restarter enters
the Full state.
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
l OSPF neighbor relationships are re- l OSPF neighbor relationships are re-
established. established.
l Routes are recalculated. l Routes are recalculated.
l Forwarding table changes. l Forwarding table remains unchanged.
l Entire network detects route changes, l Except for neighbors of the device where
and route flapping occurs for a short master/slave switchover occurs, other
period of time. routers do not detect route changes.
l Packets are lost during forwarding, l No packets are lost during forwarding, and
and services are interrupted. services are not affected.
Purpose
As shown in Figure 5-16, 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.
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.
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.
l Hold-down
l Hold-max-cost
l Delay
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.
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.
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.
Entering overflow state A router deletes all non-default external routes that is
generated.
Staying in overflow state l Router does not generate non-default external routes.
l Router discards the newly received, non-default
external routes, and does not reply with an LSAck
packet.
l 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.
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.
Principles
As shown in Figure 5-17, 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.
1 LSA
LSA 4 2 LSA
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-18.
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-19, 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.
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.3.1 OSPF GR
In Figure 5-20, 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 uninterrupted
network traffic.
es RouterC
B do ter
r o u
ute y R r A
Ro notif oute
t R
Set up neighbor no that tarts
relationship and C res
RouterA
negotiate GR RouterB
Configuring OSPF Areas l In a stub area, the area 5.10 Configuring OSPF
border router (ABR) Stub Areas
does not transmit learned 5.11 Configuring OSPF
autonomous system (AS) NSSA
external routes. This
implementation reduces
entries in the routing
tables on ABRs in stub
areas and the amount of
routing information to be
transmitted.
l 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.
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.
l When a switch 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
switchs remove this
switch from the neighbor
list, and notify other
switchs. This causes the
re-calculation of SPF. If
this switch recovers
within a few seconds, the
neighbor relationship
becomes unstable. This
results in route flapping.
After being enabled with
OSPF Graceful Restart
(GR), a switch 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 switch.
License Support
OSPF is a basic feature of the CE8800&7800&6800&5800 series switches and is not under
license control.
Version Support
CE8850EI V200R002C50
CE7855EI V200R001C00
CE6810LI V100R005C10
CE6850EI V100R001C00
CE6850-48S6Q-HI V100R005C00
CE6850-48T6Q-HI/ V100R005C10
CE6850U-HI/CE6851HI
CE6855HI V200R001C00
CE6860EI V200R002C50
CE6870-24S6CQ-EI/ V200R001C00
CE6870-48S6CQ-EI
CE6870-48T6CQ-EI V200R002C50
CE6880-24S4Q2CQ-EI/ V200R002C50
CE6880-48S4Q2CQ-EI/
CE6880-48T4Q2CQ-EI
CE5850EI V100R001C00
CE5850HI V100R003C00
CE5855EI V100R005C10
OSPF Disabled
Interval for sending Hello By default, the interval for sending Hello packets is 10
packets 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 is 40
neighbors seconds on P2P and broadcast interfaces; the interval is
120 seconds on P2MP and NBMA interfaces.
Pre-configuration Tasks
Before configuring basic OSPF functions, complete the following task:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
Context
To run OSPF, the switch needs to have a router ID. A router ID of the switch is a 32-bit
unsigned integer, which uniquely identifies the switch 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
Step 2 Run:
ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] *
l The parameter process-id specifies the ID of an OSPF process. The default value is 1.
The switch 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 switchs. Therefore, different switchs can also exchange packets
even though they have different process IDs.
l The parameter router-id router-id specifies the router ID of the switch.
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.
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.
l 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.
Step 3 Run:
commit
----End
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
----End
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.
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
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
area area-id
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.
l Enable OSPF on an interface.
1. Run the following command in the system view:
interface interface-type interface-number
NOTE
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system
view to switch these interfaces to Layer 3 mode in batches.
3. Run:
ospf enable process-id area area-id
Step 4 Run:
commit
----End
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.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
area area-id
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 ] ] *
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.
Prerequisites
All configurations of basic OSPF functions are complete.
Procedure
l Run the display ospf [ process-id ] peer command in any view to check information
about OSPF neighbors.
l Run the display ospf [ process-id ] interface command in any view to check information
about OSPF interfaces.
l Run the display ospf [ process-id ] routing command in any view to check information
about the OSPF routing table.
----End
Pre-configuration Tasks
Before configuring session parameters for OSPF neighbor or adjacency relationships,
complete the following tasks:
Configuration Procedures
Perform one or more of the following configuration tasks (excluding "Checking the
Configuration") as required.
Context
After an OSPF switch 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 switch tears down the adjacency relationship
with its neighbor.
l DD packets
l LSU packets
l LSR packets
Procedure
Step 1 Run:
system-view
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 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.
NOTICE
Setting the MTU in a DD packet will lead to the re-establishment of the neighbor relationship.
Step 5 Run:
commit
----End
Prerequisites
All configurations of session parameters of the OSPF neighbor or adjacency relationship are
complete.
Procedure
l Run the display ospf [ process-id ] peer command to check information about OSPF
neighbors.
l Run the display ospf [ process-id ] brief command to check brief information about the
specified OSPF process.
Applicable Environment
According to the types of link layer protocols, OSPF classifies networks into the following
types:
l P2MP: There is no concept of P2MP in link layer protocols. Therefore, a P2MP network
must be forcibly changed from other network types.
l NBMA: If the link layer protocol is FR, X.25, OSPF defaults the network type to
NBMA.
l Broadcast: If the link layer protocol is Ethernet or FDDI, OSPF defaults the network
type to broadcast.
l P2P: If the link layer protocol is PPP, HDLC, or LAPB, OSPF defaults the network type
to P2P.
When link layer protocols remain unchanged, you can change network types and configure
OSPF features to flexibly build networks.
Pre-configuration Tasks
Before configuring OSPF attributes in different types of networks, complete the following
tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
For a P2P network For a P2MP network For an NBMA network For a broadcast network
Set the network type Set the network type Set the network type Set the network type
of the OSPF interface of the OSPF interface of the OSPF interface of the OSPF interface
to P2P to P2MP to NBMA to broadcast
Context
You can configure one of the following network types for an interface as required:
l P2MP: P2MP is not a link layer protocol. Therefore, a P2MP network must be forcibly
changed from other network types.
l NBMA: An NBMA network must be fully meshed. That is, any two switches on the
NBMA network must be directly reachable. In most cases, however, this requirement
cannot be met. In this case, you need to forcibly change the network type using
commands.
l Broadcast: To speed up the establishment of the neighbor relationship, you can change
the network type of broadcast to P2P network.
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf network-type { broadcast | nbma | p2mp | p2p [ peer-ip-ignore ] }
NOTE
Generally, the network types of OSPF interfaces on both ends of a link must be the same. Otherwise,
routes cannot be correctly calculated.
Step 5 Run:
commit
----End
Procedure
Step 1 Run:
system-view
If an Ethernet interface already has Layer 2 configuration, this command will fail to be
executed on the interface. Before running this command on the interface, delete all the Layer
2 configuration of the interface.
NOTE
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf dr-priority priority
The DR priority of the OSPF interface is set. The greater the value, the higher the priority.
By default, the DR priority of an interface is 1.
Step 5 Run:
commit
----End
Follow-up Procedure
NOTICE
Restarting or shutting down the current interface will interrupt the OSPF adjacency
relationship between devices. Therefore, perform the operation with caution.
Reconfiguring the DR priority for a device does not change the DR or BDR on a network.
You can reelect a DR or BDR by using the following methods. This, however, will result in
the interruption of the OSPF adjacency relationship between devices. Therefore, the following
methods are used only when necessary.
l Restart the OSPF processes on all the switchs.
l Run the shutdown and then undo shutdown commands on the interfaces where the
OSPF adjacency relationship is established.
Procedure
Step 1 Disable OSPF from checking the network mask.
1. Run:
system-view
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system
view to switch these interfaces to Layer 3 mode in batches.
4. Run:
ospf network-type p2mp
OSPF is disabled from checking the network mask on the P2MP network.
6. Run:
commit
The local switch 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.
4. Run:
commit
----End
Procedure
Step 1 Run:
system-view
----End
Context
On an NBMA network, devices establish neighbor relationships with adjacencies by sending
Hello packets.
Procedure
Step 1 Run:
system-view
If an Ethernet interface already has Layer 2 configuration, this command will fail to be
executed on the interface. Before running this command on the interface, delete all the Layer
2 configuration of the interface.
NOTE
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf timer poll interval
The interval for sending Poll packets on the NBMA interface is set.
The parameter interval specifies the polling interval for sending Hello packets.
Step 5 Run:
commit
----End
Prerequisites
All configurations of OSPF attributes in different types of network are complete.
Procedure
l Run the display ospf [ process-id ] interface command to check information about
OSPF interfaces.
l Run the display ospf [ process-id ] peer command to check information about OSPF
neighbors.
l Run the display ospf brief command to check the interval for sending Hello packets on
an NBMA network.
----End
Applicable Environment
Dividing an AS into different areas can reduce the number of LSAs to be transmitted on the
network and enhance OSPF extensibility. For some non-backbone areas at the edge of ASs,
you can configure these areas as stub areas to further reduce the size of the routing table and
the number of transmitted LSAs.
Pre-configuration Tasks
Before configuring OSPF stub areas, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Mandatory
procedure
Optional
procedure
Procedure
Step 1 Run:
system-view
Step 5 Run:
commit
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
area area-id
Step 4 Run:
stub [ no-summary ]
Step 5 Run:
default-cost cost
The parameter cost specifies the cost of the Type 3 default route to a stub area. The default
value is 1.
This command applies to only the ABR that is connected to a stub area.
Step 6 Run:
commit
----End
Prerequisites
All configurations of OSPF stub areas are complete.
Procedure
l Run the display ospf [ process-id ] peer command to check information about OSPF
neighbors.
l Run the display ospf [ process-id ] routing command to check information about the
OSPF routing table.
----End
Applicable Environment
An excessive number of entries in a routing table wastes network resources and causes high
central processing unit (CPU) usage. To reduce entries in a routing table, configure a non-
backbone area on the border of an AS as a stub area or an NSSA to reduce the amount of
routing information to be transmitted. For details on how to configure an OSPF stub area, see
5.10 Configuring OSPF Stub Areas.
An 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. Different from a stub area, an NSSA
allows AS external routes to be imported and advertised in the entire AS.
An OSPF stub area can save system resources but cannot import external routes. An NSSA
can be applied to a scenario in which AS external routes are to be imported but not forwarded
to save system resources.
Type 7 link state advertisements (LSAs) are used to carry imported AS external routing
information in the NSSA. Type 7 LSAs are generated by autonomous system border routers
(ASBRs) of NSSAs and flooded only in the NSSAs where ASBRs reside. The area border
router (ABR) in an NSSA selects Type 7 LSAs from the received LSAs and translates them
into Type 5 LSAs to advertise AS external routes to the other areas over the OSPF network.
NOTE
l A Type 7 LSA is a new type of LSA that has been introduced to support NSSAs and describe
imported external routes.
l Type 7 LSAs can be used to carry default route information to guide traffic to other ASs.
Pre-configuration Tasks
Before configuring an NSSA, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring switchs are reachable
at the network layer
l 5.7 Configuring Basic OSPF Functions
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
area area-id
Step 4 Run:
nssa [ default-route-advertise [ backbone-peer-ignore ] | no-import-route | no-
summary | set-n-bit | suppress-forwarding-address | translator-always |
translator-interval interval-value | zero-address-forwarding ] *
NOTE
l NSSA attributes must be configured on all devices in the NSSA using the nssa command.
l 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 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 switchs in the NSSA. The cost of the default route
to an NSSA is set and the selection of the default route is adjusted.
By default, the cost of the default route to the NSSA by the ABR is 1.
Step 6 Run:
commit
----End
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:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Perform one or more configuration tasks (excluding "Checking the Configuration") as
required.
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
l Setting the link cost for an OSPF interface
a. Run:
system-view
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch
batch interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in
the system view to switch these interfaces to Layer 3 mode in batches.
d. Run:
ospf cost cost
commit
Context
After OSPF calculates equal-cost routes, you can run the nexthop command to select the
route with the highest priority from the equal-cost routes as the next hop. The smaller the
weight, the higher the priority of the route. The default weight is 255. OSPF discovers equal-
cost routes and the number of equal-cost routes is smaller than or equal to that specified in the
maximum load-balancing number command. In this case, OSPF traffic will be balanced
among these equal-cost routes.
Procedure
Step 1 Run:
system-view
l The parameter value specifies the weight of the next hop. The default value is 255. The
smaller the weight, the higher the priority of the route.
Step 4 Run:
commit
----End
Context
The CE8800&7800&6800&5800 series switches support load balancing among equal-cost
routes. That is, you can configure multiple routes, which have the same destination and
preference.
Procedure
Step 1 Run:
system-view
The maximum number of equal-cost routes is set. The default value is 32(64 on the
CE6870EI).
NOTE
When the number of equal-cost routes is greater than number 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.
Step 4 Run:
commit
----End
Context
All devices in an OSPF routing domain must be configured with the same route selection rule.
At present, most OSPF routing domains adopt the route selection rules defined in RFC 2328.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [ process-id ]
Step 3 (Optional)Run:
rfc1583 compatible
The external route selection rules, which are compatible with RFC 1583, are configured.
NOTE
On a network, if OSPF switchs have different configurations of the external route selection rules
compatible with RFC 1583, external loops may occur.
Step 4 Run:
commit
----End
Prerequisites
All configurations of adjusting OSPF route selection are complete.
Procedure
l Run the display ospf [ process-id ] interface command to check information about
OSPF interfaces.
l Run the display ospf [ process-id ] routing command to check information about the
OSPF routing table.
----End
Pre-configuration Tasks
Before controlling OSPF routing information, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Perform one or more configuration tasks (excluding "Checking the Configuration") as
required.
Context
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.
Do as follows on the switch that functions as the ASBR running OSPF:
Procedure
l Configuring OSPF to import the routes discovered by other protocols
a. Run:
system-view
b. Run:
ospf [ process-id ]
The default values of parameters (the metric of routes, tag, and type) are set for
importing routes.
n The parameter cost cost-value specifies the default metric of the external route
imported by OSPF.
n The parameter inherit-metric indicates that the cost of the imported route is
the cost carried in the route. If the cost is not specified, the default cost set
through the default command is used as the cost of the imported route.
When OSPF imports external routes, you can set default values for some additional
parameters, such as the metric 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 when OSPF receives BGP routes.
By default, the default metric of the external routes imported by OSPF is 1; the type
of the imported external routes is Type 2; the default tag value 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:
l Run the apply cost command in a route-policy to set the cost of the imported route.
l Run the import-route command for OSPF to set the cost of the imported route.
l Run the default command to set the default cost of the imported route.
d. Run:
commit
Context
In a routing table, a default route is the route to the network 0.0.0.0 (with the mask being
0.0.0.0). You can check whether the default route is configured by using the display ip
routing-table command. If the destination address of a packet does not match any entry in the
routing table, the packet is sent through a default route. If no default route exists and the
destination address of the packet does not match any entry in the routing table, the packet is
discarded. An Internet Control Message Protocol (ICMP) packet is then sent, informing the
originating host that the destination host or network is unreachable.
Procedure
l Configuring OSPF to advertise the default route to the OSPF area
a. Run:
system-view
l 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.
l Before advertising a default route, OSPF compares the preferences of default routes.
Therefore, if a static default route is configured on an OSPF switch, 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.
d. Run:
commit
Context
Carry out the following steps on the OSPF router.
Procedure
l Configuring ABR route aggregation
a. Run:
system-view
Procedure
Step 1 Run:
system-view
ospf [ process-id ]
----End
Procedure
Step 1 Run:
system-view
OSPF is configured to filter the routes imported through the import-route command. Only
the routes that pass the filtering criteria are advertised.
l The parameter acl-number specifies the number of a basic ACL.
l The parameter acl-name acl-name specifies the name of an ACL.
l The parameter ip-prefix ip-prefix-name specifies the name of an IP prefix list.
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
Step 4 Run:
commit
----End
Context
When multiple links exist between two switches, you can configure the local switch to filter
the LSAs to be sent. This prevents transmission of unnecessary LSAs and saves bandwidth
resources.
Perform the following steps on the switch running OSPF.
Procedure
Step 1 Run:
system-view
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf filter-lsa-out { all | { summary [ acl { acl-number | acl-name } ] | ase
[ acl { acl-number | acl-name } ] | nssa [ acl { acl-number | acl-name } ] } * }
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
area area-id
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.
l Run:
filter { acl-number | acl-name acl-name | ip-prefix ip-prefix-name | route-
policy route-policy-name } export
Step 5 Run:
commit
----End
Prerequisites
All configurations of controlling OSPF routing information are complete.
Procedure
l Run the display ospf [ process-id ] lsdb command to check information about the OSPF
LSDB.
----End
Pre-configuration Tasks
Before configuring OSPF IP FRR, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Mandatory
procedure
Optional
procedure
Context
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 switch that needs to protect traffic to be forwarded:
Procedure
Step 1 Run:
system-view
Step 3 Run:
frr
Step 4 Run:
loop-free-alternate
NOTE
OSPF can generate a loop-free backup link only when the OSPF IP FRR traffic protection inequality is
met.
After the OSPF IP FRR filtering policy is configured, only the OSPF backup routes that
match the filtering conditions of the policy can be added to the forwarding table.
Step 6 Run:
commit
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf frr block
----End
Prerequisites
All OSPF IP FRR configurations are complete.
Procedure
l 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
Applicable Environment
The link fault or the topology change may cause devices to recalculate routes. Therefore, the
convergence of routing protocols must be speed up to improve the network performance.
Link faults are inevitable. Therefore, a feasible solution is required to fast detect faults and
notify routing protocols of the faults immediately. If BFD is associated with routing protocols,
once a link fault occurs, BFD can speed up the convergence of routing protocols.
Pre-configuration Tasks
Before configuring BFD for OSPF, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Mandatory procedure
Optional procedure
Procedure
Step 1 Run:
system-view
----End
Procedure
Step 1 Run:
system-view
ospf [ process-id ]
NOTE
Step 4 Run:
commit
----End
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 view of the interface enabled with BFD for OSPF is displayed.
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf bfd block
----End
Procedure
Step 1 Run:
system-view
The view of the interface enabled with BFD for OSPF is displayed.
Step 3 (On an Ethernet interface), run:
undo portswitch
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf bfd enable
NOTE
l The BFD priority configured on an interface is higher than the BFD priority configured in a process.
That is, if BFD is enabled on an interface, BFD parameters on the interface are used to establish
BFD sessions.
l If only the ospf bfd { min-rx-interval receive-interval | min-tx-interval transmit- interval | detect-
multiplier multiplier-value } * command is run to set BFD parameters, and the ospf bfd enable
command is not run, BFD cannot be enabled on the interface.
Step 5 Run:
commit
----End
Prerequisites
All configurations of BFD for OSPF are complete.
Procedure
l 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
Pre-configuration Tasks
Before configuring OSPF fast convergence, complete the following tasks:
l Configuring a link layer protocol
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Perform one or more configuration tasks (excluding "Checking the Configuration") as
required.
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
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
prefix-priority { critical | high | medium } ip-prefix ip-prefix-name
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
Step 4 Run:
commit
----End
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
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 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.
To speed up OSPF convergence in the case of a link failure, Configuring BFD for OSPF is
recommended.
NOTE
The interval must be longer than the time a device takes to perform a master/slave main control board
switchover. If the timer is set to less than the switchover time, a protocol intermittent interruption occurs
during a switchover. The default timer value is recommended.
Step 5 Run:
commit
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf timer dead interval
The dead time after which the neighbor relationship between two switches 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.
NOTE
If the dead interval of an OSPF neighbor is shorter than 10s, the session may be closed. Therefore, if
dead interval is shorter than 10s, the actual dead interval of an OSPF neighbor is not shorter than 10s.
Both the Hello timer and the Dead timer are restored to their respective default values upon a change to
the network type.
Step 5 Run:
commit
----End
Context
Before Smart-discover is configured, when the neighbor status of the switch changes or the
DR/BDR on the multi-access network (broadcast or NBMA network) changes, the switch
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 switch changes or the DR/BDR on the multi-
access network (broadcast or NBMA network) changes, the switch 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
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf smart-discover
Step 5 Run:
commit
----End
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.
Procedure
Step 1 Run:
system-view
If frequent LSA flapping occurs, the larger value between lsa-originate-interval suppress-
flapping and lsa-originate-interval is used to suppress LSA flapping.
By default, if the device receives a LSA, it delays route calculation for 10s.
Step 5 Run:
commit
----End
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.
Procedure
Step 1 Run:
system-view
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 ]
----End
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
l The parameter interval1 specifies the interval for the SPF calculation, in milliseconds.
l The parameter intelligent-timer indicates that the interval for the SPF calculation is set
through an intelligent timer.
l The parameter max-interval specifies the maximum interval for the SPF calculation, in
milliseconds.
l The parameter start-interval specifies the initial interval for the SPF calculation, in
milliseconds.
l The parameter hold-interval specifies the hold interval for the SPF calculation, in
milliseconds.
l 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 Step 3.1 and performs the
SPF calculation at the initial interval specified by start-interval.
Step 4 Run:
commit
----End
Context
Frequent OSPF LSA flapping on the remote device may lead to route flapping on the local
device, affecting services. To address this problem, run the maxage-lsa route-calculate-delay
command to configure the local device to delay route calculation in the case of frequent OSPF
LSA flapping, which suppresses route flapping locally.
Procedure
Step 1 Run:
system-view
Step 3 Run:
maxage-lsa route-calculate-delay delay-interval
The route calculation delay function is configured to suppress frequent OSPF LSA flapping.
Step 4 Run:
commit
----End
Context
When the local device's aging timer expires, 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:
(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)
By default, master/slave board switching triggered by abnormal OSPF LSA aging is enabled.
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
Step 2 Run:
ospf maxage-lsa auto-protect disable
The master/slave board switching triggered by abnormal OSPF LSA aging is disabled.
By default, master/slave board switching triggered by abnormal OSPF LSA aging is enabled.
Step 3 Run:
commit
----End
Prerequisites
All configurations of OSPF fast convergence are complete.
Procedure
l Run the display ospf [ process-id ] brief command to check brief information about the
specified OSPF process.
----End
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.
Pre-configuration Tasks
Before configuring OSPF neighbor relationship flapping suppression, complete the following
tasks:
l Configure an IP address for each interface to ensure that neighboring routers are
reachable at the network layer.
l Configure basic OSPF functions.
Procedure
Step 1 Run:
system-view
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf suppress-flapping peer hold-down interval
Detection parameters are configured for OSPF neighbor relationship flapping suppression.
l Specifies the interval for exiting from OSPF neighbor relationship flapping suppression.
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.
l If OSPF neighbor relationship flapping suppression works in hold-max-cost mode,
resume-interval indicates the duration of this mode.
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 6 Run:
commit
----End
Applicable Environment
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. GR is one of high
availability (HA) technologies. HA technologies comprise a set of comprehensive techniques,
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.
NOTE
Pre-configuration Tasks
Before configuring OSPF GR, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Procedure
Step 1 Run:
system-view
Before configuring OSPF GR, enable the opaque LSA capability using the opaque-capability
enable command.
Step 4 Run:
graceful-restart helper-role { [ { ip-prefix ip-prefix-name | acl-number acl-
number | acl-name acl-name } | ignore-external-lsa | planned-only ] * | never }
l Set ACL parameters, the local switch can enter the Helper mode only after neighbors
pass the filtering policies of ip-prefix or acl.
l Set ignore-external-lsa, the Helper does not check the LSAs outside the AS (AS-
external LSA). By default, the Helper checks the LSAs outside the AS.
l Set planned-only, the Helper supports only planned GR. By default, the Helper supports
both planned GR and unplanned GR.
l Set never, the switch does not support the Helper mode.
----End
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:
Configuration Procedures
Perform one or more configuration tasks (excluding "Checking the Configuration") as
required.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [ process-id ]
Step 3 Run:
preference [ ase | inter | intra ] { preference | route-policy route-policy-
name } *
l If the parameter ase is specified, it indicates that the preference of AS external routes is
set.
l inter: sets the priority of the Inter-area route.
l intra: sets the priority of the Intra-area route.
l The parameter preference specifies the preference of OSPF routes. The smaller the value,
the higher the preference.
l 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.
Step 4 Run:
commit
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
NOTE
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf trans-delay interval
Step 5 Run:
commit
----End
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
ospf timer retransmit interval
NOTE
The interval for retransmitting LSAs between adjacent switchs cannot be set too small. Generally, the
interval needs to be larger than the round trip time of a packet transmitted between two switchs.
Otherwise, certain LSAs are retransmitted unnecessarily.
Step 5 Run:
commit
----End
Context
When the switchs in an area just finish synchronizing the LSDBs, the LSDBs of these switchs
are different from each other. As a result, route flapping occurs. You can configure secure
synchronization to solve this problem. This, however, may delay the establishment of the
OSPF adjacency relationship.
Procedure
Step 1 Run:
system-view
Step 2 Run:
ospf [process-id ]
Step 3 Run:
safe-sync enable
Step 4 Run:
commit
----End
Context
A stub switch is used to control traffic and instruct other OSPF switchs not to use it to
forward data. Other OSPF switchs can have a route to the stub switch.
The metric of links in the Router LSAs generated by the stub switch is set to the maximum
value (65535).
Procedure
Step 1 Run:
system-view
NOTE
There is no relationship between the stub switch configured through this command and the switch in a
stub area.
Step 4 Run:
commit
----End
Procedure
Step 1 Run:
system-view
Step 3 Run:
silent-interface { all | interface-type interface-number }
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
Prerequisites
All configurations of improving the stability of an OSPF network are complete.
Procedure
l Run the display ospf [ process-id ] brief command to check brief information about the
specified OSPF process.
l Run the display ip routing-table command to check information about the IP routing
table.
----End
Applicable Environment
With the increase in attacks on TCP/IP networks and the defects in the TCP/IP protocol suite,
network attacks have a greater impact on the network security. Especially attacks on network
devices will cause the crash of the network. By configuring the GTSM and authentication,
you can improve the security of an OSPF network.
NOTE
The CE8800&7800&6800&5800 series switches supports OSPF GTSM. For detailed configuration of
OSPF GTSM, refer to the CloudEngine 8800&7800&6800&5800 Series Switches Configuration Guide
- Security
NOTE
Pre-configuration Tasks
Before improving the security of an OSPF network, complete the following tasks:
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Configuration Procedures
Perform one or more configuration tasks (excluding "Checking the Configuration") as
required.
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 switch
connections for GTSM. If the packets sent from a switch 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
NOTE
----End
Context
In area authentication, all the switchs 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
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.
Step 5 Run:
commit
----End
Context
The interface authentication mode is used among neighbor switchs 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
If an Ethernet interface already has Layer 2 configuration, this command will fail to be
executed on the interface. Before running this command on the interface, delete all the Layer
2 configuration of the interface.
NOTE
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run any of the following commands to configure the interface authentication mode as
required:
l Run:
ospf authentication-mode simple [ plain plain-text | [ cipher ] cipher-text ]
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.
Step 5 Run:
commit
----End
Prerequisites
All configurations of improving the security of an OSPF network are complete.
Procedure
l Run the display ospf [ process-id ] brief command to view the configurations of the
system in the current view.
----End
Applicable Environment
Through the Simple Network Management Protocol (SNMP), the OSPF Management
Information Base (MIB) manages multicast information exchanged between the NMS and
agents.
Pre-configuration Tasks
Before configuring the network management function of OSPF, complete the following tasks:
l Configuring a link layer protocol
l Configuring IP addresses for interfaces to ensure that neighboring nodes are reachable at
the network layer
l 5.7 Configuring Basic OSPF Functions
Procedure
Step 1 Run:
system-view
----End
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
l 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.
l Run the reset ospf [ process-id ] counters maxage-lsa command to delete the statistics
about router LSAs that have reached the aging time.
l Run the reset ospf [ process-id ] redistribution command in the user view to re-import
routes by OSPF.
l Run the reset gtsm statistics { all | slot-id } command in the user view to clear the
GTSM statistics on the device.
l Run the reset ospf [ process-id ] frr command in the user view to perform OSPF IP FRR
calculation again.
l Run:
reset ospf process-id suppress-flappingpeer [ interface-type interface-
number ] [ notify-peer ]
Interfaces are forced to exit from OSPF neighbor relationship flapping suppression.
NOTE
Context
NOTICE
Running the reset ospf command will tear down the OSPF adjacency relationship between
the switchs. So, confirm the action before you use the command.
To reset OSPF connections, run the following reset commands in the user view.
Procedure
l Run the reset ospf [ process-id ] process command in the user view to restart the OSPF
process.
----End
Networking Requirements
As shown in Figure 5-25, all switchs run OSPF, and the entire AS is partitioned into three
areas. Switch A and Switch B function as ABRs to forward the routes between areas.
After the configuration is complete, each switch should learn the routes to all network
segments in the AS.
Configuration Roadmap
The configuration roadmap is as follows:
1. Enable OSPF on each switch.
2. Specify network segments in different areas.
Procedure
Step 1 Assign an IP address to each interface. The detailed configuration is not mentioned here.
# Configure Switch B.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchB
[*HUAWEI] commit
[~SwitchB] router id 10.2.2.2
[*SwitchB] ospf 1
[*SwitchB-ospf-1] area 0
[*SwitchB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[*SwitchB-ospf-1-area-0.0.0.0] quit
[*SwitchB-ospf-1] area 2
[*SwitchB-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[*SwitchB-ospf-1-area-0.0.0.2] quit
[*SwitchB-ospf-1] commit
[~SwitchB-ospf-1] quit
# Configure Switch C.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchC
[*HUAWEI] commit
[~SwitchC] router id 10.3.3.3
[*SwitchC] ospf 1
[*SwitchC-ospf-1] area 1
[*SwitchC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[*SwitchC-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[*SwitchC-ospf-1-area-0.0.0.1] commit
[~SwitchC-ospf-1-area-0.0.0.1] quit
[~SwitchC-ospf-1] quit
# Configure Switch D.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchD
[*HUAWEI] commit
[~SwitchD] router id 10.4.4.4
[*SwitchD] ospf 1
[*SwitchD-ospf-1] area 2
[*SwitchD-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[*SwitchD-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[*SwitchD-ospf-1-area-0.0.0.2] commit
[~SwitchD-ospf-1-area-0.0.0.2] quit
[~SwitchD-ospf-1] quit
# Configure Switch E.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchE
[*HUAWEI] commit
[~SwitchE] router id 10.5.5.5
[*SwitchE] ospf 1
[*SwitchE-ospf-1] area 1
[*SwitchE-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[*SwitchE-ospf-1-area-0.0.0.1] commit
[~SwitchE-ospf-1-area-0.0.0.1] quit
[~SwitchE-ospf-1] quit
# Configure Switch F.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchF
[*HUAWEI] commit
[~SwitchF] router id 10.6.6.6
[*SwitchF] ospf 1
[*SwitchF-ospf-1] area 2
[*SwitchF-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[*SwitchF-ospf-1-area-0.0.0.2] commit
[~SwitchF-ospf-1-area-0.0.0.2] quit
[~SwitchF-ospf-1] quit
Total Nets: 5
Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.1 10.1.1.1 93 48 80000004 1
Router 10.2.2.2 10.2.2.2 92 48 80000004 1
Sum-Net 172.16.1.0 10.1.1.1 1287 28 80000002 2
Sum-Net 192.168.1.0 10.1.1.1 1716 28 80000001 1
Sum-Net 172.17.1.0 10.2.2.2 1336 28 80000001 2
Sum-Net 192.168.2.0 10.2.2.2 87 28 80000002 1
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.1.1.1 10.1.1.1 1420 48 80000002 1
Router 10.3.3.3 10.3.3.3 1294 60 80000003 1
Router 10.5.5.5 10.5.5.5 1296 36 80000002 1
Network 172.16.1.1 10.3.3.3 1294 32 80000001 0
Sum-Net 172.17.1.0 10.1.1.1 1325 28 80000001 3
Sum-Net 192.168.0.0 10.1.1.1 1717 28 80000001 1
Sum-Net 192.168.2.0 10.1.1.1 1717 28 80000001 2
# Display the routing table on Switch D and perform the ping operation to test the
connectivity.
[~SwitchD] display ospf routing
Total Nets: 5
Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
[~SwitchD] 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
l Configuration file of Switch A
#
sysname SwitchA
#
vlan batch 10 20
#
router id 10.1.1.1
#
interface Vlanif10
ip address 192.168.0.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
return
#
interface Vlanif50
ip address 172.17.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 30
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 50
#
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
Networking Requirements
As shown in Figure 5-26, all switchs run OSPF, and the entire AS is partitioned into three
areas. Switch A and Switch B function as ABRs to advertise routes between areas; Switch D
functions as the ASBR to import external routes, that is, 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.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure basic OSPF functions on each switch to realize interconnection.
2. Configure static routes on Switch D and import it into OSPF.
3. Configure Area 1 as a stub area by running the stub command on all switchs in Area 1
and check the OSPF routing information on Switch C.
4. Prevent Switch A from advertising Type 3 LSAs to the stub area, and check the OSPF
routing information on Switch C.
Procedure
Step 1 Assign an IP address to each interface. The detailed configuration is not mentioned here.
Step 2 Configure basic OSPF functions. For details, see 5.23.1 Example for Configuring Basic
OSPF Functions.
NOTE
If the area where Switch C resides is a common area, external routes exist in the routing table.
[~SwitchC] display ospf routing
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
# Configure Switch C.
[~SwitchC] ospf 1
[*SwitchC-ospf-1] area 1
[*SwitchC-ospf-1-area-0.0.0.1] stub
[*SwitchC-ospf-1-area-0.0.0.1] commit
[~SwitchC-ospf-1-area-0.0.0.1] quit
[~SwitchC-ospf-1] quit
# Configure Switch E.
[~SwitchE] ospf 1
[*SwitchE-ospf-1] area 1
[*SwitchE-ospf-1-area-0.0.0.1] stub
[*SwitchE-ospf-1-area-0.0.0.1] commit
[~SwitchE-ospf-1-area-0.0.0.1] quit
[~SwitchE-ospf-1] quit
NOTE
After the area where Switch C resides is configured as a stub area, a default route rather than AS
external routes exists in the routing table.
[~SwitchC] display ospf routing
Total Nets: 6
Intra Area: 2 Inter Area: 4 ASE: 0 NSSA: 0
Step 5 # Prevent Switch A from advertising Type 3 LSAs to the stub area.
[~SwitchA] ospf
[*SwitchA-ospf-1] area 1
[*SwitchA-ospf-1-area-0.0.0.1] stub no-summary
[*SwitchA-ospf-1-area-0.0.0.1] commit
[~SwitchA-ospf-1-area-0.0.0.1] quit
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
NOTE
After the advertisement of summary LSAs to the stub area is disabled, the routing entries on the switch
in the stub area are further reduced, and only the default route to a destination outside the stub area is
reserved.
----End
Configuration Files
l Configuration file of Switch A
#
sysname SwitchA
#
vlan batch 10 20
#
router id 10.1.1.1
#
interface Vlanif10
ip address 192.168.0.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
stub no-summary
#
return
NOTE
Configuration files of Switch B and Switch F are similar to the configuration file of Switch A, and
are not mentioned here.
l Configuration file of Switch C
#
sysname SwitchC
#
vlan batch 20 40
#
router id 10.3.3.3
#
interface Vlanif20
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif40
ip address 172.16.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1
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
Networking Requirements
As shown in Figure 5-27, OSPF is enabled on all Switches and the AS is divided into three
areas. Switch A and Switch B function as ABRs to forward routes between areas; Switch D
functions as the ASBR to import external routes, that is, static routes.
You need to configure Area 1 as an NSSA and configure SwitchC as an ASBR to import
external routes (static routes). The routing information can be transmitted correctly in the AS.
Area0
10GE1/0/1
VLANIF10
192.168.0.2/24
SwitchA 10GE1/0/1 SwitchB
10GE1/0/2 10GE1/0/2
VLANIF10
VLANIF20 VLANIF30
192.168.0.1/24
192.168.1.1/24 192.168.2.1/24
10GE1/0/1 10GE1/0/1
VLANIF20 VLANIF30
192.168.1.2/24 192.168.2.2/24
SwitchC SwitchD
10GE1/0/2 10GE1/0/2
NSSA VLANIF40 VLANIF50
ASBR
172.16.1.1/24 172.17.1.1/24
10GE1/0/1 10GE1/0/1
VLANIF40 VLANIF50
172.16.1.2/24 172.17.1.2/24
SwitchE SwitchF
Area1 Area2
Configuration Roadmap
The configuration roadmap is as follows:
1. Enable OSPF on each Switch and configure the basic OSPF functions.
2. Configure static routes on Switch D and import them into OSPF.
3. Configure Area 1 as an NSSA and check the OSPF routing information of Switch C. You
must run the nssa command on all the devices in Area 1.
4. Configure static routes on Switch C, import them into OSPF, and check the OSPF
routing information of Switch D.
Procedure
Step 1 Configure the VLAN that each interface belongs to.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan batch 10 20
[*SwitchA] interface 10ge 1/0/1
[*SwitchA-10GE1/0/1] port link-type trunk
[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10
[*SwitchA-10GE1/0/1] quit
[*SwitchA] interface 10ge 1/0/2
[*SwitchA-10GE1/0/2] port link-type trunk
[*SwitchA-10GE1/0/2] port trunk allow-pass vlan 20
[*SwitchA-10GE1/0/2] quit
[*SwitchA] commit
The configurations of Switch B, Switch C, Switch D, Switch E, and Switch F are similar to
the configuration of Switch A, and are not mentioned here.
Step 2 Assign an IP address to each VLANIF interface.
[~SwitchA] interface vlanif 10
[*SwitchA-Vlanif10] ip address 192.168.0.1 24
[*SwitchA-Vlanif10] quit
[*SwitchA] interface vlanif 20
[*SwitchA-Vlanif20] ip address 192.168.1.1 24
[*SwitchA-Vlanif20] quit
[*SwitchA] commit
The configurations of Switch B, Switch C, Switch D, Switch E, and Switch F are similar to
the configuration of Switch A, and are not mentioned here.
Step 3 Configure the basic OSPF functions. See 5.23.1 Example for Configuring Basic OSPF
Functions.
Step 4 Configure Switch D to import static routes. See 5.23.2 Example for Configuring OSPF
Stub Areas.
Step 5 Configure Area 1 as an NSSA.
# Configure Switch A.
[~SwitchA] ospf
[*SwitchA-ospf-1] area 1
[*SwitchA-ospf-1-area-0.0.0.1] nssa default-route-advertise no-summary
[*SwitchA-ospf-1-area-0.0.0.1] quit
[*SwitchA-ospf-1] quit
[*SwitchA] commit
# Configure Switch C.
[~SwitchC] ospf
[*SwitchC-ospf-1] area 1
[*SwitchC-ospf-1-area-0.0.0.1] nssa
[*SwitchC-ospf-1-area-0.0.0.1] quit
[*SwitchC-ospf-1] quit
[*SwitchC] commit
# Configure Switch E.
[~SwitchE] ospf
[*SwitchE-ospf-1] area 1
[*SwitchE-ospf-1-area-0.0.0.1] nssa
[*SwitchE-ospf-1-area-0.0.0.1] quit
[*SwitchE-ospf-1] quit
[*SwitchE] commit
NOTE
The default-route-advertise and no-summary keywords are recommend on the ABR (Switch A). In
this manner, the size of the routing table of devices in an NSSA can be reduced. For the other devices in
the NSSA, you need to run only the nssa command.
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
From the routing table of Switch D, you can find that an AS external route is imported to the
NSSA.
----End
Configuration Files
l Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 10 20
#
router id 10.1.1.1
#
interface Vlanif10
ip address 192.168.0.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
nssa default-route-advertise no-summary
#
return
NOTE
Configuration files of Switch B, Switch D, and Switch F are similar to the configuration file of
Switch A, and are not mentioned here.
l Configuration file of Switch C
#
sysname SwitchC
#
vlan batch 20 40
#
router id 10.3.3.3
#
interface Vlanif20
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif40
ip address 172.16.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1
import-route static
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
nssa
#
ip route-static 100.0.0.0 255.0.0.0 NULL0
#
return
Networking Requirements
As shown in Figure 5-28, Switch A has the highest priority of 100 on the network and is
elected as the DR; Switch C has the highest priority of 2. Switch C has the second highest
priority and is elected as the BDR; The priority of Switch B is 0 and therefore cannot be
elected as a DR or a BDR; the priority of Switch D is not set, so Switch D uses the default
value 1.
10GE1/0/1 10GE1/0/1
VLANIF10 VLANIF10
192.168.1.1/24 192.168.1.2/24
10GE1/0/1 10GE1/0/1
VLANIF10 VLANIF10
192.168.1.3/24 192.168.1.4/24
SwitchC SwitchD
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the ID of the VLAN that each interface belongs to.
Procedure
Step 1 Configure the VLAN that each interface belongs to.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan 10
[*SwitchA-vlan10] quit
[*SwitchA] interface 10ge 1/0/1
[*SwitchA-10GE1/0/1] port link-type trunk
[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10
[*SwitchA-10GE1/0/1] quit
[*SwitchA] commit
The configurations of Switch B, Switch C, and Switch D are similar to the configuration of
Switch A, and are not mentioned here.
The configurations of Switch B, Switch C, and Switch D are similar to the configuration of
Switch A, and are not mentioned here.
# Configure Switch A.
[~SwitchA] router id 10.1.1.1
[*SwitchA] ospf
[*SwitchA-ospf-1] area 0
[*SwitchA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*SwitchA-ospf-1-area-0.0.0.0] quit
[*SwitchA-ospf-1] quit
[*SwitchA] commit
# Configure SwitchB.
[~SwitchB] router id 10.2.2.2
[*SwitchB] ospf
[*SwitchB-ospf-1] area 0
[*SwitchB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*SwitchB-ospf-1-area-0.0.0.0] quit
[*SwitchB-ospf-1] quit
[*SwitchB] commit
# Configure Switch C.
[~SwitchC] router id 10.3.3.3
[*SwitchC] ospf
[*SwitchC-ospf-1] area 0
[*SwitchC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*SwitchC-ospf-1-area-0.0.0.0] quit
[*SwitchC-ospf-1] quit
[*SwitchC] commit
# Configure Switch D.
[~SwitchD] router id 10.4.4.4
[*SwitchD] ospf
[*SwitchD-ospf-1] area 0
[*SwitchD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*SwitchD-ospf-1-area-0.0.0.0] quit
[*SwitchD-ospf-1] quit
[*SwitchD] commit
Check the neighbors of Switch A. You can view the DR priority and the neighbor status. By
default, the DR priority is 1. Now Switch D functions as the DR and Switch C functions as
the BDR.
NOTE
When the priority is the same, the switch with a higher router ID is elected as the DR. If a new switch is
added after the DR/BDR election is complete, the new switch cannot become the DR even if it has the
highest priority.
Configure SwitchB.
[~SwitchB] interface Vlanif 10
[~SwitchB-Vlanif10] ospf dr-priority 0
[*SwitchB-Vlanif10] quit
[*SwitchB] commit
# Configure Switch C.
[~SwitchC] interface Vlanif 10
[~SwitchC-Vlanif10] ospf dr-priority 2
[*SwitchC-Vlanif10] quit
[*SwitchC] commit
NOTE
If all neighbors are in Full state, it indicates that the local device establishes adjacencies with
all its neighbors. If a neighbor stays in 2-Way state, it indicates the local Switch and the
neighbor are not the DR or BDR. Therefore, they do not need to exchange LSAs.
If the status of an OSPF interface is DROther, it indicates that the router is neither the DR nor
the BDR.
----End
Configuration Files
l Configuration file of Switch A
#
sysname SwitchA
#
vlan batch 10
#
router id 10.1.1.1
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
ospf dr-priority 100
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
#
return
Figure 5-29 Networking diagram for configuring load balancing among OSPF routes
SwitchC
10GE1/0/1 10GE1/0/2
VLANIF10 VLANIF30
10.1.1.2/24 192.168.0.1/24
10GE1/0/1 10GE1/0/1
VLANIF10 VLANIF30
10GE1/0/3 10.1.1.1/24
VLANIF50 192.168.0.2/24
172.16.1.1/24
SwitchA SwitchD
10GE1/0/3
10GE1/0/2 10GE1/0/2 VLANIF60
VLANIF20 VLANIF40 172.16.2.1/24
10.1.2.1/24 192.168.1.2/24
10GE1/0/1 10GE1/0/2
VLANIF20 VLANIF40
10.1.2.2/24 192.168.1.1/24
SwitchB
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure basic OSPF functions on each Switch to implement interconnection.
2. Disable load balancing on Switch A and check the routing table of Switch A.
3. (Optional) Set the weight of equal-cost routes on Switch A.
Procedure
Step 1 Configure VLANs that the related interfaces belong to.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan batch 10 20 50
[*SwitchA] interface 10ge 1/0/1
[*SwitchA-10GE1/0/1] port link-type trunk
[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10
[*SwitchA-10GE1/0/1] quit
[*SwitchA] interface 10ge 1/0/2
[*SwitchA-10GE1/0/2] port link-type trunk
[*SwitchA-10GE1/0/2] port trunk allow-pass vlan 20
[*SwitchA-10GE1/0/2] quit
[*SwitchA] interface 10ge 1/0/3
[*SwitchA-10GE1/0/3] port link-type trunk
[*SwitchA-10GE1/0/3] port trunk allow-pass vlan 50
[*SwitchA-10GE1/0/3] quit
[*SwitchA] commit
The configurations of Switch B, Switch C, and Switch D are similar to the configuration of
Switch A, and are not mentioned here.
Step 2 Assign an IP address to each VLANIF interface.
[~SwitchA] interface vlanif 10
[*SwitchA-Vlanif10] ip address 10.1.1.1 24
[*SwitchA-Vlanif10] quit
[*SwitchA] interface vlanif 20
[*SwitchA-Vlanif20] ip address 10.1.2.1 24
[*SwitchA-Vlanif20] quit
[*SwitchA] interface vlanif 50
[*SwitchA-Vlanif50] ip address 172.16.1.1 24
[*SwitchA-Vlanif50] quit
[*SwitchA] commit
The configurations of Switch B, Switch C, and Switch D are similar to the configuration of
Switch A, and are not mentioned here.
Step 3 Configure the basic OSPF functions. See 5.23.1 Example for Configuring Basic OSPF
Functions.
As shown in the routing table, when the maximum number of equal-cost routes for load
balancing is set to 1, OSPF selects 10.1.1.2 as the next hop to the destination network
172.16.2.0.
NOTE
In the preceding example, 10.1.1.2 is selected as the optimal next hop. This is because OSPF selects the
next hop randomly among equal-cost routes.
Step 5 Restore the default number of equal-cost routes for load balancing on Switch A.
[~SwitchA] ospf
[*SwitchA-ospf-1] undo maximum load-balancing
[*SwitchA-ospf-1] quit
[*SwitchA] commit
As shown in the routing table, when the default setting of load balancing is restored, the next
hops of Switch A, that is, 10.1.1.2 and 10.1.2.2, become valid routes. This is because the
default number of equal-cost routes is 32.
Step 6 (Optional) Set the weight of equal-cost routes on Switch A.
If you do not want to implement load balancing between Switch B and Switch C, set the
weight of equal-cost routes to specify the next hop.
[~SwitchA] ospf
[~SwitchA-ospf-1] nexthop 10.1.2.2 weight 1
[*SwitchA-ospf-1] quit
[*SwitchA] commit
As shown in the routing table, the priority of the next hop 10.1.2.2 with the weight as 1 is
higher than that of 10.1.1.2, after the weight is set for equal-cost routes. Therefore, OSPF
selects the route with the next hop 10.1.2.2 as the optimal route.
----End
Configuration Files
l Configuration file of Switch A
#
sysname SwitchA
#
vlan batch 10 20 50
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.1.2.1 255.255.255.0
#
interface Vlanif50
ip address 172.16.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 50
#
ospf 1 router-id 10.10.10.1
nexthop 10.1.2.2 weight 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
return
Networking Requirements
When a fault occurs on the primary link T, traffic is switched to a backup link. In such a
scenario, two problems arise:
l It takes hundreds of milliseconds for the traffic to be switched to a backup link during
OSPF fault restoration. During this period, services are interrupted.
l Traffic will pass Switch A after link switching. Switch A is an ASBR and is not expected
to function as a backup device.
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. In
addition, you can also configure Switch A to detour around the backup link.
IS-IS
Network
OSPF Network
Area0
10GE1/0/1 10GE1/0/2
c
10 os
t= t=
s SwitchA 15
co OSPF
10GE1/0/1 ASBR 10GE1/0/1 Network
10GE1/0/2 LinkT 10GE1/0/2 cost = 5
10GE1/0/3 10GE1/0/3 10GE1/0/4
SwitchS c cost = 15 SwitchE SwitchD
os 0
t=1 s t=1 Area1
0 co
10GE1/0/1 10GE1/0/2
SwitchN
Configuration Notes
When configuring OSPF IP FRR, note the following points:
Before configuring OSPF IP FRR, you need to block FRR on the interface that is not
expected to be an interface of a backup link. After that, the link where the interface resides is
not calculated as a backup link during FRR calculation.
During the configuration of OSPF IP FRR, the lower layer needs to fast respond to a link
change so that traffic can be rapidly switched to the backup link. After the bfd all-interfaces
frr-binding command is run, the BFD session status is associated with the link status of an
interface (when the BFD session goes Down, the link status of the interface becomes Down)
so that link faults can be rapidly detected.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure basic OSPF functions on each switch.
2. Configure BFD for OSPF on all the devices in Area 0.
3. Set the costs of links to ensure that link T is preferred to transmit traffic.
4. Block FRR on a specified interface of Switch S.
5. Enable OSPF IP FRR on Switch S to protect the traffic forwarded by Switch S.
Procedure
Step 1 Assign an IP address to each interface. The configuration details are not mentioned here.
Step 2 Configure basic OSPF functions. For details, see 5.23.1 Example for Configuring Basic
OSPF Functions.
Step 3 Configure BFD for OSPF on all the devices in Area 0. For details, see 5.23.7 Example for
Configuring BFD for OSPF.
Step 4 Set the costs of links to ensure that link T is preferred to transmit traffic.
# Configure Switch S.
[~SwitchS] interface vlanif 10
[*SwitchS-Vlanif10] ospf cost 10
[*SwitchS-Vlanif10] quit
[*SwitchS] interface vlanif 20
[*SwitchS-Vlanif20] ospf cost 15
[*SwitchS-Vlanif20] quit
[*SwitchS] interface vlanif 30
[*SwitchS-Vlanif30] ospf cost 10
[*SwitchS-Vlanif30] quit
[*SwitchS] commit
# Configure Switch A.
[~SwitchA] interface vlanif 40
[*SwitchA-Vlanif40] ospf cost 15
[*SwitchA-Vlanif40] quit
[*SwitchA] interface vlanif 10
[*SwitchA-Vlanif10] ospf cost 10
[*SwitchA-Vlanif10] quit
[*SwitchA] commit
# Configure Switch N.
[~SwitchN] interface vlanif 30
[*SwitchN-Vlanif30] ospf cost 10
[*SwitchN-Vlanif30] quit
[*SwitchN] interface vlanif 60
[*SwitchN-Vlanif60] ospf cost 10
[*SwitchN-Vlanif60] quit
[*SwitchN] commit
# Configure Switch E.
[~SwitchE] interface vlanif 20
[*SwitchE-Vlanif20] ospf cost 15
[*SwitchE-Vlanif20] quit
[*SwitchE] interface vlanif 40
[*SwitchE-Vlanif30] ospf cost 15
[*SwitchE-Vlanif30] quit
[*SwitchE] interface vlanif 60
[*SwitchE-Vlanif40] ospf cost 10
[*SwitchE-Vlanif40] quit
[*SwitchE] interface vlanif 70
[*SwitchE-Vlanif70] ospf cost 5
[*SwitchE-Vlanif70] quit
[*SwitchE] commit
# Run the display ospf routing router-id command on Switch S to view routing information.
[~SwitchS-ospf-1-frr] display ospf routing 172.17.1.1
Destination :
10.10.10.4/32
Flags : A/-
----End
Configuration Files
l Configuration file of Switch S
#
sysname SwitchS
#
vlan batch 10 20 30
#
bfd
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
ospf cost 10
ospf frr block
#
interface Vlanif20
ip address 10.1.2.1 255.255.255.0
ospf cost 15
#
interface Vlanif30
ip address 10.1.3.1 255.255.255.0
ospf cost 10
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 30
#
ospf 1 router-id 10.10.10.1
bfd all-interfaces enable
bfd all-interfaces frr-binding
frr
loop-free-alternate
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
network 10.1.3.0 0.0.0.255
#
return
l Configuration file of Switch A
#
sysname SwitchA
#
vlan batch 10 40
#
bfd
#
interface Vlanif10
ip address 10.1.1.2 255.255.255.0
ospf cost 10
#
interface Vlanif40
ip address 20.1.1.2 255.255.255.0
ospf cost 15
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1 router-id 10.10.10.2
bfd all-interfaces enable
bfd all-interfaces frr-binding
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.255
#
return
l Configuration file of Switch N
#
sysname SwitchN
#
vlan batch 30 60
#
bfd
#
interface Vlanif30
ip address 10.1.3.2 255.255.255.0
ospf cost 10
#
interface Vlanif60
ip address 20.1.3.2 255.255.255.0
ospf cost 10
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 30
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 60
#
ospf 1 router-id 10.10.10.3
bfd all-interfaces enable
bfd all-interfaces frr-binding
frr
area 0.0.0.0
network 10.1.3.0 0.0.0.255
Networking Requirements
As shown in Figure 5-31, the networking requirements are as follows:
l BFD is configured on the interfaces between Switch A and Switch B. When a fault
occurs on the link between the Switch s, BFD can quickly detect the fault and notify
OSPF of the fault. Then, the service flow is transmitted on the backup link.
10GE1/0/3
SwitchA SwitchBVLANIF40
172.16.1.1/24
10GE1/0/2 10GE1/0/2
10GE1/0/1 VLANIF20 VLANIF20 10GE1/0/1
VLANIF10 10.3.3.1/24 10.3.3.2/24 VLANIF30
10.1.1.1/24 10.2.2.2/24
10GE1/0/1 10GE1/0/2
VLANIF10 VLANIF30 Area0
10.1.1.2/24 10.2.2.1/24
SwitchC
Configuration Roadmap
The configuration roadmap is as follows:
Procedure
Step 1 Create VLANs and add corresponding interfaces to the VLANs.
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] vlan 10
[*SwitchA-vlan10] quit
[*SwitchA] vlan 20
[*SwitchA-vlan20] quit
[*SwitchA] interface 10ge 1/0/1
[*SwitchA-10GE1/0/1] port link-type trunk
[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10
[*SwitchA-10GE1/0/1] quit
[*SwitchA] interface 10ge 1/0/2
[*SwitchA-10GE1/0/2] port link-type trunk
[*SwitchA-10GE1/0/2] port trunk allow-pass vlan 20
[*SwitchA-10GE1/0/2] quit
[*SwitchA] commit
The configurations of Switch B and Switch C are similar to the configuration of Switch A,
and are not mentioned here.
The configurations of Switch B and Switch C are similar to the configuration of Switch A,
and are not mentioned here.
Step 3 Configure the basic OSPF functions. See 5.23.1 Example for Configuring Basic OSPF
Functions.
# Run the display ospf bfd session all command on Switch A or Switch B. You can see that
the BFD state is Up.
NeighborId:10.10.10.2 AreaId:0.0.0.0
Interface:Vlanif20
BFDState:Up rx :1000 tx :
1000
Multiplier:3 BFD Local Dis:16385 LocalIpAdd:
10.3.3.1
RemoteIpAdd:10.3.3.2 Diagnostic Info:No diagnostic
information
NeighborId:10.10.10.3 AreaId:0.0.0.0
Interface:Vlanif10
BFDState:Up rx :1000 tx :
1000
Multiplier:3 BFD Local Dis:16385 LocalIpAdd:
10.1.1.1
RemoteIpAdd:10.1.1.2 Diagnostic Info:No diagnostic
information
# Configure BFD on VLANIF 20 of Switch A, set the minimum interval for sending the
packets and the minimum interval for receiving the packets to 100 ms, and set the local
detection time multiplier to 4.
[~SwitchA] interface vlanif 20
[*SwitchA-Vlanif20] ospf bfd enable
[*SwitchA-Vlanif20] ospf bfd min-tx-interval 100 min-rx-interval 100 detect-
multiplier 4
[*SwitchA-Vlanif20] quit
[*SwitchA] commit
# Configure BFD on VLANIF20 of Switch B and set the minimum interval for sending the
packets and the minimum interval for receiving the packets to 100 ms and the local detection
time multiplier to 4.
[*SwitchB] interface vlanif 20
[*SwitchB-Vlanif20] ospf bfd enable
[*SwitchB-Vlanif20] ospf bfd min-tx-interval 100 min-rx-interval 100 detect-
multiplier 4
[*SwitchB-Vlanif20] quit
[*SwitchB] commit
# Run the display ospf bfd session all command on Switch A or Switch B. You can check
that the minimum intervals at which packets are sent and received are 100 ms and that the
local detection multiplier is 4.
Take Switch B for example. The display is as follows:
[~SwitchB] display ospf bfd session all
NeighborId:10.10.10.1 AreaId:0.0.0.0
Interface:Vlanif20
BFDState:Up rx :100 tx :
100
Multiplier:4 BFD Local Dis:16385 LocalIpAdd:
10.3.3.2
RemoteIpAdd:10.3.3.1 Diagnostic Info:No diagnostic
information
NeighborId:10.10.10.3 AreaId:0.0.0.0
Interface:Vlanif30
BFDState:Up rx :100 tx :
100
Multiplier:4 BFD Local Dis:16385 LocalIpAdd:
10.2.2.2
RemoteIpAdd:10.2.2.1 Diagnostic Info:No diagnostic
information
As shown in the OSPF routing table, the backup link Switch A→Switch C→Switch B takes
effect after the main link fails. The next hop address of the route to 172.16.1.0/24 becomes
10.1.1.2.
----End
Configuration Files
l Configuration file of Switch A
#
sysname SwitchA
#
vlan batch 10 20
#
router id 10.10.10.1
#
bfd
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.3.3.1 255.255.255.0
ospf bfd enable
ospf bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
ospf 1
bfd all-interface 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
interface Vlanif30
ip address 10.2.2.2 255.255.255.0
#
interface Vlanif40
ip address 172.16.1.1 255.255.255.0
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 30
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface 10GE1/0/3
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1
bfd all-interface 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
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.
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.
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.
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.
OSPF can run on an interface only when the following conditions are met:
l 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.
l 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.
Step 8 Run:
commit
----End
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.
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:
l 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.
l 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:
l 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.
l 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.25 References
This section lists references of OSPF.
The following table lists the references that apply in this chapter.
RFC 1765 Proper operation of the OSPF protocol requires This RFC is
that all OSPF routers maintain an identical copy experimental and
of the OSPF link-state database. However, when non-standard.
the size of the link-state database becomes very
large, some routers might be unable to store the
entire database due to resource shortages. This
condition is called "database overflow".
RFC 3682 This document describes the use of a packets This RFC is
Time to Live (TTL) (IPv4) or Hop Limit (IPv6) experimental and
to protect a protocol stack from CPU-utilization non-standard.
based attacks, which has been proposed in many
settings.