NetEngine 8000 M14K, M14, M8K, M8, M4, 8000E M14 M8, 8100 M14 M8 V800R022C00SPC600 Configuration Guide
OSPF Configuration
- OSPF Description
- Overview of OSPF
- Understanding OSPF
- Basic Concepts of OSPF
- OSPF Fundamentals
- OSPF Route Control
- OSPF Virtual Link
- OSPF TE
- OSPF VPN
- OSPF NSSA
- OSPF Local MT
- BFD for OSPF
- OSPF GTSM
- OSPF Smart-discover
- OSPF-BGP Synchronization
- LDP-IGP Synchronization
- OSPF Fast Convergence
- OSPF Neighbor Relationship Flapping Suppression
- OSPF Flush Source Tracing
- OSPF Multi-Area Adjacency
- OSPF NSR
- OSPF IP FRR
- OSPF Authentication
- OSPF Packet Format
- OSPF LSA Format
- Routing Loop Detection for Routes Imported to OSPF
- OSPF Configuration
- Overview of OSPF
- Configuration Precautions for OSPF
- Configuring Basic OSPF Functions
- Enabling OSPF
- Configuring an Interface to Fill in a DD Packet with the Interface MTU
- (Optional) Creating OSPF Virtual Links
- (Optional) Configuring the router to Comply with Route Selection Rules Defined in a Standard Protocol
- (Optional) Setting the OSPF Priority
- (Optional) Restricting the Flooding of OSPF Update LSAs
- (Optional) Configuring the Maximum Number of Packet Retransmission Attempts
- (Optional) Setting the Interval at Which LSAs Are Retransmitted Between Adjacent routers
- Verifying the Configuration
- Configuring OSPF on the NBMA or P2MP Network
- Adjusting OSPF Route Selection
- Setting the Interface Cost
- Configuring Equal-Cost Routes
- Setting the convergence priority for OSPF routes
- Configuring a Stub Router
- Suppressing an Interface from Receiving and Sending OSPF Packets
- Configuring an OSPF Interface to Automatically Adjust the Link Cost
- Configuring a Fallback Cost for an Eth-Trunk Interface
- Verifying the Configuration
- Controlling OSPF Routing Information
- Configuring OSPF to Import External Routes
- Configuring OSPF to Import a Default Route
- Configuring Route Summarization
- Configuring OSPF to Filter LSAs in an Area
- Configuring OSPF to Filter LSAs to Be Sent
- Configuring OSPF to Filter Received Routes
- Configuring OSPF to Filter the Routes to Be Advertised
- (Optional) Configuring OSPF to Discard Specified LSAs
- Configuring the Maximum Number of External Routes Supported by the OSPF LSDB
- Verifying the Configuration of OSPF Routing Information Control
- Adjusting the OSPF Network Convergence Speed
- Setting the Interval at Which Hello Packets Are Sent
- Setting the Delay for Transmitting LSAs on an Interface
- Setting the Dead Time of an OSPF Neighbor
- Configuring OSPF Sham Hello
- Configuring Smart-discover
- Setting the Interval at Which LSAs Are Updated
- Setting the Interval at Which LSAs Are Received
- Setting the Interval for the SPF Calculation
- Configuring the Function to Suppress the Advertisement of Interface Addresses
- Configuring the Route Calculation Delay Function to Suppress Frequent LSA Flapping
- Disabling Active/Standby Board Switching Triggered by Abnormal OSPF Aging
- Disabling OSPF LSA Aging Management
- Setting a Period During Which OSPF Keeps the Maximum Cost in Local LSAs
- Configuring Secure Synchronization
- Verifying the Configuration of the OSPF Network Convergence Speed
- Configuring OSPF Delay Advertisement
- Configuring OSPF Neighbor Relationship Flapping Suppression
- Disabling OSPF Interface Flapping Suppression
- Configuring Routing Loop Detection for Routes Imported into OSPF
- Configuring OSPF Flush LSA Source Tracing
- Configuring an OSPF Hostname
- Configuring an OSPF Stub Area
- Configuring an NSSA
- Configuring OSPF Local MT
- Configuring an OSPF Sham Link
- Configuring BFD for OSPF
- Configuring OSPF IP FRR
- Configuring OSPF GR Helper
- Improving OSPF Network Security
- Configuring the Network Management Function of OSPF
- Configuring Whitelist Session-CAR for OSPF
- Configuring Micro-Segment CAR for OSPF
- Configuring the Threshold Alarm Function for the Number of OSPF Neighbors
- Maintaining OSPF
- Configuring OSPF Multi-Area Adjacency
- Enabling OSPF on a Multi-Area Adjacency Interface
- Configuring a Cost for a Multi-Area Adjacency Interface
- Configuring an Authentication Mode for a Multi-Area Adjacency Interface
- Configuring Fast Convergence for a Multi-Area Adjacency Interface
- Configuring Neighbor Relationship Flapping Suppression on an OSPF Multi-Area Adjacency Interface
- Disabling an OSPF Multi-Area Adjacency Interface from Creating BFD Sessions
- Disabling OSPF IP FRR on an OSPF Multi-Area Adjacency Interface
- Configuring a Fallback Cost for an Eth-Trunk Multi-Area Adjacency Interface
- Maintaining OSPF on a Multi-Area Adjacency Interface
- Verifying the Configuration of OSPF Multi-Area Adjacency
- Configuration Examples for OSPF
- Example for Configuring Basic OSPF Functions
- Example for Configuring OSPF Virtual Links
- Example for Configuring an OSPF Stub Area
- Example for Configuring an OSPF NSSA
- Example for Configuring OSPF DR Election
- Example for Configuring OSPF Load Balancing
- Example for Configuring OSPF Fast Convergence
- Example for Configuring OSPF Local MT
- Example for Configuring OSPF IP FRR
- Example for Configuring BFD for OSPF
- Example for Configuring OSPF-BGP Synchronization
- Example for Configuring Routing Loop Detection for Routes Imported from BGP to OSPF
- Example for Configuring OSPF Multi-Area Adjacency
- Example for Configuring an OSPF Sham Link
OSPF Description
Overview of OSPF
Definition
Open Shortest Path First (OSPF) is a link-state Interior Gateway Protocol (IGP) developed by the Internet Engineering Task Force (IETF).
OSPF version 2 (OSPFv2) is intended for IPv4. OSPF version 3 (OSPFv3) is intended for IPv6.
In this document, OSPF refers to OSPFv2, unless otherwise stated.
Purpose
Before the emergence of OSPF, the Routing Information Protocol (RIP) was widely used as an IGP on networks. RIP is a distance-vector routing protocol. Due to its slow convergence, routing loops, and poor scalability, RIP is gradually being replaced with OSPF.
Typical IGPs include RIP, OSPF, and Intermediate System to Intermediate System (IS-IS). Table 1-591 describes differences among the three typical IGPs.
Item |
RIP |
OSPF |
IS-IS |
---|---|---|---|
Protocol type |
IP layer protocol |
IP layer protocol |
Link layer protocol |
Application scope |
Applies to small networks with simple architectures, such as campus networks. |
Applies to medium-sized networks with several hundred routers supported, such as enterprise networks. |
Applies to large networks, such as Internet service provider (ISP) networks. |
Routing algorithm |
Uses a distance-vector algorithm and exchanges routing information over the User Datagram Protocol (UDP). |
Uses the shortest path first (SPF) algorithm to generate a shortest path tree (SPT) based on the network topology, calculates shortest paths to all destinations, and exchanges routing information over IP. |
Uses the SPF algorithm to generate an SPT based on the network topology, calculates shortest paths to all destinations, and exchanges routing information over IP. The SPF algorithm runs separately in Level-1 and Level-2 databases. |
Route convergence speed |
Slow |
Less than 1 second |
Less than 1 second |
Scalability |
Not supported |
Supported by partitioning a network into areas |
Supported by defining router levels |
Benefits
OSPF offers the following benefits:
Wide application scope: OSPF applies to medium-sized networks with several hundred routers, such as enterprise networks.
Network masks: OSPF packets can carry masks, and therefore the packet length is not limited by natural IP masks. OSPF can process variable length subnet masks (VLSMs).
Fast convergence: When the network topology changes, OSPF immediately sends link state update (LSU) packets to synchronize the changes to the link state databases (LSDBs) of all routers in the same autonomous system (AS).
Loop-free routing: OSPF uses the SPF algorithm to calculate loop-free routes based on the collected link status.
Area partitioning: OSPF allows an AS to be partitioned into areas, which simplifies management. Routing information transmitted between areas is summarized, which reduces network bandwidth consumption.
Equal-cost routes: OSPF supports multiple equal-cost routes to the same destination.
Hierarchical routing: OSPF uses intra-area routes, inter-area routes, Type 1 external routes, and Type 2 external routes, which are listed in descending order of priority.
Authentication: OSPF supports area-based and interface-based packet authentication, which ensures packet exchange security.
Multicast: OSPF uses multicast addresses to send packets on certain types of links, which minimizes the impact on other devices.
Understanding OSPF
Basic Concepts of OSPF
Router ID
A router ID is a 32-bit unsigned integer, which identifies a router in an autonomous system (AS). A router ID must exist if OSPF needs to be run.
A router ID can be manually configured or automatically selected by the router.
If a router ID is specified when an OSPF process is created in the system view, the configured router ID is used. If no router ID is specified when an OSPF process is created, the OSPF process uses the router ID in RM. For details about router ID selection rules in RM, see the router id command in the system view. In any of the following situations, OSPF router ID re-selection is performed:
- After you run this command to configure a new OSPF router ID, the OSPF process automatically restarts.
- No router ID is specified for an OSPF process, the router ID in RM changes, and the OSPF process is restarted using the reset ospf process command.
- If the self-healing function is enabled for OSPF router ID conflicts and an OSPF router ID conflict occurs on the network, a new OSPF router ID is selected and the OSPF process is automatically restarted. If no router ID is specified when an OSPF process is created and the device restarts in CFG mode, the router ID in the RM module when the OSPF process is created is used as the OSPF router ID after the restart. Therefore, you are advised to manually specify a router ID when creating the OSPF process.
Areas
When a large number of routers run OSPF, link state databases (LSDBs) become very large and require a large amount of storage space. Large LSDBs also complicate shortest path first (SPF) computation and overload the routers. As the network scale expands, there is an increasing probability that the network topology changes, causing the network to change continuously. In this case, a large number of OSPF packets are transmitted on the network, leading to a decrease in bandwidth utilization efficiency. In addition, each time the topology changes, all routers on the network must recalculate routes.
OSPF prevents frequent LSDB updates and improves network utilization by partitioning an AS into different areas. routers can be logically allocated to different groups (areas), and each group is identified by an area ID. A router, not a link, resides at the border of an area. A network segment or link can belong to only one area. An area must be specified for each OSPF interface.
OSPF areas include common areas, stub areas, and not-so-stubby areas (NSSAs). Table 1-592 describes these OSPF areas.
Area Type |
Function |
Description |
---|---|---|
Common area |
By default, OSPF areas are defined as common areas. Common areas include:
|
|
Stub area |
A stub area is a non-backbone area with only one area border router (ABR) and generally resides at the border of an AS. The ABR in a stub area does not transmit received AS external routes, which significantly decreases the number of entries in the routing table on the router and the amount of routing information to be transmitted. To ensure the reachability of AS external routes, the ABR in the stub area generates a default route and advertises the route to non-ABRs in the stub area. A totally stub area allows only intra-area routes and ABR-advertised Type 3 default routes to be advertised within the area and does not allow AS external routes or inter-area routes to be advertised. |
|
NSSA |
An NSSA is similar to a stub area. An NSSA does not support Type 5 LSAs but can import AS external routes. NSSA-LSA (Type 7)carrying the information about AS external routes are generated by ASBRs in an NSSA and are advertised only within the NSSA. When the Type 7 LSAs reach an ABR in the NSSA, the ABR translates the Type 7 LSAs into Type 5 LSAs and floods them to the entire OSPF domain. A totally NSSA allows only intra-area routes to be advertised within the area. AS external routes or inter-area routes cannot be advertised in a totally NSSA. |
|
Router Types
Routers are classified by location in an AS. Figure 1-1455 and Table 1-593 show the classification.
Router Type |
Description |
---|---|
Internal router |
All interfaces of an internal router belong to the same OSPF area. |
ABR |
An ABR can belong to two or more areas, one of which must be a backbone area. An ABR connects the backbone area and non-backbone areas, and it can connect to the backbone area either physically or logically. |
Backbone router |
At least one interface on this type of router belongs to the backbone area. Internal routers in the backbone area and all ABRs are backbone routers. |
ASBR |
Exchanges routing information with other ASs. An ASBR may be an internal router or an ABR, and therefore may not necessarily reside at the border of an AS. |
LSA
OSPF encapsulates routing information into LSAs for transmission. Table 1-594 describes LSAs and their functions.
LSA Type |
LSA Function |
---|---|
Router-LSA (Type 1) |
Describes the link status and cost of a router. Router-LSAs are generated by each router and advertised within the area to which the router belongs. |
Network-LSA (Type 2) |
Describes the link status on the local network segment. Network-LSAs are generated by a designated router (DR) and advertised within the area to which the DR belongs. |
Network-summary-LSA (Type 3) |
Describes routes on a network segment of an area. Network-summary-LSAs are generated by an ABR and advertised to other areas, excluding totally stub areas and totally NSSAs. For example, an ABR belongs to both area 0 and area 1, area 0 has a network segment 10.1.1.0, and area 1 has a network segment 10.2.1.0. In this case, the ABR generates Type 3 LSAs destined for the network segment 10.2.1.0 for area 0, and Type 3 LSAs destined for the network segment 10.1.1.0 for area 1. |
ASBR-summary-LSA (Type 4) |
Describes routes of an area to the ASBRs of other areas. ASBR-summary-LSAs are generated by an ABR and advertised to other areas, excluding stub areas, totally stub area, NSSAs, and totally NSSAs. |
Describes AS external routes. AS-external-LSAs are generated by an ASBR and are advertised to all areas, excluding stub areas, totally stub areas, NSSAs, and totally NSSAs. |
|
Describes AS external routes. NSSA-LSAs are generated by an ASBR and advertised only within NSSAs. |
|
Opaque-LSA (Type 9/Type 10/Type 11) |
Opaque-LSAs provide a general mechanism for OSPF extension.
|
Table 1-595 describes whether a type of LSA is supported in an area.
Area Type |
Router-LSA (Type 1) |
Network-LSA (Type 2) |
Network-summary-LSA (Type 3) |
ASBR-summary-LSA (Type 4) |
AS-external-LSA (Type 5) |
NSSA-LSA (Type 7) |
---|---|---|---|---|---|---|
Common area (including standard and backbone areas) |
Supported |
Supported |
Supported |
Supported |
Supported |
Not supported |
Stub area |
Supported |
Supported |
Supported |
Not supported |
Not supported |
Not supported |
Totally stub area |
Supported |
Supported |
Not supported (except the default Type 3 LSA) |
Not supported |
Not supported |
Not supported |
NSSA |
Supported |
Supported |
Supported |
Not supported |
Not supported |
Supported |
Totally NSSA |
Supported |
Supported |
Not supported (except the default Type 3 LSA) |
Not supported |
Not supported |
Supported |
Packet Types
OSPF uses IP packets to encapsulate protocol packets. The protocol number is 89. OSPF packets are classified as Hello, database description (DD), link state request (LSR), link state update (LSU), or link state acknowledgment (LSAck) packets, as described in Table 1-596.
Packet Type |
Function |
---|---|
Hello packet |
Hello packets are sent periodically to discover and maintain OSPF neighbor relationships. |
Database description (DD) packet |
A DD packet contains the summaries of LSAs in the local LSDB. DD packets are used for LSDB synchronization between two routers. |
Link state request (LSR) packet |
LSR packets are sent to OSPF neighbors to request required LSAs. A router sends LSR packets to its OSPF neighbor only after DD packets have been successfully exchanged. |
Link state update (LSU) packet |
LSU packets are used to transmit required LSAs to OSPF neighbors. |
Link state acknowledgment (LSAck) packet |
LSAck packets are used to acknowledge received LSAs. |
Route Types
AS intra-area and inter-area routes describe the network structure within an AS, and AS external routes describe how to select routes to destinations outside the AS. OSPF classifies the imported AS external routes into Type 1 and Type 2.
Table 1-597 describes OSPF routes in descending order of priority.
Route Type |
Description |
---|---|
Intra Area |
Intra-area route |
Inter Area |
Inter-area routes |
Type 1 external route |
This type of route is more reliable. Cost of a Type 1 external route = Cost of the route from a router to an ASBR + Cost of the route from the ASBR to the destination When multiple ASBRs exist, the cost of each Type 1 external route equals the cost of the route from the local device to an ASBR plus the cost of the route from the ASBR to the destination. The cost is used for route selection. |
Type 2 external route |
Because a Type 2 external route offers low reliability, its cost is considered to be much greater than the cost of any internal route to an ASBR. Cost of a Type 2 external route = Cost of the route from an ASBR to the destination If multiple ASBRs have routes to the same destination, the route with the lowest cost from the corresponding ASBR to the destination is selected and imported. If the costs of the imported routes are the same, the router compares the costs of the routes from the local router to the corresponding ASBR and selects the route with the smallest cost to import. The cost of each Type 2 external route equals the cost of the route from the corresponding ASBR to the destination. |
OSPF Network Classification
According to the link layer protocol type, OSPF classifies networks into four types, as described in Table 1-598.
Network Type |
Link Layer Protocol |
Graph |
---|---|---|
Broadcast |
|
|
NBMA |
X.25 |
|
Point-to-Multipoint (P2MP) |
No link layer protocol is considered as the P2MP type by default. P2MP is forcibly changed from another type of network. In most cases, a non-fully meshed NBMA network is changed to a P2MP network. |
|
P2P |
|
DR and BDR
On broadcast or NBMA networks, any two routers need to exchange routing information. As shown in Figure 1-1456, n routers are deployed on the network. n x (n - 1)/2 adjacencies must be established. Any route change on a router is transmitted to other routers, which wastes bandwidth resources. OSPF resolves this problem by defining a DR and a BDR. After a DR is elected, all routers send routing information only to the DR. Then the DR broadcasts LSAs. routers other than the DR and BDR are called DR others. The DR others establish only adjacencies with the DR and BDR and not with each other. This process reduces the number of adjacencies established between routers on broadcast or NBMA networks.
If the original DR fails, routers must reelect a DR and the routers except the new DR must synchronize routing information to the new DR. This process is lengthy, which may cause incorrect route calculations. A BDR is used to shorten the process. The BDR is a backup for a DR. A BDR is elected together with a DR. The BDR establishes adjacencies with all routers on the network segment and exchanges routing information with them. If the DR fails, the BDR immediately becomes a new DR. Because no re-election is required and adjacencies have been established, this process is very short. In this case, a new BDR needs to be elected. Although this process takes a long time, it does not affect route calculation.
The DR and BDR are not designated manually. Instead, they are elected by all routers on the network segment. The DR priority of an interface on the router determines whether the interface is qualified for DR or BDR election. On the local network segment, the routers whose DR priorities are greater than 0 are all candidates. Hello packets are used for the election. Each router adds information about the DR elected by itself to a Hello packet and sends the packet to other routers on the network segment. If two routers on the same network segment declare that they are DRs, the one with a higher DR priority wins. If they have the same priority, the one with a larger router ID wins. If the priority of a router is 0, it cannot be elected as a DR or BDR.
OSPF Multi-Process
OSPF multi-process allows multiple OSPF processes to independently run on the same router. Route exchange between different OSPF processes is similar to that between different routing protocols. A router's interface can belong only to one OSPF process.
A typical application of OSPF multi-process is that OSPF runs between PEs and CEs in VPN scenarios and OSPF is also used as an IGP on the VPN backbone network. The OSPF processes on the PEs are independent of each other.
OSPF Default Route
A default route is the route whose destination address and mask are both all 0s. If no matching route is found, the default route can be used by the router to forward packets.
OSPF default routes are generally applied to the following scenarios:
An ABR in an area advertises Type 3 default summary LSAs within the area to help the routers in the area forward inter-area packets.
An ASBR in an AS advertises Type 5 external default ASE LSAs or Type 7 external default NSSA LSAs to help the routers in the AS forward AS external packets.
OSPF routes are hierarchically managed. The priority of the default route carried in Type 3 LSAs is higher than the priority of the default route carried in Type 5 or Type 7 LSAs.
The rules for advertising OSPF default routes are as follows:
- An OSPF device can advertise default route LSAs only when it has an external interface.
- If an OSPF device has advertised default route LSAs, it no longer learns the same type of default route advertised by other routers. That is, the device no longer calculates the same type of default route LSA advertised by other routers. However, the corresponding LSAs exist in the database.
- If the advertisement of external default routes depends on other routes, the dependent routes cannot be the routes (learned by the local OSPF process) in the local OSPF routing domain. This is because external default routes are used to guide packet forwarding outside the domain. However, the next hops of routes in the OSPF routing domain are within the domain, unable to guide packet forwarding outside the domain.
- Before a router advertises a default route, it checks whether a neighbor in the full state is present in area 0. The router advertises a default route only when a neighbor in the full state is present in area 0. If no such a neighbor exists, the backbone area cannot forward packets and advertising a default route is meaningless. For the concept of the Full State, see OSPF Neighbor States.
Table 1-599 describes the principles for advertising default routes in different areas.
Area Type |
Principles for Advertising Default Routes |
---|---|
Common area |
By default, OSPF devices in a common area do not generate default routes, even if they have default routes. When a default route is generated by another routing process, the router must advertise the default route to the entire OSPF AS. To achieve this, a command must be run on the ASBR to generate a default route. After the configuration is complete, the router generates a default ASE LSA (Type 5 LSA) and advertises it to the entire OSPF AS. If no default route exists on the ASBR, the router does not advertise a default route. |
Stub Area |
Type 5 LSAs cannot be advertised within a stub area. A router in the stub area must learn AS external routes from an ABR. The ABR automatically generates a default Summary LSA (Type 3 LSA) and advertises it within the entire stub area. Then the device can learn AS external routes from the ABR. |
Totally Stub Area |
Neither Type 3 (except default Type 3 LSAs) nor Type 5 LSAs can be advertised within a totally stub area. A router in the totally stub area must learn AS external and inter-area routes from an ABR. After you configure a totally stub area, an ABR automatically generates a default Summary LSA (Type 3 LSA) and advertises it within the entire totally stub area. Then the device can learn AS external and inter-area routes from the ABR. |
NSSA |
A small number of AS external routes learned from the ASBR in an NSSA can be imported to the NSSA. External routes ASE LSAs (Type 5 LSAs) to other areas cannot be advertised within the NSSA. When at least a neighbor in Full status and an interface that is Up exist in the backbone area, the ABR automatically generates a Type 7 LSA carrying a default route and advertises it within the entire NSSA. In this case, a small number of routes are learned through the ASBR in the NSSA, and other routes are learned through the ABR in the NSSA. You can manually configure the ASBR to generate a default NSSA LSA (Type 7 LSA) and advertise it in the entire NSSA. In this manner, external routes can also be learned through the ASBR in the NSSA. An ABR does not translate Type 7 LSA default routes into Type 5 LSA default routes for transmission in the entire OSPF domain. |
Totally NSSA |
A totally NSSA does not allow ASE LSAs (Type 5 LSAs) of external routes or inter-area routes (Type 3 LSAs, except the default Type 3 LSAs) to be transmitted within the area. A router in this area must learn AS external routes from an ABR. The ABR automatically generates Type 3 and Type7 LSAs carrying a default route and advertises them to the entire totally NSSA. Then, AS external and inter-area routes can be advertised within the area through the ABR. |
OSPF Fundamentals
OSPF route calculation involves the following processes:
-
The adjacency establishment process is as follows:
- The local and remote devices use OSPF interfaces to exchange Hello packets to establish a Neighbor relationship.
- The local and remote devices negotiate a master/slave relationship and exchange Database Description (DD) packets.
- The local and remote devices exchange link state advertisements (LSAs) to synchronize their link state databases (LSDBs).
Route calculation: OSPF uses the shortest path first (SPF) algorithm to calculate routes, implementing fast route convergence.
OSPF Neighbor States
To exchange routing information on an OSPF network, neighbor routers must establish adjacencies. The differences between neighbor relationships and adjacencies are described as follows:
- Neighbor relationship: After the local router starts, it uses an OSPF interface to send a Hello packet to the remote router. After the remote router receives the packet, it checks whether the parameters carried in the packet are consistent with its own parameters. If the parameters carried in the packet are consistent with its own parameters, the remote router establishes a neighbor relationship with the local router.
- Adjacency: After the local and remote routers establish a neighbor relationship, they exchange DD packets and LSAs to establish an adjacency.
OSPF has eight neighbor states: Down, Attempt, Init, 2-way, Exstart, Exchange, Loading, and Full. Down, 2-way, and Full are stable states. Attempt, Init, Exstart, Exchange, and Loading are unstable states, which last only several minutes. Figure 1-1457 shows the eight neighbor states.
OSPF Neighbor State |
Meaning |
---|---|
Down |
This is the initial state of a neighbor conversation. This state indicates that a router has not received any Hello packets from its neighbors within a dead interval. |
Attempt |
In the Attempt state, a router periodically sends Hello packets to manually configured neighbors. NOTE:
This state applies only to non-broadcast multiple access (NBMA) interfaces. |
Init |
This state indicates that a router has received Hello packets from its neighbors but the neighbors did not receive Hello packets from the router. |
2-way |
This state indicates that a device has received Hello packets from its neighbors and Neighbor relationship have been established between the devices. If no adjacency needs to be established, the neighbors remain in the 2-way state. If adjacencies need to be established, the neighbors enter the Exstart state. |
Exstart |
In the Exstart state, devices establish a master/slave relationship to ensure that DD packets are sequentially exchanged. |
Exchange |
In the Exchange state, routers exchange DD packets. A router uses a DD packet to describe its own LSDB and sends the packet to its neighbors. |
Loading |
In the Loading state, a device sends Link State Request (LSR) packets to its neighbors to request their LSAs for LSDB synchronization. |
Full |
In this state, a device establishes adjacencies with its OSPF neighbors and all LSDBs have been synchronized. |
The neighbor state of the local device may be different from that of a remote device. For example, the neighbor state of the local router is Full, but the neighbor state of the remote router is Loading.
Adjacency Establishment
Adjacencies can be established in either of the following situations:
Two routers have established a neighbor relationship and communicate for the first time.
The designated router (DR) or backup designated router (BDR) on a network segment changes.
The adjacency establishment process is different on different networks.
Adjacency establishment on a broadcast network
Figure 1-1458 shows the adjacency establishment process on a broadcast network.
On the broadcast network, the DR and BDR establish adjacencies with each router on the same network segment, but DR others establish only neighbor relationships.
Figure 1-1458 shows the OSPF adjacency establishment process on a broadcast network.
Neighbor relationship establishment
Router A uses the multicast address 224.0.0.5 to send a Hello packet through the OSPF interface connected to a broadcast network. In this case, Router A does not know which router is the DR or which router is a neighbor. Therefore, the DR field is 0.0.0.0, and the Neighbors Seen field is 0.
After Router B receives the packet, it returns a Hello packet to Router A. The returned packet carries the DR field of 2.2.2.2 (ID of Router B) and the Neighbors Seen field of 1.1.1.1 (Router A's router ID). Router A has been discovered but its router ID is less than that of Router B, and therefore Router B regards itself as a DR. Then Router B's state changes to Init.
After Router A receives the packet, Router A's state changes to 2-way.
The following procedures are not performed for DR others on a broadcast network.
Master/Slave negotiation and DD packet exchange
- Router A sends a DD packet. The packet carries the following fields:
- Seq field: The value x indicates the sequence number is x.
- I field: The value 1 indicates that the packet is the first DD packet, which is used to negotiate a master/slave relationship and does not carry LSA summaries.
- M field: The value 1 indicates that the packet is not the last DD packet.
- MS field: The value 1 indicates that Router A declares itself a master.
To improve transmission efficiency, Router A and Router B determine which LSAs in each other's LSDB need to be updated. If one party determines that an LSA of the other party is already in its own LSDB, it does not send an LSR packet for updating the LSA to the other party. To achieve the preceding purpose, Router A and Router B first send DD packets, which carry summaries of LSAs in their own LSDBs. Each summary identifies an LSA. To ensure packet transmission reliability, a master/slave relationship must be determined during DD packet exchange. One party serving as a master uses the Seq field to define a sequence number. The master increases the sequence number by one each time it sends a DD packet. When the other party serving as a slave sends a DD packet, it adds the sequence number carried in the last DD packet received from the master to the Seq field of the packet.
After receiving the DD packet from Router A, Router B sets the neighbor state of Router A to Exstart and returns a DD packet. The returned packet does not carry LSA summaries either. Because Router B's router ID is greater than Router A's router ID, Router B declares itself a master and sets the Seq field to y.
After Router A receives the DD packet, it agrees that Router B is a master and Router A's state changes to Exchange. Then Router A sends a DD packet to Router B to transmit LSA summaries. The packet carries the Seq field of y and the MS field of 0. The value 0 indicates that Router A declares itself a slave.
After Router B receives the packet, Router B's state changes to Exchange and Router B sends a new DD packet containing its own LSA summaries to Router A. The value of the Seq field carried in the new DD packet is changed to y + 1.
Router A uses the same sequence number as Router B to confirm that it has received DD packets from Router B. Router B uses the sequence number plus one to confirm that it has received DD packets from Router A. When Router B sends the last DD packet, it sets the M field of the packet to 0.
LSDB synchronization
After Router A receives the last DD packet, it finds that many LSAs in Router B's LSDB do not exist in its own LSDB, so Router A's state changes to Loading. After Router B receives the last DD packet from Router A, Router B's state directly changes to Full, because Router B's LSDB already contains all LSAs of Router A.
Router A sends an LSR packet for updating LSAs to Router B. Router B returns an LSU packet to Router A. After Router A receives the packet, it sends an LSAck packet for acknowledgment.
The preceding procedures continue until the LSAs in Router A's LSDB are the same as those in Router B's LSDB. Router A sets the state of the neighbor relationship with Router B to Full. After the routers exchange DD packets and update all LSAs, they establish an adjacency.
Adjacency establishment on an NBMA network
The adjacency establishment process on an NBMA network is similar to that on a broadcast network. The blue part shown in Figure 1-1459 highlights the differences from a broadcast network.
On an NBMA network, all routers establish adjacencies only with the DR and BDR.
The adjacency establishment process on an NBMA network is as follows:
Neighbor relationship establishment
After Router B sends a Hello packet to a down interface of Router A, Router B's state changes to Attempt. At this time, Router B regards itself as a DR but does not know which router is the neighbor. The packet carries the DR field of 2.2.2.2 (ID of Router B) and the Neighbors Seen field of 0.
After Router A receives the Hello packet, Router A sets the neighbor state to Init and returns a Hello packet. Router A agrees that Router B is a DR. The DR and Neighbors Seen fields are both set to 2.2.2.2.
The following procedures are not performed for DR others on an NBMA network.
Master/Slave relationship negotiation and DD packet exchange
The procedures for negotiating a master/slave relationship and exchanging DD packets on an NBMA network are the same as those on a broadcast network.
LSDB synchronization
The procedure for synchronizing LSDBs on an NBMA network is the same as that on a broadcast network.
Adjacency establishment on a point-to-point (P2P)/Point-to-multipoint (P2MP) network
The adjacency establishment process on a P2P/P2MP network is similar to that on a broadcast network. On a P2P/P2MP network, however, no DR or BDR needs to be elected and DD packets are transmitted in multicast mode.
Route Calculation
OSPF uses the shortest path first (SPF) algorithm to calculate routes, implementing fast route convergence.
OSPF uses an LSA to describe the network topology. A Router LSA describes the attributes of a link between routers. A router transforms its LSDB into a weighted, directed graph, which reflects the topology of the entire AS. All routers in the same area have the same graph. Figure 1-1460 shows a weighted, directed graph.
Based on the graph, each router uses the SPF algorithm to calculate an SPT with itself as the root. The SPT shows routes to nodes in the AS. Figure 1-1461 shows an SPT.
When a router's LSDB changes, the router recalculates a shortest path. Frequent SPF calculations consume a large number of resources and affect router efficiency. Changing the interval between SPF calculations can prevent resource consumption caused by frequent LSDB changes. The default interval between SPF calculations is 5 seconds.
The route calculation process is as follows:
A router calculates intra-area routes.
The router uses an SPF algorithm to calculate shortest paths to other routers in an area. Router LSAs and Network LSAs accurately describe the network topology in an area. Based on the network topology described by a Router LSA, the router calculates paths to other routers in the area.
If multiple equal-cost routes are produced during route calculation, the SPF algorithm retains all these routes in the LSDB.
The router calculates inter-area routes.
For the devices in an area, the network segment of the routes in an adjacent area is directly connected to the area border router (ABR). Because the shortest path to the ABR has been calculated in the preceding step, the devices can directly check a Network Summary LSA to obtain the shortest path to the network segment. The autonomous system boundary router (ASBR) can also be considered connected to the ABR. Therefore, the shortest path to the ASBR can also be calculated in this phase.
If the router performing an SPF calculation is an ABR, the router needs to check only Type 3 LSAs in the backbone area.
If there are multiple paths to an ASBR, check whether the rules for selecting a path to the ASBR among intra-area and inter-area paths on different types of devices are the same. If the rules are different, routing loops may occur.
The RFC 1583 compatibility mode and RFC 1583 non-compatibility mode may affect path selection rules. Even in the same mode, the path selection rules on devices from different vendors may be slightly different. In this case, the rules used in RFC 1583 compatibility mode or RFC 1583 non-compatibility mode for selecting a path to an ASBR can be adjusted, preventing loops to some extent.
The router calculates AS external routes.
AS external routes can be considered to be directly connected to the ASBR. Because the shortest path to the ASBR has been calculated in the preceding phase, the device can check AS External LSAs to obtain the shortest paths to other ASs.
OSPF Route Control
You can use the following features to control the advertising and receiving of OSPF routes. These features meet requirements for network planning and traffic management.
-
Route summarization enables a router to summarize routes with the same prefix into a single route and to advertise only the summarized route to other areas. Route summarization reduces the size of a routing table and improves router performance.
-
OSPF can use routing policies to filter routes. By default, OSPF does not filter routes.
-
Set the maximum number of external routes supported by the LSDB to dynamically limit the LSDB's size.
Route Summarization
When a large OSPF network is deployed, an OSPF routing table includes a large number of routing entries. To accelerate route lookup and simplify management, configure route summarization to reduce the size of the OSPF routing table. If a link frequently alternates between Up and Down, the links not involved in the route summarization are not affected. This process prevents route flapping and improves network stability.
Route summarization can be carried out on an ABR or ASBR.
ABR summarization
When an ABR transmits routing information to other areas, it generates Type 3 LSAs for each network segment. If consecutive network segments exist in this area, you can summarize these network segments into a single network segment. The ABR generates one LSA for the summarized network segment and advertises only that LSA.
ASBR summarization
If route summarization has been configured and the local router is an ASBR, the local router summarizes imported Type 5 LSAs within the summarized address range. If an NSSA has been configured, the local router also summarizes imported Type 7 LSAs within the summarized address range.
If the local router is both an ASBR and an ABR, it summarizes Type 5 LSAs translated from Type 7 LSAs.
Route Filtering
OSPF routing policies include access control lists (ACLs), IP prefix lists, and route-policies. For details about these policies, see the section "Routing Policy" in the NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 MFeature Description - IP Routing.
OSPF route filtering applies in the following aspects:
Route import
OSPF can import the routes learned by other routing protocols. A router uses a configured routing policy to filter routes and imports only the routes matching the routing policy. Only an ASBR can import routes, and therefore a routing policy for importing routes must be configured on the ASBR.
Advertising of imported routes
A router advertises imported routes to its neighbors. Only an ASBR can import routes, and therefore a routing policy for the advertising of imported routes must be configured on the ASBR.
If OSPF imports a large number of external routes and advertises them to a device with a smaller routing table capacity, the device may restart unexpectedly. To address this problem, configure a limit on the number of LSAs generated when an OSPF process imports external routes.
Route learning
A router uses a routing policy to filter received intra-area, inter-area, and AS external routes. The router adds only the routes matching the routing policy to its routing table. All routes can still be advertised from an OSPF routing table.
The router filters only routes calculated based on LSAs, and therefore learned LSAs are complete.
Inter-area LSA learning
An ABR in an area can be configured to filter Type 3 LSAs advertised to the area. The ABR can advertise only Type 3 LSAs, and therefore a routing policy for inter-area LSA learning must be configured on the ABR.
During inter-area LSA learning, the ABR directly filters Type 3 LSAs advertised to the area.
Inter-area LSA advertising
An ABR in an area can be configured to filter Type 3 LSAs advertised to other areas. The ABR can advertise only Type 3 LSAs, and therefore a routing policy for inter-area LSA advertising must be configured on the ABR.
OSPF Database Overflow
OSPF requires that devices in the same area have the same LSDB. As the number of routes increase continually, some devices cannot carry excess routing information due to limited system resources. This situation is called an OSPF database overflow.
You can configure stub areas or NSSAs to prevent resource exhaustion caused by continually increasing routing information. However, configuring stub areas or NSSAs cannot prevent an OSPF database overflow caused by a sharp increase in dynamic routes. To resolve this issue, set the maximum number of external routes supported by the LSDB to dynamically limit the LSDB's size.
The maximum number of external routes configured for all devices in the OSPF AS must be the same.
When the number of external routes in the LSDB reaches the maximum number, the device enters the overload state and starts the overflow timer at the same time. The device automatically exits from the overflow state after the overflow timer expires. Table 1-601 describes the operations performed by the device after it enters or exits from the overload state.
Phase |
OSPF Processing Procedure |
---|---|
Staying at overload state |
Deletes self-generated non-default external routes and stops advertising non-default external routes. Discards newly received non-default external routes and does not reply with a Link State Acknowledgment (LSAck) packet. Checks whether the number of external routes is still greater than the configured maximum number when the overflow timer expires.
|
Exiting from the overflow state |
Ends the overflow timer. Advertises non-default external routes. Accepts newly received non-default external routes and replies with LSAck packets. |
OSPF Virtual Link
Background
All non-backbone areas must be connected to the backbone area during OSPF deployment to ensure that all areas are reachable.
In Figure 1-1462, area 2 is not connected to area 0 (backbone area), and Device B is not an ABR. Therefore, Device B does not generate routing information about network 1 in area 0, and Device C does not have a route to network 1.
Some non-backbone areas may not be connected to the backbone area. You can configure an OSPF virtual link to resolve this issue.
Related Concepts
A virtual link refers to a logical channel established between two ABRs over a non-backbone area.
- A virtual link must be configured at both ends of the link.
- The non-backbone area involved is called a transit area.
A virtual link is similar to a point-to-point (P2P) connection established between two ABRs. You can configure interface parameters, such as the interval at which Hello packets are sent, at both ends of the virtual link as you do on physical interfaces.
Principles
In Figure 1-1463, two ABRs use a virtual link to directly transmit OSPF packets. The device between the two ABRs only forwards packets. Because the destination of OSPF packets is not the device, the device transparently transmits the OSPF packets as common IP packets.
OSPF TE
OSPF Traffic Engineering (TE) is developed based on OSPF to support Multiprotocol Label Switching (MPLS) TE and establish and maintain TE LSPs. In the MPLS TE architecture described in "MPLS Feature Description", OSPF functions as the information advertising component, responsible for collecting and advertising MPLS TE information.
In addition to the network topology, TE needs to know network constraints, such as the bandwidth, TE metric, administrative group, and affinity attribute. However, current OSPF functions cannot meet these requirements. Therefore, OSPF introduces a new type of LSAs to advertise network constraints. Based on the network constraints, the Constraint Shortest Path First (CSPF) algorithm can calculate the path subject to specified constraints.
OSPF in the MPLS TE Architecture
In the MPLS TE architecture, OSPF functions as the information advertising component:
Collects related information about TE.
Floods TE information to devices in the same area.
Uses the collected TE information to form the TE database (TEDB) so that CSPF can calculate routes.
OSPF does not care about information content or how MPLS uses the information.
TE-LSA
OSPF uses a new type of LSA (Type 10 opaque LSA) to collect and advertise TE information. Type 10 opaque LSAs contain the link status information required by TE, including the maximum link bandwidth, maximum reservable bandwidth, current reserved bandwidth, and link color. Based on the OSPF flooding mechanism, Type 10 opaque LSAs synchronize link status information among devices in an area to form a uniform TEDB for route calculation.
Interaction Between OSPF TE and CSPF
OSPF uses Type 10 LSAs to collect TE information in an area, such as the bandwidth, priority, and link metrics. After processing the collected TE information, OSPF provides it for CSPF to calculate routes.
IGP Shortcut and Forwarding Adjacency
OSPF supports IGP shortcut and forwarding adjacency. The two features allow OSPF to use a tunnel interface as an outbound interface to reach a destination.
Differences between IGP shortcut and forwarding adjacency are as follows:
An IGP shortcut-enabled device uses a tunnel interface as an outbound interface but does not advertise the tunnel interface to neighbors. Therefore, other devices cannot use this tunnel.
A forwarding adjacency-enabled device uses a tunnel interface as an outbound interface and advertises the tunnel interface to neighbors. Therefore, other devices can use this tunnel.
IGP shortcut is unidirectional and needs to be configured only on the device that uses IGP shortcut.
OSPF SRLG
OSPF supports the applications of the Shared Risk Link Group (SRLG) in MPLS by obtaining information about the TE SRLG flooded among devices in an area. For details, refer to the chapter "MPLS" in this manual.
OSPF TE Tunnel Microloop Avoidance
If a network fault occurs, IGP convergence is triggered. In this case, a transient forwarding status inconsistency may occur among nodes because of their different convergence rates, which poses the risk of microloops. If the outbound interface of a route before IGP convergence is a shortcut TE tunnel interface and the OSPF TE tunnel microloop avoidance function is enabled, the outbound interface of the route remains unchanged during IGP convergence. In this case, traffic is forwarded through a hot standby TE tunnel, and the forwarding process does not depend on IGP convergence on each device, preventing microloops.
OSPF VPN
Definition
As an extension of OSPF, OSPF VPN 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 use OSPF to advertise VPN routes to CEs, no other routing protocols need to be configured on CEs for interworking with PEs, which simplifies management and configuration of CEs.
Running OSPF Between PEs and CEs
In BGP/MPLS VPN, Multi-Protocol BGP (MP-BGP) is used to transmit routing information between PEs, whereas OSPF is used to learn and advertise routes between PEs and CEs.
Running OSPF between PEs and CEs has the following benefits:
OSPF is used in a site to learn routes. Running OSPF between PEs and CEs can reduce the number of the protocol types that CEs must support.
Similarly, running OSPF both in a site and between PEs and CEs simplifies the work of network administrators and reduces the number of protocols that network administrators must be familiar with.
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.
In Figure 1-1465, CE1, CE3, and CE4 belong to VPN 1, and the numbers following OSPF refer to the process IDs of the multiple OSPF instances running on PEs.
The routes that PE1 receives from CE1 are advertised to CE3 and CE4 as follows:
PE1 imports OSPF routes of CE1 into BGP and converts them to BGP VPNv4 routes.
PE1 uses MP-BGP to advertise the BGP VPNv4 routes to PE2.
PE2 imports the 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.
Configuring OSPF Areas Between PEs and CEs
OSPF areas between PEs and CEs can be non-backbone or backbone areas (Area 0). PEs can function only as ABRs.
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 deployed between the PEs and the backbone area. Figure 1-1466 shows the networking for configuring OSPF areas between PEs and CEs.
A non-backbone area (Area 1) is configured between PE1 and CE1, and a backbone area (Area 0) is configured in Site 1. The backbone area in Site 1 is separated from the VPN backbone area. To ensure that the backbone areas are contiguous, a virtual link is configured between PE1 and CE1.
OSPF Domain ID
If inter-area routes are advertised between local and remote OSPF areas, these areas are considered to be in the same OSPF domain.
Domain IDs identify domains.
Each OSPF domain has one or more domain IDs. If more than one domain ID is available, one of the domain IDs is a primary ID, and the others are secondary IDs.
If an OSPF instance does not have a specific domain ID, its ID is considered as null.
Before advertising the remote routes sent by BGP to CEs, PEs need to determine the type of OSPF routes (Type 3, Type 5, or Type 7) to be advertised to CEs based on domain IDs.
If local domain IDs are the same as or compatible with remote domain IDs in BGP routes, PEs advertise Type 3 routes.
Otherwise, Type 5 or Type 7 routes are advertised.
Relationship Between Local and Remote Domain IDs |
Comparison Between Local and Remote Domain IDs |
Type of the Generated Routes |
---|---|---|
Both the local and remote domain IDs are null. |
Equal |
Inter-area routes |
The remote domain ID is the same as the local primary domain ID or one of the local secondary domain IDs. |
Equal |
Inter-area routes |
The remote domain ID is different from the local primary domain ID or any of the local secondary domain IDs. |
Not equal |
If the local area is a non-NSSA, external routes are generated. If the local area is an NSSA, NSSA routes are generated. |
Routing Loop Prevention
Routing loops may occur between PEs and CEs when OSPF and BGP learn routes from each other.
In Figure 1-1467, on PE1, OSPF imports a BGP route destined for 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 10.1.1.1/32 as the destination address and PE1 as the next hop and advertises the route to PE2. Therefore, PE2 learns an OSPF route with 10.1.1.1/32 as the destination address and CE1 as the next hop.
Similarly, CE1 also learns an OSPF route with 10.1.1.1/32 as the destination address and PE2 as the next hop. PE1 learns an OSPF route with 10.1.1.1/32 as the destination address and CE1 as the next hop.
As a result, CE1 has two equal-cost routes with PE1 and PE2 as next hops respectively, and the next hop of the routes from PE1 and PE2 to 10.1.1.1/32 is CE1, which leads to a routing loop.
In addition, the priority 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 with the OSPF route, and the OSPF route with 10.1.1.1/32 as the destination address and CE1 as the next hop is active in the routing tables of PE1 and PE2.
The BGP route is inactive, and therefore, the LSA generated when this route is imported by OSPF is deleted, which causes the OSPF route to be withdrawn. As a result, no OSPF route exists in the routing table, and the BGP route becomes active again. This cycle causes route flapping.
OSPF VPN provides a few solutions to routing loops, as described in Table 1-603.
Feature |
Definition |
Function |
---|---|---|
DN-bit |
It is a flag bit used by OSPF multi-instance processes to prevent routing loops. |
After OSPF multi-instance is configured on the router (a PE or an MCE), the router sets the DN-bit of generated Type 3, Type 5, or Type 7 LSAs to 1 and retains the DN-bit (0) of other LSAs. When calculating routes, the OSPF multi-instance process on the router ignores the LSAs in which the DN bit is set. This prevents routing loops that occur when LSAs sent by a PE (or MCE) are sent back to the PE (or MCE) through a CE. On the network shown in Figure 1-1467, PE1 sets the DN bit in the generated Type 3, Type 5, or Type 7 LSAs to 1 and advertises these LSAs to CEs. Then, the CEs send the LSAs to PE2. Upon reception of these LSAs, PE2 checks the DN bit of the LSAs and finds that the DN bit is 1. Therefore, PE2 ignores the LSAs, which prevents routing loops. |
VPN Route Tag |
The VPN route tag is carried in Type 5 or Type 7 LSAs generated by PEs based on the received BGP VPN route. It is not carried in BGP extended community attributes. The VPN route tag is valid only on PEs that receive BGP routes and generate OSPF LSAs. |
When a PE detects that the VPN route tag in the incoming LSA is the same as the local route tag, the PE ignores the LSA, which prevents routing loops. |
Default route |
It is a route whose destination IP address and mask are both 0. |
Default routes are used to forward traffic from CEs or sites where CEs reside to the VPN backbone network. |
Disabling Routing Loop Prevention
Exercise caution when disabling routing loop prevention because it may cause routing loops.
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 runs between ASBRs to transmit VPN routes, the remote ASBR may fail to learn the OSPF routes sent by the local ASBR due to the routing loop prevention mechanism.
In Figure 1-1468, inter-AS VPN Option A is deployed with OSPF running between PE1 and CE1. CE1 sends VPN routes to CE3.
PE1 learns routes to CE1 using the OSPF process in a VPN instance, imports these routes into MP-BGP, and sends the MP-BGP routes to ASBR1.
After receiving 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 carrying DN bit 1.
ASBR2 uses OSPF to learn these LSAs and checks the DN bit of each LSA. After learning that the DN bit in each LSA is 1, ASBR2 does not add the routes carried in these LSAs to its routing table.
The routing loop prevention mechanism prevents ASBR2 from learning the OSPF routes sent from ASBR1. As a result, CE1 cannot communicate with CE3.
To address the preceding problem, use either of the following methods:
Disable the device from setting the DN bit to 1 in the LSAs when importing BGP routes into OSPF. For example, if ASBR1 does not set the DN bit to 1 when importing MP-BGP routes into OSPF. After ASBR2 receives these routes and finds that the DN bit in the LSAs carrying these routes is 0, ASBR2 will add the routes to its routing table.
Disable the device from checking the DN bit after receiving 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 receiving these LSAs.
The preceding methods can be used based on specific types of 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 1-1469, 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, which may cause routing loops, as described in Routing Loop Prevention. 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, ASBR2 can be disabled from checking the DN bit in the Type 3 LSAs generated by devices with router ID 1.1.1.1 and router ID 3.3.3.3. After the configuration is complete, if ASBR2 receives Type 3 LSAs sent by ASBR4 with router ID 4.4.4.4, ASBR2 checks the DN bit and denies these Type 3 LSAs because the DN bit is set to 1.
Sham Link
OSPF sham links are unnumbered P2P links between two PEs over an MPLS VPN backbone network.
Generally, BGP extended community attributes carry routing information over the MPLS VPN backbone between BGP peers. OSPF running on the other PE can use the routing information to generate inter-area routes from PEs to CEs.
In Figure 1-1470, if an intra-area OSPF link exists between the network segments of local and remote CEs. Routes that pass through the intra-area route link and have higher priorities than inter-area routes that pass through the MPLS VPN backbone network. As a result, VPN traffic is always forwarded through the intra-area route instead of the backbone network. To prevent such a problem, an OSPF sham link can be established between PEs so that the routes that pass through the MPLS VPN backbone network also become OSPF intra-area routes and take precedence.
A sham link is a link between two VPN instances. Each VPN instance contains the address of an end-point of a sham link. The address is a loopback address with the 32-bit mask in the VPN address space on the PE.
After a sham link is established between two PEs, the PEs become neighbors on the sham link and exchange routing information.
A sham link functions as a P2P link within an area. Users can select a route from the sham link and intra-area route link by adjusting the metric.
Multi-VPN-Instance CE
OSPF multi-instance generally runs on PEs. Devices that run OSPF multi-instance within user LANs are called Multi-VPN-Instance CEs (MCEs).
Compared with OSPF multi-instance running on PEs, MCEs have the following characteristics:
MCEs do not need to support OSPF-BGP association.
MCEs establish one OSPF instance for each service. Different virtual CEs transmit different services, which ensures LAN security at a low cost.
MCEs implement different OSPF instances on a CE. The key to implementing MCEs is to disable loop detection and calculate routes directly. MCEs also use the received LSAs with the DN-bit 1 for route calculation.
OSPF NSSA
Background
As defined in OSPF, stub areas cannot import external routes. This mechanism prevents external routes from consuming the bandwidth and storage resources of routers in stub areas. If you need to both import external routes and prevent resource consumption caused by external routes, you can configure not-so-stubby areas (NSSAs).
There are many similarities between NSSAs and stub areas. However, different from stub areas, NSSAs can import AS external routes into the OSPF AS and advertise the imported routes in the OSPF AS without learning external routes from other areas on the OSPF network.
Related Concepts
N-bit
A router uses the N-bit carried in a Hello packet to identify the area type that it supports. The same area type must be configured for all routers in an area. If routers have different area types, they cannot establish OSPF neighbor relationships. Some vendors' devices do not comply with standard protocols, but the N-bit is also set in OSPF Database Description (DD) packets. You can manually set the N-bit on a router to interwork with the vendors' devices.
Type 7 LSA
Type 7 LSAs, which describe imported external routes, are introduced to support NSSAs. Type 7 LSAs are generated by an ASBR in an NSSA and advertised only within the NSSA. After an ABR in an NSSA receives Type 7 LSAs, it selectively translates Type 7 LSAs into Type 5 LSAs to advertise external routes to other areas on an OSPF network.
Principles
To advertise external routes imported by an NSSA to other areas, a translator must translate Type 7 LSAs into Type 5 LSAs. Notes for an NSSA are as follows:
By default, the translator is the ABR with the largest router ID in the NSSA.
The propagate bit (P-bit) is used to notify a translator whether Type 7 LSAs need to be translated.
Only Type 7 LSAs with the P-bit set and a non-zero forwarding address (FA) can be translated into Type 5 LSAs. An FA indicates that packets to a destination address will be forwarded to the address specified by the FA.
FA indicates that the packet to a specific destination address is to be forwarded to the address specified by.
The loopback interface address in an area is preferentially selected as the FA. If no loopback interface exists, the address of the interface that is Up and has the smallest logical index in the area is selected as the FA.
The P-bit is not set for default routes in Type 7 LSAs generated by an ABR.
Figure 1-1471 shows an NSSA.
Advantages
Multiple ABRs may be deployed in an NSSA. To prevent routing loops caused by default routes, ABRs do not calculate the default routes advertised by each other.
OSPF Local MT
Background
When multicast and an MPLS TE tunnel are configured on a network and the TE tunnel is configured with IGP Shortcut, the outbound interface of the route calculated by an IGP may be not an actual physical interface but a TE tunnel interface. The TE tunnel interface on the Device sends multicast Join messages over a unicast route to the multicast source address. The multicast Join messages are transparent to the Device spanned by the TE tunnel. As a result, the Device spanned by the TE tunnel cannot generate multicast forwarding entries.
To resolve the problem, configure OSPF local multicast topology (MT) to create a multicast routing table for multicast packet forwarding.
Implementation
Multicast and an MPLS TE tunnel are deployed on the network, and the TE tunnel is enabled with IGP Shortcut. As shown in Figure 1-1472, DeviceB is spanned by the TE tunnel and therefore does not create any multicast forwarding entry.
Because the TE tunnel is unidirectional, multicast data packets sent from the multicast source are directly sent to the routers spanned by the tunnel through physical interfaces. These routers, however, do not have multicast forwarding entries. As a result, the multicast data packets are discarded, and services are unavailable.
After local MT is enabled, if the outbound interface of the calculated route is an IGP Shortcut TE tunnel interface, the route management (RM) module creates a separate Multicast IGP (MIGP) routing table for the multicast protocol, calculates the actual physical outbound interface for the route, and then adds the route to the MIGP routing table. Multicast then uses routes in the MIGP routing table to forward packets.
In Figure 1-1472, after the messages requesting to join a multicast group reach DeviceA, they are forwarded to DeviceB through interface 1. In this manner, DeviceB can correctly create the multicast forwarding table.
BFD for OSPF
Definition
Bidirectional Forwarding Detection (BFD) is a mechanism to detect communication faults between forwarding engines.
To be specific, BFD detects the connectivity of a data protocol along 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, which speeds up OSPF's response to network topology changes.
Purpose
A link fault or a topology change causes routers to recalculate routes. Routing protocol convergence must be as quick as possible to improve network availability. Link faults are inevitable, and therefore a solution must be provided to quickly detect faults and notify routing protocols.
BFD for Open Shortest Path First (OSPF) associates BFD sessions with OSPF. After BFD for OSPF is configured, BFD quickly detects link faults and notifies OSPF of the faults. BFD for OSPF accelerates OSPF response to network topology changes.
Table 1-604 describes OSPF convergence speeds before and after BFD for OSPF is configured.
Principles
Figure 1-1473 shows a typical network topology with BFD for OSPF configured. The principles of BFD for OSPF are described as follows:
OSPF neighbor relationships are established between these three routers.
After a neighbor relationship becomes Full, a BFD session is established.
The outbound interface on Device A connected to Device B is interface 1. If the link between Device A and Device B fails, BFD detects the fault and then notifies Device A of the fault.
Device A processes the event that a neighbor relationship goes Down and recalculates routes. The new route passes through Device C and reaches Device A, with interface 2 as the outbound interface.
OSPF GTSM
Definition
Generalized TTL security mechanism (GTSM) is a mechanism that protects services over the IP layer by checking whether the TTL value in an IP packet header is within a pre-defined range.
Purpose
On networks, attackers may simulate OSPF packets and keep sending them to a device. After receiving these packets, the device directly sends them to the control plane for processing without checking their validity if the packets are destined for the device. As a result, the control plane is busy processing these packets, resulting in high CPU usage.
GTSM is used to protect the TCP/IP-based control plane against CPU-utilization attacks, such as CPU-overload attacks.
Principles
GTSM-enabled devices check the TTL value in each received packet based on a configured policy. The packets that fail to pass the policy are discarded or sent to the control plane, which prevents the devices from possible CPU-utilization attacks. A GTSM policy involves the following items:
Source address of the IP packet sent to the device
VPN instance to which the packet belongs
Protocol number of the IP packet (89 for OSPF)
Source port number and destination port number of protocols above TCP/UDP
Valid TTL range
GTSM is implemented as follows:
For directly connected OSPF neighbors, the TTL value of the unicast protocol packets to be sent is set to 255.
For multi-hop neighbors, a reasonable TTL range is defined.
The applicability of GTSM is as follows:
GTSM takes effect on unicast packets rather than multicast packets. This is because the TTL value of multicast packets can only be 255, and therefore GTSM is not needed to protect against multicast packets.
GTSM does not support tunnel-based neighbors.
OSPF Smart-discover
Definition
Hello packets are periodically sent on OSPF interfaces of routers. By exchanging Hello packets, the routers establish and maintain the neighbor relationship, and elect the DR and the Backup Designated Router (BDR) on the multiple-access network (broadcast or NBMA network). OSPF uses a Hello timer to control the interval at which Hello packets are sent. A router can send Hello packets again only after the Hello timer expires. Neighbors keep waiting to receive Hello packets until the Hello timer expires. This process delays the establishment of OSPF neighbor relationships or election of the DR and the BDR.
Enabling Smart-discover can solve the preceding problem.
With or Without Smart-discover |
Processing |
---|---|
Without Smart-discover |
|
With Smart-discover |
|
Principles
In the following situations, Smart-discover-enabled interfaces can send Hello packets to neighbors regardless of whether the Hello timer expires:
On broadcast or NBMA networks, neighbor relationships can be established and a DR and a BDR can be elected rapidly.
The neighbor status becomes 2-way for the first time or returns to Init from 2-way or a higher state.
The interface status of the DR or BDR on a multiple-access network changes.
- On P2P or P2MP networks, neighbor relationships can be established rapidly. The establishment of neighbor relationships on a P2P or P2MP network is the same as that on a broadcast or NBMA network.
OSPF-BGP Synchronization
Background
When a new device is deployed on a network or a device is restarted, network traffic may be lost during BGP route convergence because IGP routes converge more quickly than BGP routes.
OSPF-BGP synchronization can address this problem.
Purpose
If a backup link exists, BGP traffic may be lost during traffic switchback because BGP routes converge more slowly than OSPF routes do.
In Figure 1-1474, Device A, Device B, Device C, and Device D run OSPF and establish IBGP connections. Device C functions as the backup of Device B. When the network is stable, BGP and OSPF routes converge completely on the router.
In most cases, traffic from Device A to 10.3.1.0/30 passes through Device B. If Device B fails, traffic is switched to Device C. After Device B recovers, traffic is switched back to Device B. During this process, packet loss occurs.
Consequently, convergence of OSPF routes is complete whereas BGP route convergence is still going on. As a result, Device B does not have the route to 10.3.1.0/30.
When packets from Device A to 10.3.1.0/30 reach Device B, Device B discards them because Device B does not have the route to 10.3.1.0/30.
Principles
If OSPF-BGP synchronization is configured on a device, the device remains as a stub router during the set synchronization period. During this period, the link metric in the LSA advertised by the device is set to the maximum value (65535), instructing other OSPF routers not to use it as a transit router for data forwarding.
In Figure 1-1474, OSPF-BGP synchronization is enabled on Router B. In this situation, before BGP route convergence is complete, Device A keeps forwarding data through Device C rather than Device B until BGP route convergence on Device B is complete.
LDP-IGP Synchronization
Background
LDP-IGP synchronization is used to synchronize the status between LDP and an IGP to minimize the traffic loss time if a network fault triggers the LDP and IGP switching.
On a network with active and standby links, if the active link fails, IGP routes and an LSP are switched to the standby link. After the active link recovers, IGP routes are switched back to the active link before LDP convergence is complete. In this case, the LSP along the active link takes time to make preparations, such as adjacency restoration, before being established. As a result, LSP traffic is discarded. If an LDP session or adjacency between nodes fails on the active link, the LSP along the active link is deleted. However, the IGP still uses the active link, and as a result, LSP traffic cannot be switched to the standby link, and is continuously discarded.
LDP-IGP synchronization supports OSPFv2 and IS-IS (IPv4).
On a network enabled with LDP-IGP synchronization, an IGP keeps advertising the maximum cost of an IGP route over the new active link to delay IGP route convergence until LDP converges. That is, before the LSP of the active link is established, the LSP of the standby link is retained so that the traffic continues to be forwarded through the standby link. The standby LSP is torn down only after the active LSP is established successfully.
LDP-IGP synchronization involves the following timers:
Hold-max-cost timer
Delay timer
Implementation
- The network shown in Figure 1-1475 has active and standby links. When the active link recovers from a fault, traffic is switched from the standby link back to the active link. During the traffic switchback, the standby LSP cannot be used, and a new LSP cannot be set up over the active link once IGP route convergence is complete. This causes a traffic interruption for a short period of time. To prevent this problem, LDP-IGP synchronization can be configured to delay IGP route switchback until LDP convergence is complete. Before convergence of the active LSP completes, the standby LSP is retained, so that the traffic continues to be forwarded through the standby LSP until the active LSP is successfully established. Then the standby LSP is torn down. The detailed process is as follows:
The link fault is rectified.
An LDP session is set up between LSR2 and LSR3. The IGP advertises the maximum cost of the active link to delay the IGP route switchback.
Traffic is still forwarded along the standby LSP.
The LDP session is set up. Label messages are exchanged to notify the IGP to start synchronization.
The IGP advertises the normal cost of the active link, and its routes converge to the original forwarding path. The LSP is reestablished and entries are delivered to the forwarding table (within milliseconds).
- If an LDP session between nodes fails on the active link, the LSP along the active link is deleted. However, the IGP still uses the active link, and as a result, LSP traffic cannot be switched to the standby link, and is continuously discarded. To prevent this problem, you can configure LDP-IGP synchronization. If an LDP session fails, LDP notifies an IGP of the failure. The IGP advertises the maximum cost of the failed link, which enables the route to switch from the active link to the standby link. In addition to the LSP switchover from the primary LSP to the backup LSP, LDP-IGP synchronization is implemented. The process of LDP-IGP synchronization is as follows:
An LDP session between two nodes on the active link fails.
LDP notifies the IGP of the failure in the session over the active link. The IGP then advertises the maximum cost along the active link.
The IGP route switches to the standby link.
An LSP is set up over the standby link, and then forwarding entries are delivered.
LDP-IGP synchronization state transition mechanism
After LDP-IGP synchronization is enabled on an interface, the IGP queries the status of the interface and LDP session according to the process shown in Figure 1-1476, enters the corresponding state according to the query result, and then transits the state according to Figure 1-1476.The preceding states may slightly vary between different IGPs.- When OSPF is used as the IGP, the state transition is the same as that in Figure 1-1476.
- When IS-IS is used as the IGP, the Hold-normal-cost state does not exist. After the Hold-max-cost timer expires, IS-IS advertises the normal link cost, but the Hold-max-cost state is displayed even though this state is nonexistent.
Usage Scenario
LDP-IGP synchronization applies to the following scenario:
Benefits
Packet loss is reduced during an active/standby link switchover, improving network reliability.
OSPF Fast Convergence
OSPF fast convergence is an extended feature of OSPF to speed up the convergence of routes. It includes the following components:
Partial Route Calculation (PRC): calculates only those routes which have changed when the network topology changes.
An OSPF intelligent timer: can dynamically adjust its value based on the user's configuration and the interval at which an event is triggered, such as the route calculation interval, which ensures rapid and stable network operation.
OSPF intelligent timer uses the exponential backoff technology so that the value of the timer can reach the millisecond level.
PRC
When a node in a network topology changes, the Dijkstra algorithm needs to recalculate all routes on the network. This calculation takes a long time and consumes a large number of CPU resources, which affects the convergence speed on the entire network. However, PRC uses only the nodes that have changed to recalculate routes, thereby decreasing CPU usage.
- If the SPT changes, PRC calculates all the leaves only on the changed node.
- If the SPT remains unchanged, PRC calculates only the changed leaves.
For example, if a new route is imported, the SPT of the entire network remains unchanged. In this case, PRC updates only the interface route for this node, thereby reducing the CPU usage.
OSPF Intelligent Timer
On an unstable network, routes are calculated frequently, which consumes a great number of CPU resources. In addition, link-state advertisements (LSAs) that describe the unstable topology are generated and transmitted on the unstable network. Frequently processing such LSAs affects the rapid and stable operation of the entire network.
To speed up route convergence on the entire network, the OSPF intelligent timer controls route calculation, LSA generation, and LSA receiving.
The OSPF intelligent timer works as follows:
On a network where routes are calculated repeatedly, the OSPF intelligent timer dynamically adjusts the route calculation based on user's configuration and the exponential backoff technology. The number of route calculation times and the CPU resource consumption are decreased. Routes are calculated after the network topology stabilizes.
On an unstable network, if a router generates or receives LSAs due to frequent topology changes, the OSPF intelligent timer can dynamically adjust the interval. No LSAs are generated or processed within an interval, which prevents invalid LSAs from being generated and advertised on the entire network.
OSPF Neighbor Relationship Flapping Suppression
OSPF neighbor relationship flapping suppression works by delaying OSPF neighbor relationship reestablishment or setting the link cost to the maximum value (65535).
Background
If an interface carrying OSPF services alternates between Up and Down, OSPF neighbor relationship flapping occurs on the interface. During the flapping, OSPF frequently sends Hello packets to reestablish the neighbor relationship, synchronizes LSDBs, and recalculates routes. In this process, a large number of packets are exchanged, adversely affecting neighbor relationship stability, OSPF services, and other OSPF-dependent services, such as LDP and BGP. OSPF neighbor relationship flapping suppression can address this problem by delaying OSPF neighbor relationship reestablishment or preventing service traffic from passing through flapping links.
Related Concepts
Flapping-event: reported when the status of a neighbor relationship on an interface last changes from Full to a non-Full state. The flapping-event triggers flapping detection.
Flapping-count: number of times flapping has occurred.
Detecting-interval: detection interval. The interval is used to determine whether to trigger a valid flapping_event.
Threshold: flapping suppression threshold. When the flapping_count reaches or exceeds threshold, flapping suppression takes effect.
Resume-interval: interval for exiting from OSPF neighbor relationship flapping suppression. If the interval between two successive valid flapping_events is longer than resume-interval, the flapping_count is reset.
Implementation
Flapping detection
Each OSPF interface on which OSPF neighbor relationship flapping suppression is enabled starts a flapping counter. If the interval between two successive neighbor status changes from Full to a non-Full state is shorter than detecting-interval, a valid flapping_event is recorded, and the flapping_count increases by 1. When the flapping_count reaches or exceeds threshold, flapping suppression takes effect. If the interval between two successive neighbor status changes from Full to a non-Full state is longer than resume-interval, the flapping_count is reset.
The detecting-interval, threshold, and resume-interval are configurable.
The value of resume-interval must be greater than that of detecting-interval.
Flapping suppression
Flapping suppression works in either Hold-down or Hold-max-cost mode.
- Hold-down mode: In the case of frequent flooding and topology changes during neighbor relationship establishment, interfaces prevent neighbor relationship reestablishment during Hold-down suppression, which minimizes LSDB synchronization attempts and packet exchanges.
- Hold-max-cost mode: If the traffic forwarding path changes frequently, interfaces use 65535 as the cost of the flapping link during Hold-max-cost suppression, which prevents traffic from passing through the flapping link.
Flapping suppression can also work first in Hold-down mode and then in Hold-max-cost mode.
By default, the Hold-max-cost mode takes effect. The mode and suppression duration can be changed manually.
If an attack causes frequent neighbor relationship flapping, Hold-down mode can minimize the impact of the attack.
When an interface enters the flapping suppression state, all neighbor relationships on the interface enter the state accordingly.
Exiting from flapping suppression
Interfaces exit from flapping suppression in the following scenarios:
- The suppression timer expires.
- The corresponding OSPF process is reset.
- An OSPF neighbor is reset.
- A command is run to exit from flapping suppression.
Typical Scenarios
Basic scenario
In Figure 1-1478, the traffic forwarding path is Device A -> Device B -> Device C -> Device E before a link failure occurs. After the link between Device B and Device C fails, the forwarding path switches to Device A -> Device B -> Device D -> Device E. If the neighbor relationship between Device B and Device C frequently flaps at the early stage of the path switchover, the forwarding path will be switched frequently, causing traffic loss and affecting network stability. If the neighbor relationship flapping meets suppression conditions, flapping suppression takes effect.
- If flapping suppression works in Hold-down mode, the neighbor relationship between Device B and Device C is prevented from being reestablished during the suppression period, in which traffic is forwarded along the path Device A -> Device B -> Device D -> Device E.
- If flapping suppression works in Hold-max-cost mode, 65535 is used as the cost of the link between Device B and Device C during the suppression period, and traffic is forwarded along the path Device A -> Device B -> Device D -> Device E.
Single-forwarding path scenario
When only one forwarding path exists on the network, the flapping of the neighbor relationship between any two devices on the path will interrupt traffic forwarding. In Figure 1-1479, the traffic forwarding path is Device A -> Device B -> Device C -> Device E. If the neighbor relationship between Device B and Device C flaps, and the flapping meets suppression conditions, flapping suppression takes effect. However, if the neighbor relationship between Device B and Device C is prevented from being reestablished, the whole network will be divided. Therefore, Hold-max-cost mode (rather than Hold-down mode) is recommended. If flapping suppression works in Hold-max-cost mode, 65535 is used as the cost of the link between Device B and Device C during the suppression period. After the network stabilizes and the suppression timer expires, the link is restored.
By default, the Hold-max-cost mode takes effect.
Broadcast scenario
In Figure 1-1480, four devices are deployed on the same broadcast network using switches, and the devices are broadcast network neighbors. If Device C flaps due to a link failure, and Device A and Device B were deployed at different time (Device A was deployed earlier for example) or the flapping suppression parameters on Device A and Device B are different, Device A first detects the flapping and suppresses Device C. Consequently, the Hello packets sent by Device A do not carry Device C's router ID. However, Device B has not detected the flapping yet and still considers Device C a valid node. As a result, the DR candidates identified by Device A are Device B and Device D, whereas the DR candidates identified by Device B are Device A, Device C, and Device 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 Device C flaps, Device A, Device B, and Device D on the broadcast network are all suppressed. After the network stabilizes and the suppression timer expires, Device A, Device B, and Device D are restored to normal status.
Multi-area scenario
In Figure 1-1481, Device A, Device B, Device C, Device E, and Device F are connected in area 1, and Device B, Device D, and Device E are connected in backbone area 0. Traffic from Device A to Device F is preferentially forwarded along an intra-area route, and the forwarding path is Device A -> Device B -> Device C -> Device E -> Device F. When the neighbor relationship between Device B and Device 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 Device B and Device 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 Device B and Device C from being reestablished during the suppression period. During this period, traffic is forwarded along the path Device A -> Device B -> Device D -> Device E -> Device F.
By default, the Hold-max-cost mode takes effect. The mode can be changed to Hold-down manually.
Scenario with both LDP-IGP synchronization and OSPF neighbor relationship flapping suppression configured
In Figure 1-1482, 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 1-606 lists the suppression modes that take effect in different situations.
LDP-IGP Synchronization/OSPF Neighbor Relationship Flapping Suppression Mode |
LDP-IGP Synchronization Hold-down Mode |
LDP-IGP Synchronization Hold-max-cost Mode |
Exited from LDP-IGP Synchronization Suppression |
---|---|---|---|
OSPF Neighbor Relationship Flapping Suppression Hold-down Mode |
Hold-down |
Hold-down |
Hold-down |
OSPF Neighbor Relationship Flapping Suppression Hold-max-cost Mode |
Hold-down |
Hold-max-cost |
Hold-max-cost |
Exited from OSPF Neighbor Relationship Flapping Suppression |
Hold-down |
Hold-max-cost |
Exited from LDP-IGP synchronization and OSPF neighbor relationship flapping suppression |
For example, the link between PE1 and P1 frequently flaps in Figure 1-1482, 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.
Scenario with both bit-error-triggered protection switching and OSPF neighbor relationship flapping suppression configured
If a link has poor link quality, services transmitted along it may be adversely affected. If bit-error-triggered protection switching is configured and the bit error rate (BER) along a link exceeds a specified value, a bit error event is reported, and 65535 is used as the cost of the link, triggering route reselection. Consequently, service traffic is switched to the backup link. If both bit-error-triggered protection switching and OSPF neighbor relationship flapping suppression are configured, they both take effect. Hold-down mode takes precedence over Hold-max-cost mode, followed by the configured link cost.
OSPF Flush Source Tracing
Context
If network-wide OSPF LSA flush causes network instability, source tracing must be implemented as soon as possible to locate and isolate the fault source. However, OSPF itself does not support source tracing. A conventional solution is to isolate nodes one by one until the fault source is located, but the process is complex and time-consuming and may compromise network services. To solve the preceding problem, OSPF introduces a proprietary protocol, namely, the source tracing protocol. This protocol supports the flooding of flush source information. When the preceding problem occurs, you can quickly query the flush source information on any device on the network to quickly locate the fault source.
Related Concepts
Source tracing
- Uses a new UDP port. Source tracing packets are carried by UDP packets, and the UDP packets also carry the OSPF LSAs flushed by the current device and are flooded hop by hop based on the OSPF topology.
- Depends on OSPF neighbors for flooding and forwards packets along UDP channels, which are independent of the channels used to transmit OSPF packets. Therefore, this protocol facilitates incremental deployment. In addition, source tracing does not affect the devices with the related UDP port disabled.
Supports query of the node that flushed LSAs on any of the devices after source tracing packets are flooded on the network, which speeds up fault locating and faulty node isolation.
Flush
Network-wide OSPF LSAs are deleted.
PS-Hello packets
Packets used to negotiate the OSPF flush source tracing capability between OSPF neighbors.
PS-LSA
When a device flushes an OSPF LSA, it generates a PS-LSA carrying information about the device and brief information about the OSPF LSA.
PS-LSU packets
OSPF flush LSA source tracing packets that carry PS-LSAs.
PS-LSU ACK packets
Acknowledgment packets used to improve OSPF flush source tracing packets.
OSPF flush source tracing port
ID of the UDP port that receives and sends OSPF flush source tracing packets. The default port ID is 50133, which is configurable.
Fundamentals
Source tracing capability negotiation
After an OSPF neighbor relationship is established between two devices, they need to negotiate the source tracing capability through PS-Hello packets.
PS-LSA generation and flooding
When a device flushes an OSPF LSA, it generates a PS-LSA carrying information about the device and brief information about the OSPF LSA, adds the PS-LSA to a PS-LSU packet, and floods the PS-LSU packet to source tracing-capable neighbors, which helps other devices locate the fault source and perform isolation.
Only router-LSAs, network-LSAs, and inter-area-router-LSAs can be flushed. Therefore, a device generates a PS-LSA only when it flushes a router-LSA, network-LSA, or inter-area-router-LSA.
Source tracing capability negotiation
The source tracing protocol uses UDP to carry source tracing packets and listens to the UDP port, which is used to receive and send source tracing packets. If a source tracing-capable Huawei device sends source tracing packets to a source tracing-incapable Huawei device or non-Huawei device, the source tracing-capable Huawei device may be incorrectly identified as an attacker. Therefore, the source tracing capability needs to be negotiated between the devices. In addition, the source tracing-capable device needs to send source tracing information on behalf of the source tracing-incapable device, which also requires negotiation.
Source tracing capability negotiation depends on OSPF neighbor relationships. Specifically, after an OSPF neighbor relationship is established, the local device initiates source tracing capability negotiation. Figure 1-1483 shows the negotiation process.
Whether Source Tracing Is Supported |
Source Tracing Capability Negotiation Process |
---|---|
Devices A and B both support source tracing. |
|
DeviceA supports source tracing, but DeviceB does not. |
|
Devices A and B both support source tracing, but source tracing is disabled from DeviceB. |
|
DeviceA does not support source tracing, and source tracing is disabled from DeviceB. |
|
PS-LSA generation and flooding
If a device flushes an LSA, it generates and floods a PS-LSA to source tracing-capable neighbors.
If a device receives a flush LSA from a source tracing-incapable neighbor, the device generates and floods a PS-LSA to source tracing-capable neighbors. If a device receives the same flush LSA (with the same LSID and sequence number) from more than one source tracing-incapable neighbor, the device generates only one PS-LSA.
If a device flushes a router-LSA, network-LSA, or inter-area-router-LSA, it generates a PS-LSA, adds the PS-LSA to a PS-LSU packet, and floods the PS-LSU packet to all source tracing-capable neighbors.
PS-LSA generation rules
- When DeviceA flushes a router-LSA, network-LSA, or inter-area-router-LSA, it generates a PS-LSA in which the Flush Router field is its router ID and the Neighbor Router field is 0, and adds the PS-LSA to the queue where packets are to be sent to all source tracing-capable neighbors.
- After DeviceA receives the flush LSA from source tracing-incapable DeviceB, DeviceA generates a PS-LSA in which the Flush Router field is its router ID and the Neighbor Router field is the router ID of DeviceB, and adds the PS-LSA to the queue where packets are to be sent to all source tracing-capable neighbors.
- After DeviceA receives the flush LSA from DeviceB, followed by the same flush LSA sent by DeviceC, DeviceA generates a PS-LSA in which the Flush Router field is its router ID and the Neighbor Router field is the router ID of DeviceB, and adds the PS-LSA to the queue where packets are to be sent to all source tracing-capable neighbors. No PS-LSA is generated in response to the flush LSA received from DeviceC.
PS-LSU packet sending rules
- During neighbor relationship establishment, a device initializes the sequence number of the PS-LSU packet of the neighbor. When the device replies with a PS-LSU packet, it adds the sequence number of the PS-LSU packet of the neighbor. During PS-LSU packet retransmission, the sequence number remains unchanged. After the device receives a PS-LSU ACK packet with the same sequence number, it increases the sequence number of the neighbor's PS-LSU packet by 1.
- The neighbor manages the PS-LSA sending queue. When a PS-LSA is added to the queue which was empty, the neighbor starts a timer. After the timer expires, the neighbor adds the PS-LSA to a PS-LSU packet, sends the packet to its neighbor, and starts another timer to wait for a PS-LSU ACK packet.
- After the PS-LSU ACK timer expires, the PS-LSU packet is retransmitted.
- When the device receives a PS-LSU ACK packet with a sequence number same as that in the neighbor record, the device clears PS-LSAs from the neighbor queue, and sends another PS-LSU packet after the timer expires.
- If the sequence number of a received PS-LSU ACK packet is less than that in the neighbor record, the device ignores the packet.
- If the sequence number of a received PS-LSU ACK packet is greater than that in the neighbor record, the device discards the packet.
PS-LSU packet sending is independent among neighbors.
PS-LSU packet receiving rules
- When a device receives a PS-LSU packet from a neighbor, the neighbor records the sequence number of the packet and replies with a PS-LSU ACK packet.
- When the device receives a PS-LSU packet with the sequence number the same as that in the neighbor record, the device discards the PS-LSU packet.
- After the device parses a PS-LSU packet, it adds the PS-LSA in the packet to its LSDB. The device also checks whether the PS-LSA is newer than the corresponding PS-LSA in its LSDB.
- If the received PS-LSA is newer, the device floods it to other neighbors.
- If the received PS-LSA is the same as the corresponding local one, the device does not process the received PS-LSA.
- If the received PS-LSA is older, the device floods the corresponding local one to the neighbor.
- If the device receives a PS-LSU packet from a neighbor and the neighbor does not support source tracing, the device modifies the neighbor status as source tracing capable.
Source Tracing Security
The source tracing protocol uses a UDP port to receive and send source tracing packets. Therefore, the security of the port must be taken into consideration.
The source tracing protocol inevitably increases packet receiving and sending workload and intensifies bandwidth pressure. To minimize its impact on other protocols, the number of source tracing packets must be controlled.
The following security measures are available:
Security Measures for Source Tracing |
Fundamentals |
---|---|
Authentication |
Source tracing is embedded in OSPF, inherits existing OSPF configuration parameters, and uses OSPF authentication parameters to authenticate packets. |
GTSM |
GTSM is a security mechanism that checks whether the time to live (TTL) value in each received IP packet header is within a pre-defined range. Source tracing packets can only be flooded as far as one hop. Therefore, GTSM can be used to check such packets by default.
|
CPU-CAR |
Interface boards can check the packets to be sent to the CPU for processing and prevent the main control board from being overloaded by a large number of packets that are sent to the CPU. The source tracing protocol needs to apply for an independent CAR channel and has small CAR values configured. |
Typical Scenarios
Scenario where all nodes support source tracing
All nodes on the network support source tracing, and DeviceA is the faulty source. Figure 1-1485 shows the networking.
When DeviceA flushes an OSPF LSA, it generates a PS-LSA that carries DeviceA information and brief information about the flush LSA and floods it. After the fault occurs, maintenance personnel can log in to any node on the network to locate DeviceA, which keeps sending flush LSAs, and isolate DeviceA from the network.
Scenario where source tracing-incapable nodes are not isolated from source tracing-capable nodes
All nodes on the network except DeviceC support source tracing, and DeviceA is the fault source. In this case, the PS-LSA can be flooded on the entire network, and the fault source can be accurately located. Figure 1-1486 shows the networking.
When DeviceA flushes an OSPF LSA, it generates a PS-LSA that carries DeviceA information and brief information about the flush LSA and floods it. When DeviceB and DeviceE negotiate the source tracing capability with DeviceC, they find that DeviceC does not support source tracing. Therefore, after DeviceB receives the PS-LSA from DeviceA, DeviceB sends the PS-LSA to DeviceD, but not to DeviceC. After receiving the flush LSA from DeviceC, DeviceE generates a PS-LSA that carries information about the advertisement source (DeviceE), flush source (DeviceC), and the OSPF flush LSA, and floods the PS-LSA on the network.
After the fault occurs, maintenance personnel can log in to any device on the network except DeviceC to locate the faulty node. Two possible faulty nodes can be located in this case: DeviceA and DeviceC, and they both send the same flush LSA. In this case, DeviceA takes precedence over DeviceC when the maintenance personnel determine the most possible faulty source. After DeviceA is isolated, the network recovers.
Scenario where source tracing-incapable nodes are isolated from source tracing-capable nodes
All nodes on the network except DeviceC and DeviceD support source tracing, and DeviceA is the fault source. In this case, the PS-LSA cannot be flooded on the entire network. Figure 1-1487 shows the networking.
When DeviceA flushes an OSPF LSA, it generates a PS-LSA that carries DeviceA information and brief information about the flush LSA and floods it. However, the PS-LSA sent by DeviceA can reach only DeviceB because DeviceC and DeviceD do not support source tracing.
During source tracing capability negotiation, DeviceE finds that DeviceC does not support source tracing, and DeviceF finds that DeviceD does not support source tracing. After DeviceE receives the flush LSA from DeviceC, DeviceE generates and floods a PS-LSA on behalf of DeviceC. Similarly, after DeviceF receives the flush LSA from DeviceD, DeviceF generates and floods a PS-LSA on behalf of DeviceD.
- If maintenance personnel log in to DeviceA or DeviceB, the personnel can locate the fault source (DeviceA) directly. After DeviceA is isolated, the network recovers.
- If the maintenance personnel log in to DeviceE, DeviceF, DeviceG, or DeviceH, the personnel will find that DeviceE claims DeviceC to be the fault source of the OSPF flush LSA and DeviceF claims DeviceD to be the fault source of the same OSPF flush LSA.
- If the maintenance personnel log in to DeviceC and DeviceD, the personnel will find that the flush LSA was initiated by DeviceB, not generated by DeviceC or DeviceD.
- If the maintenance personnel log in to DeviceB, the personnel will find that DeviceA is the faulty device, and isolate DeviceA. After DeviceA is isolated, the network recovers.
OSPF Multi-Area Adjacency
Background
In OSPF, intra-area links take precedence over inter-area links during route selection even when the inter-area links are shorter than the intra-area links. Each OSPF interface belongs to only one area. As a result, even when a high-speed link exists in an area, traffic of another area cannot be forwarded along the link. A common method used to solve this problem is to configure multiple sub-interfaces and add them to different areas. However, this method has a defect that an independent IP address needs to be configured for each sub-interface and then is advertised, which increases the total number of routes. In this situation, OSPF multi-area adjacency is introduced.
OSPF multi-area adjacency allows an OSPF interface to be multiplexed by multiple areas so that a link can be shared by the areas.
In Figure 1-1488, the link between Device A and Device B in area 1 is a high-speed link.
In Figure 1-1488 a, OSPF multi-area adjacency is disabled on Device A and Device B, and traffic from Device A to Device B in area 2 is forwarded along the low-speed link of Device A -> Device C -> Device D -> Device B.
In Figure 1-1488 b, OSPF multi-area adjacency is enabled on Device A and Device B, and their multi-area adjacency interfaces belong to area 2. In this case, traffic from Device A to Device B in area 2 is forwarded along the high-speed link of Device A -> Device B.
- Allows interface multiplexing, which reduces OSPF interface resource usage in multi-area scenarios.
- Allows link multiplexing, which prevents a traffic detour to low-speed links and optimizes the OSPF network.
Related Concepts
Multi-area adjacency interface: indicates the OSPF logical interface created when OSPF multi-area adjacency is enabled on an OSPF-capable interface (main OSPF interface). The multi-area adjacency interface is also referred to as a secondary OSPF interface. The multi-area adjacency interface has the following characteristics:
- The multi-area adjacency interface and the main OSPF interface belong to different OSPF areas.
- The network type of the multi-area adjacency interface must be P2P. The multi-area adjacency interface runs an independent interface state machine and neighbor state machine.
- The multi-area adjacency interface and the main OSPF interface share the same interface index and packet transmission channel. Whether the multi-area adjacency interface or the main OSPF interface is selected to forward an OSPF packet is determined by the area ID carried in the packet header and related configuration.
If the interface is P2P, its multi-area adjacency interface sends packets through multicast.
If the interface is not P2P, its multi-area adjacency interface sends packets through unicast.
Principles
In Figure 1-1489, the link between Device A and Device B in area 1 is a high-speed link. In area 2, traffic from Device A to Device B is forwarded along the low-speed link of Device A -> Device C -> Device D -> Device B. If you want the traffic from Device A to Device B in area 2 to be forwarded along the high-speed link of Device A -> Device B, deploy OSPF multi-area adjacency.
- An OSPF adjacency is established between Device A and Device B. For details about the establishment process, see Adjacency Establishment.
- Route calculation is implemented. For details about the calculation process, see Route Calculation.
The optimal path in area 2 obtained by OSPF through calculation is the high-speed link of Device A -> Device B. In this case, the high-speed link is shared by area 1 and area 2.
OSPF NSR
Non-Stop Routing (NSR) is a routing technique that prevents neighboring routers from detecting faults on the control plane of a device with a backup control plane. With NSR, when the control plane of the device fails, the neighbor relationship set up through specific routing protocols, MPLS, and other protocols that carry services is uninterrupted.
As networks develop and expand, carriers place increasingly higher requirements on the reliability of IP networks. NSR was introduced as a high availability (HA) solution to ensure that services transmitted by a device were unaffected by hardware or software failures on the device.
OSPF NSR synchronizes the protocol data on the master main control board to the slave main control board in real time. When the master main control board fails or needs to be upgraded, the slave main control board immediately takes over services from the master main control board, and the neighbor remains unaware the fault occurred. Real-time data synchronization between the master and slave main control boards through OSPF NSR is implemented as follows:
- OSPF backs up configuration data and dynamic data, including information about interfaces, neighbors, and LSDBs.
- OSPF does not back up routes, shortest path trees (SPTs), or Traffic Engineering Databases (TEDBs). Such information can be restored using the source data in the database backup process.
- When the master/slave main control board switchover occurs, the new master main control board restores the operations data and takes over services from the former master main control board. Throughout this process, the neighbor remains unaware of the fault.
OSPF IP FRR
OSPF IP fast reroute (FRR) refers to the process by which OSPF precomputes a backup path based on the network-wide LSDBs, and stores this backup path in the forwarding table. If the primary path fails, traffic can be quickly switched to the backup path.
Background
As networks develop, voice over IP (VoIP) and online video services pose higher requirements for real-time transmission. Nevertheless, if a primary link fails, OSPF-enabled devices need to perform multiple operations, including detecting the fault, updating the link-state advertisement (LSA), flooding the LSA, calculating routes, and delivering forward information base (FIB) entries before switching traffic to a new link. This process takes a much longer time, the minimum delay to which users are sensitive. As a result, the requirements for real-time transmission cannot be met. OSPF IP FRR can solve this problem. OSPF IP FRR conforms to dynamic IP FRR defined by standard protocols. With OSPF IP FRR, devices can switch traffic from a faulty primary link to a backup link, protecting against a link or node failure.
Major FRR techniques include loop-free alternate (LFA), U-turn, Not-Via, Remote LFA, and MRT, among which OSPF supports only LFA and Remote LFA.
Related Concepts
OSPF IP FRR
OSPF IP FRR refers to a mechanism in which a device uses the loop-free alternate (LFA) algorithm to compute the next hop of a backup link and stores the next hop together with the primary link in the forwarding table. If the primary link fails, the device switches the traffic to the backup link before routes are converged on the control plane. This mechanism keeps the traffic interruption duration and minimizes the impacts.
OSPF IP FRR policy
An OSPF IP FRR policy can be configured to filter alternate next hops. Only the alternate next hops that match the filtering rules of the policy can be added to the IP routing table.
LFA algorithm
A device uses the shortest path first (SPF) algorithm to calculate the shortest path from each neighbor with a backup link to the destination node. The device then uses the inequalities defined in standard protocols and the LFA algorithm to calculate the next hop of the loop-free backup link that has the smallest cost of the available shortest paths.
Remote LFA
LFA FRR cannot be used to calculate alternate links on large-scale networks, especially on ring networks. Remote LFA FRR addresses this problem by calculating a PQ node and establishing a tunnel between the source node of a primary link and the PQ node. If the primary link fails, traffic can be automatically switched to the tunnel, which improves network reliability.
P space
Remote LFA uses the source end of a protection link as the root node and calculates an SPT to all the other nodes on the network (with the protection link calculated in the tree). Then Remote LFA removes all the nodes along the protection link from the SPT, and the set of the remaining nodes is called a P space.
Extended P space
Remote LFA uses neighbors of the source end of a protection link as root nodes and calculates separate SPTs (with the protection link calculated in the trees). Then Remote LFA removes all the nodes along the protection link from each SPT, and the set of the remaining nodes on the SPTs is called an extended P space.
Q space
Remote LFA uses the destination end of a protection link as the root node and calculates an SPT to all the other nodes on the network (with the protection link calculated in the tree). Then Remote LFA removes all the nodes along the protection link from the SPT, and the set of the remaining nodes is called a Q space.
PQ node
A PQ node exists both in the extended P space and Q space and is used by Remote LFA as the destination of a protection tunnel.
OSPF LFA FRR
OSPF LFA FRR protects traffic against either a link failure or a node-and-link failure. The node-and-link protection takes precedence over the link protection.
Link protection
Link protection takes effect when the traffic to be protected flows along a specified link.
In Figure 1-1490, traffic flows from Device S to Device D. The primary link is Device S->Device E->Device D, and the backup link is Device S->Device N->Device E->Device D. If link costs meet the inequality: Distance_opt(N, D) < Distance_opt(N, S) + Distance_opt(S, D) and OSPF IP FRR is enabled, Device S switches the traffic to the backup link if the primary link fails, reducing the traffic interruption duration.
Distance_opt(X, Y) indicates the shortest link from X to Y. S stands for a source node, E for the faulty node, N for a node along a backup link, and D for a destination node.
Node-and-link protection
Node-and-link protection takes effect when the traffic to be protected.
In Figure 1-1491, traffic flows from Device S to Device D. The primary link is Device S->Device E->Device D, and the backup link is Device S->Device N->Device D. The preceding inequalities are met. With OSPF IP FRR, Device S switches the traffic to the backup link if the primary link fails, reducing the traffic interruption duration.
Node-and-link protection takes effect when the following conditions are met:
- The link costs meet the inequality: Distance_opt(N, D) < Distance_opt(N, S) + Distance_opt(S, D).
- The interface costs meet the inequality: Distance_opt(N, D) < Distance_opt(N, E) + Distance_opt(E, D).
Distance_opt(X, Y) indicates the shortest link from X to Y. S stands for a source node, E for the faulty node, N for a node along a backup link, and D for a destination node.
OSPF Remote LFA FRR
Similar to OSPF LFA FRR, remote LFA is also classified as link protection or node-and-link protection. The following example shows how remote LFA works to protect against link failures:
In Figure 1-1492, traffic flows through PE1 -> P1 -> P2 -> PE2, and the primary link is between P1 and P2. Remote LFA calculates a PQ node (P4) and establishes an LDP between P1 and P4. If P1 detects a failure on the primary link, P1 encapsulates packets into MPLS packets and forwards MPLS packets to P4. After receiving the packets, P4 removes the MPLS label from them and searches the IP routing table for a next hop to forward the packets to PE2. Remote LFA ensures uninterrupted traffic forwarding.
Calculates an SPT with each of P1's neighbors (excluding the neighbor on the protection link) as the root. In this case, neighbors PE1 and P3 are used for calculation. For each SPT, an extended P space is composed of the root node and those reachable nodes that belong to the SPT but do not pass through the P1→P2 link. When PE1 is used as a root node for calculation, the extended P space {PE1, P1, P3} is obtained. When P3 is used as a root node for calculation, the extended P space {PE1, P1, P3, P4} is obtained. By combining these two extended P spaces, the final extended P space {PE1, P1, P3, P4} is obtained.
Calculates a reverse SPT with P2 as the root. The obtained Q space is {P2, PE2, P4}.
Selects the PQ node (P4) that exists both in the extended P space and Q space.
On a network with a large number of nodes, to ensure that RLFA/TI-LFA calculation can be completed as soon as possible, the elected P and Q nodes may not be optimal, but they comply with rules. This does not affect the protection effect.
OSPF microloop avoidance
In Figure 1-1492, OSPF remote LFA FRR is enabled, the primary link is PE1 -> P1 -> P2 -> PE2, and the backup link is PE1 -> P1 -> P3 -> P4 -> P2 -> PE2, and the link P1 -> P3 -> P4 is an LDP tunnel. If the primary link fails, traffic is switched to the backup link, and then another round of the new primary link calculation begins. Specifically, after P1 completes route convergence, its next hop becomes P3. However, the route convergence on P3 is slower than that on P1, and P3's next hop is still P1. As a result, a temporary loop occurs between P1 and P3. OSPF microloop avoidance can address this problem by delaying P1 from switching its next hop until the next hop of P3 becomes P4. Then traffic is switched to the new primary link (PE1 -> P1 -> P3 -> P4 -> P2 -> PE2), and on the link P1 -> P3 -> P4, traffic is forwarded based on IP routes.
OSPF microloop avoidance applies only to OSPF remote LFA FRR.
OSPF FRR in the Scenario Where Multiple Nodes Advertise the Same Route
The SPF algorithm is used by OSPF LFA FRR and OSPF Remote LFA FRR to calculate the shortest path from each neighbor (root node) that provides a backup link to the destination node. The calculation result is a node-based backup next hop. This applies to the scenarios where a route is advertised by a single node. As networks are increasingly diversified, two ABRs or ASBRs are deployed to improve network reliability. In this case, OSPF FRR in a scenario where multiple nodes advertise the same route is introduced.
In a scenario where multiple nodes advertise the same route, OSPF FRR is implemented by calculating the Type 3 LSAs advertised by ABRs of an area for intra-area, inter-area, ASE, or NSSA routes. Therefore, the OSPF FRR calculation methods are the same when multiple nodes advertise the same route. Inter-area routing is used as an example to describe how FRR in a multi-node routing scenario works.
In Figure 1-1493, Device B and Device C function as ABRs to forward routes between area 0 and area 1. Device E advertises an intra-area route. Upon receipt of the route, Device B and Device C translate it into a Type 3 LSA and flood the LSA to area 0. After OSPF FRR is enabled on Device A, Device A considers both Device B and Device C as its neighbors. Without a fixed neighbor as the root node, Device A fails to calculate the FRR backup next hop. To address this problem, a virtual node is simulated between Device B and Device C, converting the scenario where multiple nodes advertise the same route into the scenario where the route is received from only one node. Then the backup next hop of the virtual node is calculated based on LFA and Remote LFA. Then the route advertised by multiple nodes inherits the backup next hop from the virtual node.
For example, Device B and Device C advertise a route with prefix 10.1.1.0/24, and OSPF FRR is enabled on Device A. Device A cannot calculate a backup next hop for the route 10.1.1.0/24 because this route has two sources (Device B and Device C). To address this problem, a virtual node is simulated between Device B and Device C based on the two sources of the route 10.1.1.0/24. The virtual node forms a link with each of Device B and Device C. If the virtual node advertises a 10.1.1.0/24 route, it will use the smaller cost of the routes advertised by Device B and Device C as the cost of the route. If the cost of the route advertised by Device B is 5 and that of the route advertised by Device C is 10, the cost of the route advertised by the virtual node is 5. The cost of the link from Device B to the virtual node is 0, and that of the link from Device C to the virtual node is 5. The costs of the links from the virtual node to Device B and Device C are both 65535, the maximum value. Device A is configured to consider Device B and Device C as invalid sources of the 10.1.1.0/24 route and use the LFA or remote LFA algorithm to calculate the backup next hop for the route, with the virtual node as the root node.
In a scenario where multiple nodes advertise the same route, OSPF FRR can use the LFA or remote LFA algorithm. When OSPF FRR uses the remote LFA algorithm, PQ node selection has the following restrictions:
- An LDP tunnel will be established between a faulty node and a PQ node, and a virtual node in the scenario where multiple nodes advertise the same route cannot transmit traffic through LDP tunnels. As a result, the virtual node cannot be selected as a PQ node.
- The destination node of Remote LFA is not selected as a PQ node. After a virtual node is added in a scenario where multiple nodes advertise the same route, the destination node becomes a virtual node. Therefore, a node directly connected to the virtual node cannot be selected as a PQ node.
OSPF SRLG FRR
A shared risk link group (SRLG) is a set of links that share a common physical resource (such as a fiber). These links share the same risk level. If one of the links fails, all the other links in the SRLG may also fail.
On the network shown in Figure 1-1494, traffic is forwarded from Device A to Device E. There are three links between Device A and Device E: Link1, Link2, and Link3. The cost of Link1 is the smallest, and the costs of Link2 and Link3 are the same. Therefore, Link1 is the primary link for traffic forwarding.
- If link 1 fails but the backup link (link 2) is normal, traffic can be forwarded normally after being switched to the backup link.
- If both link 1 and link 2 fail, traffic is interrupted after being switched to the backup link.
OSPF SRLG FRR can be configured in the scenario where some links have the same risk of failure. If Link1 and Link2 have the same risk of failure, you can add them to an SRLG and configure OSPF SRLG FRR so that a link outside the SRLG is preferentially selected as a backup link, which reduces the possibility of service interruptions. After Link1 and Link2 are added to the same SRLG, OSPF LFA IP FRR selects Link3, which is not in the SRLG, as the backup link to provide protection for Link1. If both Link1 and Link2 fail, traffic can be switched to Link3 for normal transmission.
Derivative Functions
If you bind a Bidirectional Forwarding Detection (BFD) session with OSPF IP FRR, the BFD session goes down if BFD detects a link fault. If the BFD session goes down, OSPF IP FRR is triggered to switch traffic from the faulty link to the backup link, which minimizes the loss of traffic.
OSPF Authentication
OSPF authentication encrypts OSPF packets by adding the authentication field to packets to ensure network security. When a local device receives OSPF packets from a remote device, the local device discards the packets if the authentication passwords carried in these packets do not match the local one, which protects the local device from potential attacks.
In terms of the packet type, the authentication is classified as follows:
Area authentication
Area authentication is configured in the OSPF area view and applies to packets received by all interfaces in the OSPF area.
Interface authentication
Interface authentication is configured in the interface view and applies to all packets received by the interface.
In terms of packet the authentication modes, the authentication is classified as follows:
Non-authentication
Authentication is not required.
Simple authentication
The authenticated party directly adds the configured password to packets for authentication. This authentication mode provides the lowest password security.
MD5 authentication
The authenticated party encrypts the configured password using a Message Digest 5 (MD5) algorithm and adds the ciphertext password to packets for authentication. This authentication mode improves password security. The supported MD5 algorithms include MD5 and HMAC-MD5.
For the sake of security, using the HMAC-SHA256 algorithm rather than the MD5 algorithm is recommended.
Keychain authentication
A keychain consists of multiple authentication keys, each of which contains an ID and a password. Each key has the lifetime. Keychain dynamically selects the authentication key based on the lifetime. A keychain can dynamically select the authentication key to enhance attack defense.
Keychain dynamically changes algorithms and keys, which improves OSPF security.
HMAC-SHA256 authentication
A password is encrypted using the HMAC-SHA256 algorithm before it is added to the packet, which improves password security.
OSPF carries authentication types in packet headers and authentication information in packet tails.
The authentication types include:
0: non-authentication
1: simple authentication
2: Ciphertext authentication
Usage Scenario
The configuration requirements are as follows:
The interface authentication configurations must be the same on all devices on the same network so that OSPF neighbor relationships can be established.
The area authentication configurations must be the same on all devices in the same area.
OSPF Packet Format
The OSPF protocol number is 89. OSPF packets are encapsulated into IP packets. OSPF packets are classified into five types of packets: Hello packets, DD packets, LSR packets, LSU packets, and LSAck packets.
Packet Header Format
The five types of OSPF packets have the same packet header format. The length of an OSPF packet header is 24 bytes. Figure 1-1496 shows an OSPF packet header.
Field |
Length |
Description |
---|---|---|
Version |
8 bits |
OSPF version number. For OSPFv2, the value is 2. |
Type |
8 bits |
OSPF packet type. The values are as follows:
|
Packet length |
16 bits |
Length of the OSPF packet with the packet header, in bytes. |
Router ID |
32 bits |
ID of the router that sends the OSPF packet. |
Area ID |
32 bits |
ID of the area to which the router that sends the OSPF packet belongs. |
Checksum |
16 bits |
Checksum of the OSPF packet that does not carry the Authentication field. |
AuType |
16 bits |
Authentication type. The values are as follows:
|
Authentication |
64 bits |
This field has different meanings for different AuType values:
|
MD5 authentication data is added to an OSPF packet and is not included in the Authentication field.
Hello Packet
Hello packets are commonly used packets, which are periodically sent by OSPF interfaces to establish and maintain neighbor relationships. A Hello packet includes information about the designated router (DR), backup designated router (BDR), timers, and known neighbors. Figure 1-1497 shows the format of a Hello packet.
Field |
Length |
Description |
---|---|---|
Network Mask |
32 bits |
Mask of the network on which the interface that sends the Hello packet resides. |
HelloInterval |
16 bits |
Interval at which Hello packets are sent. |
Options |
8 bits |
The values are as follows:
|
Rtr Pri |
8 bits |
DR priority. The default value is 1. NOTE:
If the DR priority of a router interface is set to 0, the interface cannot participate in a DR or BDR election. |
RouterDeadInterval |
32 bits |
Dead interval. If a device does not receive any Hello packets from its neighbors within a specified dead interval, the neighbors are considered down. |
Designated Router |
32 bits |
Interface address of the DR. |
Backup Designated Router |
32 bits |
Interface address of the BDR. |
Neighbor |
32 bits |
Router ID of the neighbor. |
Table 1-611 lists the address types, interval types, and default intervals used when Hello packets are transmitted on different networks.
Network Type |
Address Type |
Interval Type |
Default Interval |
---|---|---|---|
Broadcast |
Multicast address |
HelloInterval |
10 seconds |
NBMA |
Unicast address |
|
30 seconds for HelloInterval 120 seconds for PollInterval |
P2P |
Multicast address |
HelloInterval |
10 seconds |
P2MP |
Multicast address |
HelloInterval |
30 seconds |
Routers on the same network segment must have the same HelloInterval and RouterDeadInterval values. Otherwise, they cannot establish neighbor relationships. In addition, on an NBMA network, the PollInterval values must be the same at both ends.
DD Packet
During an adjacency initialization, two routers use DD packets to describe their own link state databases (LSDBs) for LSDB synchronization. A DD packet contains the header of each LSA in an LSDB. An LSA header uniquely identifies an LSA. The LSA header occupies only a small portion of the LSA, which reduces the amount of traffic transmitted between routers. A neighbor can use the LSA header to check whether it already has the LSA. When two routers exchange DD packets, one functions as the master, and the other functions as the slave. The master defines a start sequence number and increases the sequence number by one each time it sends a DD packet. After the slave receives a DD packet, it uses the sequence number carried in the DD packet for acknowledgment.
Figure 1-1498 shows the format of a DD packet.
Field |
Length |
Description |
---|---|---|
Interface MTU |
16 bits |
Maximum size of an IP packet that an interface can send without fragmenting the packet. |
Options |
8 bits |
The values are as follows:
|
I |
1 bit |
If the DD packet is the first among multiple consecutive DD packets sent by a device, this field is set to 1. Otherwise, this field is set to 0. |
M (More) |
1 bit |
If the DD packet is the last among multiple consecutive DD packets sent by a device, this field is set to 0. Otherwise, this field is set to 1. |
M/S (Master/Slave) |
1 bit |
When two OSPF devices exchange DD packets, they negotiate a master/slave relationship. The device with a larger router ID becomes the master. If this field is set to 1, the device that sends the DD packet is the master. |
DD sequence number |
32 bits |
Sequence number of the DD packet. The master and slave use the sequence number to ensure that DD packets are correctly transmitted. |
LSA Headers |
- |
LSA header information included in the DD packet. |
LSR Packet
After two routers exchange DD packets, they send LSR packets to request LSAs from each other. The LSR packets contain the summaries of the requested LSAs. Figure 1-1499 shows the format of an LSR packet.
Field |
Length |
Description |
---|---|---|
LS type |
32 bits |
Type of the LSA. |
Link State ID |
32 bits |
This field together with the LS type field describes an LSA in an AS. |
Advertising Router |
32 bits |
Router ID of the router that generates the LSA. |
The LS type, Link State ID, and Advertising Router fields can uniquely identify an LSA. If the preceding fields of two LSAs are the same, the device uses the LS sequence number, LS checksum, and LS age fields to determine which LSA is newer.
LSU Packet
A router uses an LSU packet to transmit LSAs requested by its neighbors or to flood its own updated LSAs. The LSU packet contains a set of LSAs. On networks that support multicast and broadcast, LSU packets are multicast to flood LSAs. To ensure reliable LSA flooding, a device uses an LSAck packet to acknowledge the LSAs contained in an LSU packet that is received from a neighbor. If an LSA fails to be acknowledged, the LSA is directly retransmitted to the neighbor. Figure 1-1500 shows the format of an LSU packet.
Field |
Length |
Description |
---|---|---|
Number of LSAs |
32 bits |
Number of LSAs contained in the LSU packet |
LSAck Packet
A device uses an LSAck packet to acknowledge the headers of the LSAs contained in a received LSU packet. LSAck packets are transmitted in unicast or multicast mode according to the link type. Figure 1-1501 shows the format of an LSAck packet.
Field |
Length |
Description |
---|---|---|
LSAs Headers |
Determined by the header length of the LSA to be acknowledged. |
This field is used to acknowledge an LSA. |
OSPF LSA Format
Each router in an AS generates one or more types of LSAs, depending on the router's type. Multiple LSAs form an LSDB. OSPF encapsulates routing information into LSAs for transmission. Commonly used LSAs include:
Summary-LSAs, including network-summary-LSAs (Type 3) and ASBR-summary-LSAs (Type 4)
LSA Header Format
All LSAs have the same header. Figure 1-1502 shows an LSA header.
Field |
Length |
Description |
---|---|---|
LS age |
16 bits |
Time that elapses after an LSA is generated, in seconds. The value of this field continually increases regardless of whether the LSA is transmitted over a link or saved in an LSDB. |
Options |
8 bits |
The values are as follows:
|
LS type |
8 bits |
Type of the LSA. The values are as follows:
|
Link State ID |
32 bits |
This field together with the LS type field describes an LSA in an AS. |
Advertising Router |
32 bits |
Router ID of the router that generates the LSA. |
LS sequence number |
32 bits |
Sequence number of the LSA. Neighbors can use this field to identify the latest LSA. |
LS checksum |
16 bits |
Checksum of all fields except the LS age field. |
length |
16 bits |
Length of the LSA including the LSA header, in bytes. |
Router-LSA
A router-LSA describes the link status and cost of a router. Router-LSAs are generated by a router and advertised within the area to which the router belongs. Figure 1-1503 shows the format of a router-LSA.
Field |
Length |
Description |
---|---|---|
Link State ID |
32 bits |
Router ID of the router that generates the LSA. |
V (Virtual Link) |
1 bit |
If the router that generates the LSA is located at one end of a virtual link, this field is set to 1. In other cases, this field is set to 0. |
E (External) |
1 bit |
If the router that generates the LSA is an autonomous system boundary router (ASBR), this field is set to 1. In other cases, this field is set to 0. |
B (Border) |
1 bit |
If the router that generates the LSA is an area border router (ABR), this field is set to 1. In other cases, this field is set to 0. |
# links |
16 bits |
Number of links and interfaces described in the LSA, including all links and interfaces in the area to which the router belongs. |
Link ID |
32 bits |
Object to which the router is connected. Its meanings are as follows:
|
Link Data |
32 bits |
Link data. Its meanings are as follows:
|
Type |
8 bits |
Type of the router link. The values are as follows:
|
# ToS |
8 bits |
Number of types of service (ToSs). |
metric |
16 bits |
Cost of the link. |
ToS |
8 bits |
Type of service. |
ToS metric |
16 bits |
Metric for the specified ToS. |
Network-LSA
A network-LSA describes the link status of all routers on the local network segment. Network-LSAs are generated by a DR on a broadcast or non-broadcast multiple access (NBMA) network and advertised within the area to which the DR belongs. Figure 1-1504 shows the format of a network-LSA.
Field |
Length |
Description |
---|---|---|
Link State ID |
32 bits |
Interface IP address of the DR |
Network Mask |
32 bits |
Mask of the broadcast or NBMA network |
Attached Router |
32 bits |
Router IDs of all routers on the broadcast or NBMA network, including the router ID of the DR |
Summary-LSA
A network-summary-LSA describes routes on a network segment in an area. The routes are advertised to other areas.
An ASBR-summary-LSA describes routes to the ASBR in an area. The routes are advertised to all areas except the area to which the ASBR belongs.
The two types of summary-LSAs have the same format and are generated by an ABR. Figure 1-1505 shows the format of a summary-LSA.
Field |
Length |
Description |
---|---|---|
Link State ID |
32 bits |
Advertised network address |
Network Mask |
32 bits |
Mask of the broadcast or NBMA network |
metric |
24 bits |
Cost of the route to the destination address |
ToS |
8 bits |
Type of service |
ToS metric |
24 bits |
Metric for the specified ToS |
When a default route is advertised, both the Link State ID and Network Mask fields are set to 0.0.0.0.
Table 1-620 describes ASBR-summary-LSA fields.
AS-External-LSA
An AS-external-LSA describes AS external routes. AS-external-LSAs are generated by an ASBR. Among the five types of LSAs, only AS-external-LSAs can be advertised to all areas except stub areas and not-so-stubby areas (NSSAs). Figure 1-1506 shows the format of an AS-external-LSA.
Field |
Length |
Description |
---|---|---|
Link State ID |
32 bits |
Advertised network address. |
Network Mask |
32 bits |
Mask of the advertised destination address. |
E |
1 bit |
Type of the external route. The values are as follows:
|
metric |
24 bit |
Cost of the route to the destination address. |
Forwarding Address |
32 bits |
Packets destined for the advertised destination address are forwarded to the address specified by this field. |
External Route Tag |
32 bits |
Tag added to the external route. This field can be used to manage external routes. OSPF itself does not use this field. |
ToS |
8 bits |
Type of service. |
ToS metric |
24 bits |
Metric for the specified ToS. |
When AS-external-LSAs are used to advertise default routes, both the Link State ID and Network Mask fields are set to 0.0.0.0.
Routing Loop Detection for Routes Imported to OSPF
Routes of an OSPF process can be imported to another OSPF process or the process of another protocol (such as IS-IS or BGP) for redistribution. However, if a device that performs such a route import is incorrectly configured, routing loops may occur. Routing loop detection for routes imported to OSPF supports routing loop detection and elimination.
Related Concepts
Redistribute ID
IS-IS uses a system ID as a redistribution identifier, OSPF and OSPFv3 use a router ID + process ID as a redistribution identifier, and BGP uses a VrfID + random number as a redistribution identifier. For ease of understanding, the redistribution identifiers of different protocols are all called Redistribute IDs. When routes are distributed, the information carried in the routes contains Redistribute IDs.
Redistribute List
A Redistribute list may consist of multiple Redistribute IDs. Each Redistribute list of BGP contains a maximum of four Redistribute IDs, and each Redistribute list of any other routing protocol contains a maximum of two Redistribute IDs. When the number of Redistribute IDs exceeds the corresponding limit, the old ones are discarded according to the sequence in which Redistribute IDs are added.
Cause (OSPF Inter-Process Mutual Route Import)
In Figure 1-1507, DeviceA, DeviceB, and DeviceC run OSPF process 1; DeviceF and DeviceG run OSPF process 2; DeviceD and DeviceE run both of the processes. Route import between OSPF process 1 and OSPF process 2 is configured on DeviceD and DeviceE. The routes distributed by OSPF process 1 on DeviceE are re-distributed back to OSPF process 1 on DeviceD through OSPF process 2. As the costs of the routes newly distributed by DeviceD are smaller, they are preferentially selected by OSPF process 1, resulting in routing loops.
Take the route distributed by DeviceA as an example. A stable routing loop is formed through the following process:
Phase 1
On the network shown in Figure 1-1508, OSPF process 1 on DeviceA imports the static route 10.0.0.1 and floods a Type 5 AS-External-LSA in OSPF process 1. After receiving the LSA, OSPF process 1 on DeviceD and OSPF process 1 on DeviceE each calculate a route to 10.0.0.1, with the outbound interfaces being interface1 on DeviceD and interface1 on DeviceE, respectively, and the cost being 102. At this point, the routes to 10.0.0.1 in OSPF process 1 in the routing tables of DeviceD and DeviceE are active.
Phase 2
In Figure 1-1509, DeviceD and DeviceE are configured to import routes from OSPF process 1 to OSPF process 2. No route-policy is configured for the import, or the configured route-policy is improper. For example, OSPF process 2 on DeviceE imports routes from OSPF process 1 and then floods a Type 5 AS-External-LSA in OSPF process 2. After receiving the LSA, OSPF process 2 on DeviceD calculates a route to 10.0.0.1, with the cost being 2, which is smaller than that (102) of the route calculated by OSPF process 1. As a result, the active route to 10.0.0.1 in the routing table of DeviceD is switched from the one calculated by OSPF process 1 to the one calculated by OSPF process 2, and the outbound interface of the route is sub-interface2.1.
Phase 3
In Figure 1-1510, DeviceD imports the route from OSPF process 2 to OSPF process 1 and floods a Type 5 AS-External LSA in OSPF process 1. After receiving the LSA, OSPF process 1 on DeviceE recalculates the route to 10.0.0.1. The cost of the route becomes 2, which is smaller than that of the previously calculated route. Therefore, the route to 10.0.0.1 in OSPF process 1 on DeviceE is changed to the route distributed by DeviceD, and the outbound interface is interface 2.
Phase 4
After the route to 10.0.0.1 on DeviceE is updated, OSPF process 2 still imports the route from OSPF process 1 as the route remains active, and continues to distribute/update a Type 5 AS-External-LSA.
As a result, a stable routing loop is formed. Assuming that traffic is injected from DeviceF, Figure 1-1511 shows the traffic flow when the routing loop occurs.
Implementation (OSPF Inter-Process Mutual Route Import)
Routing loop detection for the routes imported between OSPF processes can resolve the routing loops in the preceding scenario.
When distributing a Type 5 AS-External-LSA for an imported route, OSPF also uses a Type 11 extended prefix Opaque LSA to distribute to other devices the Redistribute ID of the device that redistributes the imported route. If the route is redistributed by different protocols through multiple devices, the Redistribute IDs of these protocols on the devices are distributed through a Type 11 extended prefix Opaque LSA. When receiving the Type 11 extended prefix Opaque LSA, a route calculation device saves the Redistribute ID and route information of the route redistribution device. When another process imports the route, the device checks whether a routing loop occurs according to the route redistribution information. If a routing loop occurs, the device attaches a large route cost to the AS-External-LSA for the imported route. This prevents other devices from selecting the route distributed by the local device, thereby resolving the routing loop.
Figure 1-1512 is used to describe how a routing loop is detected and resolved.
- DeviceA distributes its locally originated route 10.0.0.1/24 to DeviceB.
- DeviceD learns the route distributed by DeviceB through OSPF process 1 and imports the route from OSPF process 1 to OSPF process 2. DeviceE learns the route distributed by DeviceD through OSPF process 2 and saves the Redistribute List distributed by DeviceD through OSPF process 2 to the routing table when calculating routes.
- DeviceE imports the route from OSPF process 2 to OSPF process 1 and redistributes the route through OSPF process 1. The corresponding Type 11 extended prefix Opaque LSA contains the Redistribute ID of OSPF process 1 on DeviceE and the Redistribute ID of OSPF process 2 on DeviceD. The Redistribute ID of OSPF process 1 on DeviceB has been discarded from the LSA.
- OSPF process 1 on DeviceD learns the Redistribute list corresponding to the route distributed by DeviceE and saves the Redistribute list in the routing table. When importing the route from OSPF process 1 to OSPF process 2, DeviceD finds that the Redistribute list of the route contains its own Redistribute ID, considers that a routing loop is detected, and reports an alarm. OSPF process 2 on DeviceD distributes a large cost when redistributing the route so that other devices preferentially select other paths after learning the route. This prevents routing loops.
When detecting a routing loop upon route import between processes of the same protocol, the device increases the cost of the corresponding route. As the cost of the delivered route increases, the optimal route in the IP routing table changes. In this way, the routing loop is eliminated.
In the case of inter-protocol route import, if a routing protocol with a higher preference detects a routing loop, although this protocol increases the cost of the corresponding route, the cost increase will not render the route inactive. As a result, the routing loop cannot be eliminated. If the routing protocol with a lower preference increases the cost of the corresponding route, this route competes with the originally imported route during route selection. In this case, the routing loop can be eliminated.
Cause (Mutual Route Import Between OSPF and IS-IS)
On the network shown in Figure 1-1513, DeviceA, DeviceB, and DeviceC run OSPF process 1, DeviceF and DeviceG run IS-IS process 2, and DeviceD and DeviceE run both processes. Route import between OSPF process 1 and IS-IS process 2 is configured on DeviceD and DeviceE. The routes distributed by OSPF process 1 on DeviceE are re-distributed back to OSPF process 1 on DeviceD through IS-IS process 2. As the costs of the routes newly distributed by DeviceD are smaller, they are preferentially selected by OSPF process 1, resulting in routing loops.
Implementation (Mutual Route Import Between OSPF and IS-IS)
The following uses the networking shown in Figure 1-1513 as an example to describe how a routing loop is detected and resolved.
- DeviceD learns the route distributed by DeviceB through OSPF process 1 and imports the route from OSPF process 1 to IS-IS process 2. When IS-IS process 2 on DeviceD distributes route information, it uses the extended prefix sub-TLV to distribute the Redistribute ID of IS-IS process 2 through an LSP. IS-IS process 2 on DeviceE learns the route distributed by DeviceD and saves the Redistribute ID distributed by IS-IS process 2 on DeviceD to the routing table during route calculation.
- DeviceE imports the route from IS-IS process 2 to OSPF process 1 and uses an E-AS-External-LSA to distribute the Redistribute ID of OSPF process 1 on DeviceE when distributing route information. Similarly, after OSPF process 1 on DeviceD learns the route from DeviceE, DeviceD saves the Redistribute ID distributed by OSPF process 1 on DeviceE to the routing table during route calculation.
- When importing the route from OSPF process 1 to IS-IS process 2, DeviceD finds that the Redistribute list of the route contains its own Redistribute ID, considers that a routing loop is detected, and reports an alarm. IS-IS process 2 on DeviceD distributes a large cost when distributing the imported route. Because IS-IS has a higher preference than OSPF ASE, this does not affect the route selection result or resolve the routing loop.
- DeviceE imports the route from IS-IS process 2 to OSPF process 1, finds that the Redistribute list of the route contains its own Redistribute ID, considers that a routing loop is detected, and reports an alarm. OSPF process 1 on DeviceE distributes a large cost when distributing the imported route so that other devices preferentially select other paths after learning the route. This prevents routing loops.
Cause (Mutual Route Import Between OSPF and BGP)
On the network shown in Figure 1-1514, DeviceA, DeviceB, and DeviceC run a BGP process, DeviceF and DeviceG run OSPF process 2, and DeviceD and DeviceE run both processes. Route import between BGP and OSPF process 2 is configured on DeviceD and DeviceE. The routes distributed by BGP on DeviceE are redistributed back to BGP through OSPF process 2 on DeviceD. Because no route-policy is configured for the import or the configured route-policy is improper, the route newly distributed by DeviceD may be selected as the optimal route by BGP, causing a routing loop.
Implementation (Mutual Route Import Between OSPF and BGP)
The following uses the networking shown in Figure 1-1514 as an example to describe how a routing loop is detected and resolved.
- DeviceD learns the route distributed by DeviceB through BGP and imports the BGP route to OSPF process 2. When DeviceD distributes the imported route through OSPF process 2, it uses a Type 11 extended prefix Opaque LSA to distribute the Redistribute ID of OSPF process 2 on DeviceD. DeviceE learns the route distributed by DeviceD through OSPF process 2 and saves the Redistribute List distributed by DeviceD through OSPF process 2 to the routing table when calculating routes.
- DeviceE imports the route from OSPF process 2 to BGP and distributes the Redistribute ID of the BGP process on DeviceE through a Type 11 extended prefix Opaque LSA when redistributing the imported route. After BGP on DeviceD learns the route distributed by DeviceE, DeviceD saves the Redistribute ID distributed by BGP on DeviceE to the routing table during route calculation.
- When importing the route from BGP to OSPF process 2, DeviceD finds that the Redistribute list of the route contains its own Redistribute ID, considers that a routing loop is detected, and reports an alarm. OSPF process 2 on DeviceD distributes a large link cost when distributing the imported route. Because OSPF has a higher preference than BGP, this does not affect the route selection result or resolve the routing loop.
- After learning the route distributed by OSPF on DeviceD, DeviceE imports the route to BGP. Upon finding that the Redistribute list of the route contains its own Redistribute ID, DeviceE considers that a routing loop is detected and reports an alarm. When BGP on DeviceE distributes the route, it reduces the preference of the route. In this way, other devices preferentially select other paths after learning this route, preventing routing loops.
When detecting a routing loop upon route import between processes of the same protocol, the device increases the cost of the corresponding route. As the cost of the delivered route increases, the optimal route in the IP routing table changes. In this way, the routing loop is eliminated.
In the case of inter-protocol route import, if a routing protocol with a higher preference detects a routing loop, although this protocol increases the cost of the corresponding route, the cost increase will not render the route inactive. As a result, the routing loop cannot be eliminated. If the routing protocol with a lower preference increases the cost of the corresponding route, this route competes with the originally imported route during route selection. In this case, the routing loop can be eliminated.
Application Scenarios
Figure 1-1515 shows a typical seamless MPLS network. If the OSPF process deployed at the access layer differs from that deployed at the aggregation layer, OSPF inter-process mutual route import is usually configured on AGGs so that routes can be leaked between the access and aggregation layers. In this case, a routing loop may occur between AGG1 and AGG2. If OSPF routing loop detection is configured on AGG1 and AGG2, routing loops can be quickly detected and resolved.
OSPF Configuration
By building OSPF networks, you can enable OSPF to discover and calculate routes in an AS. OSPF is applicable to large-scale networks with hundreds of routers.
Overview of OSPF
Open Shortest Path First (OSPF), which is developed by the IETF, is a link-state IGP. OSPF is widely used in access networks and MANs.
Definition
Open Shortest Path First (OSPF) is a link-state Interior Gateway Protocol (IGP) developed by the Internet Engineering Task Force (IETF).
OSPF version 2 (OSPFv2) is intended for IPv4. OSPF version 3 (OSPFv3) is intended for IPv6.
In this document, OSPF refers to OSPFv2, unless otherwise stated.
Purpose
Before the emergence of OSPF, the Routing Information Protocol (RIP) was widely used as an IGP on networks. RIP is a distance-vector routing protocol. Due to its slow convergence, routing loops, and poor scalability, RIP is gradually being replaced with OSPF.
Typical IGPs include RIP, OSPF, and Intermediate System to Intermediate System (IS-IS). Table 1-622 describes differences among the three typical IGPs.
Item |
RIP |
OSPF |
IS-IS |
---|---|---|---|
Protocol type |
IP layer protocol |
IP layer protocol |
Link layer protocol |
Application scope |
Applies to small networks with simple architectures, such as campus networks. |
Applies to medium-sized networks with several hundred routers supported, such as enterprise networks. |
Applies to large networks, such as Internet service provider (ISP) networks. |
Routing algorithm |
Uses a distance-vector algorithm and exchanges routing information over the User Datagram Protocol (UDP). |
Uses the shortest path first (SPF) algorithm to generate a shortest path tree (SPT) based on the network topology, calculates shortest paths to all destinations, and exchanges routing information over IP. |
Uses the SPF algorithm to generate an SPT based on the network topology, calculates shortest paths to all destinations, and exchanges routing information over IP. The SPF algorithm runs separately in Level-1 and Level-2 databases. |
Route convergence speed |
Slow |
Less than 1 second |
Less than 1 second |
Scalability |
Not supported |
Supported by partitioning a network into areas |
Supported by defining router levels |
Benefits
OSPF offers the following benefits:
Wide application scope: OSPF applies to medium-sized networks with several hundred routers, such as enterprise networks.
Network masks: OSPF packets can carry masks, and therefore the packet length is not limited by natural IP masks. OSPF can process variable length subnet masks (VLSMs).
Fast convergence: When the network topology changes, OSPF immediately sends link state update (LSU) packets to synchronize the changes to the link state databases (LSDBs) of all routers in the same autonomous system (AS).
Loop-free routing: OSPF uses the SPF algorithm to calculate loop-free routes based on the collected link status.
Area partitioning: OSPF allows an AS to be partitioned into areas, which simplifies management. Routing information transmitted between areas is summarized, which reduces network bandwidth consumption.
Equal-cost routes: OSPF supports multiple equal-cost routes to the same destination.
Hierarchical routing: OSPF uses intra-area routes, inter-area routes, Type 1 external routes, and Type 2 external routes, which are listed in descending order of priority.
Authentication: OSPF supports area-based and interface-based packet authentication, which ensures packet exchange security.
Multicast: OSPF uses multicast addresses to send packets on certain types of links, which minimizes the impact on other devices.
Configuration Precautions for OSPF
Feature Requirements
Feature Requirements |
Series |
Models |
---|---|---|
OSPF checks whether a neighbor in the full state exists in the backbone area before advertising a default route to the stub area. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
When a device in an NSSA generates an NSSA LSA based on an imported external route, the device preferentially uses the IP address of a loopback interface in the NSSA as the forwarding address (FA). If no loopback interfaces exist in the NSSA, the device selects the IP address of a non-loopback interface. As a result, the downstream device may fail to implement load balancing using routes even when links with the same cost exist. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
OSPF advertises default routes to an NSSA only when neighbor relationships in the Full state exist in the backbone area or default routes of another protocol or of another OSPF process exist in the same VPN instance on the device, and the nssa default-route-advertise command is run. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
1. The mapping SID priority is not supported. All mapping SIDs are processed based on the default priority. 2. On the TiLfa protection path, all devices from the source node to the Q node must support segment routing, and an LDP path must exist between the Q node and the destination node. 3. SR routes mapped to mapping SIDs do not support anycast FRR. Anycast protection is not implemented between SR routes mapped to mapping SIDs or between SR routes mapped to mapping SIDs and common SR routes. 4. SR routes mapped to mapping SIDs do not support remote microloop avoidance. 5. In inter-process and inter-protocol scenarios, when an ASBR functions as an interworking stitching node, MappingSid mapping needs to be configured on the imported process. Plan the configuration properly. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In SR and LDP interworking scenarios, PHP is not supported. Properly plan the network. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In SR and LDP interworking scenarios, only the mapping SID with the 32-bit mask IP prefix is supported. Properly plan the network. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In an SR and LDP interworking scenario, FRR does not take effect in some scenarios, for exmaple: In the SR to LDP direction, the Q node and all NEs on the path before the Q node are required to support SR. In the LDP to SR interworking FRR scenario, the PQ and all NEs on the path before the PQ are required support LDP. Properly plan configurations. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In an OSPF loop detection scenario, when the maximum cost is advertised due to a loop, the apply cost command does not take effect. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In OSPF session CAR scenarios, OSPF neighbors in multiple areas on the same interface cannot be distinguished on the forwarding plane. Therefore, they share the same session CAR entry. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
OSPF broadcast networks support association between link BFD and cost values. 1) When only one neighbor relationship is established and BFD goes Down, the neighbor relationship is not deleted, and the OSPF LSDB component is notified that the neighbor relationship enters the BFD-associated cost state. 2) This function is not supported when there are multiple neighbors. When the number of neighbors changes from one to multiple, the OSPF LSDB component is notified of the deletion of the neighbor in the BFD Down state. It is recommended that only one neighbor relationship be established on an OSPF broadcast network. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
SBFD is not supported in SR and LDP interworking scenarios because LDP does not support SBFD. Properly plan the network. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In an OSPF loop detection scenario, after a loop is removed, the loop cannot be automatically removed and the alarm cannot be automatically cleared. You need to manually configure a routing policy or route tag and run the clear route loop-detect ospf alarm-state command to remove the route from the loop state and clear the alarm. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In OSPF loop detection scenarios, only loops caused by inter-process route import between two devices can be detected. If more than two devices import routes between processes, loops cannot be detected. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In OSPF loop detection scenarios, aggregated routes and NSSA routes do not support loop detection. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
OSPF loop detection does not support router ID conflicts, including intra-AS and inter-AS router ID conflicts. A router ID conflict may trigger incorrect detection. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In OSPF loop detection scenarios, a single process supports loop detection for a maximum of 100,000 routes. If the number of routes exceeds 100,000, loop detection cannot be performed. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
After the device enters the loop breaking state, it cannot automatically exit the routing loop state and the alarm cannot be automatically cleared. In this case, manual intervention is required. For example, after a routing policy or route tag is correctly configured, run the clear route loop-detect ospf alarm-state command to exit the routing loop state and clear the alarm. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
OSPF loop detection depends on the Opaque capability of OSPF in a process. If the Opaque capability is not enabled, OSPF loop detection does not take effect. In this case, you need to manually enable the Opaque capability of OSPF. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
In OSPF loop detection scenarios, the default route advertised using the default-route-advertise command supports only loop detection and does not support self-healing. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
After the device is restarted, if the BFD session of the local device or its neighbor is in Admin Down state, the OSPF status is not affected. When the BFD session is renegotiated, if the BFD detection status reported by BFD is Down (used to be Up), the OSPF neighbor is set to Down. In other cases, the OSPF status is not affected. |
NetEngine 8000 M |
NetEngine 8000 M14/NetEngine 8000 M14K/NetEngine 8000 M4/NetEngine 8000 M8/NetEngine 8000 M8K/NetEngine 8000E M14/NetEngine 8000E M8 |
Configuring Basic OSPF Functions
Before constructing OSPF networks, you need to configure basic OSPF functions.
Usage Scenario
When OSPF is configured on multiple routers in the same area, most configuration data, such as the timer, filter, and aggregation, must be planned uniformly in the area. Incorrect configurations may cause neighboring routers to fail to send messages to each other or even causing routing information congestion and self-loops.
The OSPF-relevant commands that are configured in the interface view take effect regardless of whether OSPF is enabled. After OSPF is disabled, the OSPF-relevant commands also exist on interfaces.
Enabling OSPF
After an OSPF process is created, a router ID is configured for the router, an interface on which OSPF runs and the area to which the interface belongs are specified, routes can be discovered and calculated in the AS.
Context
OSPF on the router requires a router ID. The router ID is a 32-bit unsigned integer, which uniquely identifies the router in the AS. To ensure the stability of OSPF, manually set the router ID of each router during network planning.
OSPF prevents the link state database (LSDB) size from unexpectedly growing by partitioning an AS into different areas. An area is regarded as a logical group, and each group is identified by an area ID. At the border of an area resides the router instead of a link. A network segment (or a link) belongs to only one area. The area to which each OSPF interface belongs must be specified.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id | router-id router-id ] *
An OSPF process is started, and the OSPF view is displayed.
The NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M supports OSPF multi-instance. To run OSPF in a VPN instance, run the ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] * command.
The NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M supports OSPF multi-process. Processes can be classified by service type. The routers exchange packets regardless of process IDs.
router-id router-id specifies the router ID of the router.
By default, the router automatically selects the IP address of an interface as the router ID. When configuring the router ID, ensure that the router ID is unique in an AS. You can configure the IP address of an interface as the router ID.
Each router ID in an OSPF process must be unique. Otherwise, no OSPF neighbor relationships can be established, and routing information is incorrect.
If a router ID conflict occurs, perform either of the following operations:
- Run the ospf router-id router-id command to configure a new router ID.
- Run the undo ospf router-id auto-recover disable command to enable the router ID automatic recovery function. After the function is enabled, the system automatically allocates a new router ID if a router ID conflict occurs.
- If the automatic recovery function is enabled and a router ID conflict occurs between indirectly connected routers in one OSPF area, the conflicting router ID is replaced with a newly calculated one, regardless of whether the conflicting router ID was manually configured or automatically generated.
- The system can replace a router ID in a maximum of three attempts in case the router ID conflict persists.
After a router ID is replaced, the reset ospf [ process-id ] process command needs to be run to validate the new router ID.
If a VPN instance is specified, the OSPF process belongs to this VPN instance. If a VPN instance is not specified, the OSPF process belongs to the public-network instance.
You can run the description command to configure a description for the OSPF process for easier identification.
- Run area area-id
The OSPF area view is displayed.
OSPF areas are classified as a backbone area (with area ID 0) or non-backbone areas. The backbone area forwards inter-area routing information. The routing information exchanged between non-backbone areas must be forwarded through the backbone area.
You can run the description command to configure a description for the OSPF area for easier identification.
- To configure OSPF, you can configure the network segments included in an area or enable OSPF on an interface.
To configure the network segments included in an area, run the network address wildcard-mask [ description text ] command, in which description specifies the description of the area.
OSPF runs on an interface only when both of the following conditions are met:
The mask length of the interface's IP address is greater than or equal to that specified in the network command.
If wildcard-mask in the network command are all 0s and the IP address of the interface is the same as the IP address specified in the network address command, OSPF is also enabled on the interface.
The interface's primary IP address belongs to the network segment specified in the network command.
By default, OSPF uses a host route with a 32-bit mask to advertise the IP address of a loopback interface, regardless of the mask length configured for the IP address. To allow a loopback interface to advertise network-segment routes, its network type must be set to NBMA or broadcast in the interface view. For details on how to set the network type, see Configuring Network Types for OSPF Interfaces.
- Enable OSPF on an interface.
- Run the quit command twice to return to the system view.
- Run the interface interface-type interface-number command to enter the interface view.
- Run the ospf enable [ process-id ] area area-id command to enable OSPF on the interface. The specified area ID can be a decimal integer or in the format of an IPv4 address. Regardless of the specified format, the area ID is displayed as an IPv4 address.
- Run commit
The configuration is committed.
Configuring an Interface to Fill in a DD Packet with the Interface MTU
You can configure an interface to fill in the Interface MTU field of a DD packet with the interface MTU.
Context
To improve compatibility with a non-Huawei device, an OSPF-enabled Huawei device adds the MTU 0 in DD packets to be sent and does not check the MTUs in received DD packets, thereby allowing an OSPF neighbor relationship to be set up even if the two ends have different MTU settings.
However, under the default configuration, the non-Huawei device may discard an OSPF packet received from the Huawei device if the actual MTU in the packet is greater than the MTU of the non-Huawei device. If an LSU is discarded, an OSPF neighbor relationship can still be set up, but the routing information carried in the LSU fails to be learned, causing service interruption.
To resolve this issue, run the ospf mtu-enable command to configure an interface to add the actual MTU in DD packets to be sent and check whether the MTU in a received DD packet is greater than the local MTU. If the interface MTU settings of the local and remote ends are different, an OSPF neighbor relationship cannot enter the Full state. In this manner, MTU inconsistency can then be identified in time.
Setting the MTU in a DD packet will have the neighbor relationship reestablished.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf mtu-enable
The interface is configured to fill in a DD packet with the interface MTU and check whether the MTU in the DD packet from the neighboring router exceeds the MTU of the local router.
- Run commit
The configuration is committed.
(Optional) Creating OSPF Virtual Links
This section describes how to create logical links between backbone areas and to ensure the OSPF network connectivity.
Context
After OSPF areas are deployed, OSPF route updates between non-backbone areas are transmitted through the backbone area. Therefore, OSPF requires that all non-backbone areas be connected to a backbone area and backbone areas be connected as well. However, these requirements may not be met due to various limitations. OSPF virtual links can be configured to solve the problem.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run area area-id
The OSPF area view is displayed.
- Run vlink-peer router-id [ dead dead-interval | hello hello-interval | retransmit retransmit-interval | trans-delay trans-delay-interval | smart-discover | [ simple [ plain plain-text | [ cipher ] cipher-text ] | { md5 | hmac-md5 | hmac-sha256 } [ key-id { plain plain-text | [ cipher ] cipher-text } ] | authentication-null | keychain keychain-name ] ] *
A virtual link is created.
This command must be run on the other end of the virtual link as well.
The default parameter values are recommended when a virtual link is configured. If the network has special requirements, change the parameter values as required. Suggested parameter configurations are as follows:- The smaller the hello value, the faster the router detects network topology changes, and the more network resources are consumed.
- If the value of retransmit is too small, unnecessary LSA retransmission may occur. It is recommended that you set a large value on a low-speed network.
- The authentication modes of a virtual link and the backbone area must be the same.
- Run commit
The configuration is committed.
(Optional) Configuring the router to Comply with Route Selection Rules Defined in a Standard Protocol
You can configure the router to comply with the route selection rule defined in RFC 1583 or RFC 2328.
Context
RFC 2328 and RFC 1583 define route selection rules differently. After enabling OSPF on the router, you can configure the device to comply with route selection rules defined in either standard protocol as required. By default, the router complies with the route selection rules defined in RFC 1583. If you want the device to comply with the other protocol, you need to configure the device to comply with the rules defined in RFC 2328. Such configurations ensure that all OSPF-enabled devices in an AS comply with the same route selection rules defined in the same standard protocol.
If both intra-area and inter-area paths to an ASBR exist on a network, the default rules for selecting a path to the ASBR are as follows:
- In RFC 1583 compatibility mode:
- If the area IDs of the intra-area and inter-area paths to the ASBR are the same, intra-area paths are preferred.
- If the area IDs of intra-area and inter-area paths to the ASBR are different, the path with the smallest cost is preferred; if their costs are the same, the path with the largest area ID is preferred.
- In RFC 1583 non-compatibility mode:
- If the area IDs of the intra-area and inter-area paths to the ASBR are the same and the paths belong to non-backbone areas, intra-area paths are preferred.
- If the area IDs of the intra-area and inter-area paths to the ASBR are the same and the paths belong to the backbone area, the path with the smallest cost is preferred; if their costs are the same, load balancing is supported.
- If the area IDs of the intra-area and inter-area paths to the ASBR are different, intra-area paths that belong to non-backbone areas are preferred; if intra-area paths belong to the backbone area, the path with the smallest cost is preferred; if their costs are the same, the path with the largest area ID is preferred.
If devices of different vendors or different series of devices of the same vendor are deployed on the same network, the rules for selecting a path to an ASBR among intra-area and inter-area paths may vary according to the mode (RFC 1583 compatibility mode or RFC 1583 non-compatibility mode). In this case, routing loops may occur. To prevent the routing loops, you can set the path selection rules to the default ones.
To prevent routing loops, ensure that all devices on the network use the same path selection rules. If adjustment is performed only on some devices, the adjustment fails to meet expectations. Therefore, exercise caution when adjusting path selection rules.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- (Optional) Run rfc1583 compatible different-area-path prefer lower-cost
The device is configured to comply with the default rules in RFC 1583 compatibility mode for selecting a path to an ASBR. That is, if the area IDs of intra-area and inter-area paths to the ASBR are different, the path with the smallest cost is preferred; if their costs are the same, the path with the largest area ID is preferred.
- Run undo rfc1583 compatible
The device is configured to comply with the route selection rule defined in RFC 2328, rather than RFC 1583.
- (Optional) Run rfc1583 non-compatible backbone-area-path prefer intra
The device is configured to comply with the default rules in RFC 1583 non-compatibility mode for selecting a path to an ASBR. That is, if the area IDs of the intra-area and inter-area paths to the ASBR are the same and the paths belong to the backbone area, intra-area paths are preferred.
- Run commit
The configuration is committed.
(Optional) Setting the OSPF Priority
When multiple routing protocols are used to select routes, you can set the OSPF priority to maneuver route selection.
Context
The routing protocols may share and select the routing information because the router may run multiple dynamic routing protocols at the same time. The system sets a priority for each routing protocol. When multiple routing protocols are used to select routes, the route selected by the routing protocol with a higher priority takes effect.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run preference [ ase | inter | intra ] { preference | { route-policy route-policy-name | route-filter route-filter-name } } *
The OSPF priority is set.
ase: sets the priority of the AS-External route.
inter: sets the priority of the Inter-area route.
intra: sets the priority of the Intra-area route.
preference: sets the priority for OSPF. The smaller the value, the higher the priority.
route-policy-name: sets the priority for specified routes in the routing policy.
route-filter-name
: sets the priority for specified routes in the route-filter policy.
- Run commit
The configuration is committed.
(Optional) Restricting the Flooding of OSPF Update LSAs
To maintain stable OSPF neighbor relationships, you can restrict the flooding of update LSAs on a local device, so that its neighbors will not discard Hello packets due to a great number of update LSAs.
Context
If a local device has a large number of neighbors or needs to flood a large number of update LSAs, neighbor routers will receive a large number of update packets within a short time. In this case, neighbor routers are busy with processing the burst update packets and discard the Hello packets that are used to maintain neighbor relationships. As a result, the established OSPF neighbor relationships will be terminated. Then, the neighbor routers will exchange more packets to re-establish the neighbor relationships, exacerbating the problem of excessive packets.
To prevent this problem and ensure the stability of neighbor relationships, you can configure OSPF to restrict the flooding of update LSAs.
The parameter settings of this command directly affect the flooding speed. If the parameters are improperly set, LSAs may not be synchronized in time, which affects the routing of the entire network. Therefore, this function is not recommended unless otherwise required.
(Optional) Configuring the Maximum Number of Packet Retransmission Attempts
When no response to DD packets, LSU packets, or LSR packets is received, the retransmission mechanism is used and the maximum number of packet retransmission attempts is set to prevent dead loops caused by repeated transmissions.
(Optional) Setting the Interval at Which LSAs Are Retransmitted Between Adjacent routers
Control packet retransmission and improve the convergence rate by setting an interval at which an LSA packet is retransmitted to the adjacent router.
Context
After sending an LSA packet to the adjacent router, the router waits for a response. If the device does not receive an acknowledgement packet within the Nth LSA retransmission interval, the device retransmits the LSA to the neighbor.
First LSA retransmission interval = Configured interval at which LSAs are retransmitted, which is interval
Second LSA retransmission interval = Configured interval at which LSAs are retransmitted, which is interval
Third LSA retransmission interval = Configured interval at which LSAs are retransmitted, which is interval
Fourth LSA retransmission interval = Configured interval at which LSAs are retransmitted (interval) x 2
Fifth LSA retransmission interval = Configured interval at which LSAs are retransmitted (interval) x 2^2
Nth LSA Retransmission Interval = Configured interval at which LSAs are retransmitted (interval) x 2^(n-3).
If interval x 2^(n-3) is greater than 30, the Nth LSA retransmission interval is 30.
If the configured interval at which LSAs are retransmitted (interval) is greater than 30, the Nth LSA retransmission interval equals interval.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf timer retransmit interval
An interval for retransmitting LSAs to the adjacent router is configured.
Set the LSA retransmission interval to a proper value on the router. An excessively short interval will cause unnecessary retransmission. Generally, the interval should be longer than the time taken for round-trip packet transmission between two routers.
The default value is recommended.
- Run commit
The configuration is committed.
Verifying the Configuration
After configuring basic OSPF functions, verify information about OSPF neighbors, interfaces, and routes.
Procedure
- Run the display ospf [ process-id ] abr-asbr [ router-id ] command in any view to check information about the ABRs and ASBRs of OSPF.
- Run the display ospf [ process-id ] cumulative command in any view to check information about OSPF statistics.
- Run the display ospf [ process-id ] peer command in any view to check information about OSPF neighbors.
- Run the display ospf [ process-id ] nexthop command in any view to check information OSPF next hop information.
- Run the display ospf [ process-id ] error [ lsa | interface interface-type interface-number ] command in any view to check information about OSPF error information.
- Run the display ospf [ process-id ] vlink command in any view to check information about OSPF virtual links.
- Run the display ospf [ process-id ] interface [ all | no-peer | interface-type interface-number ] [ verbose ] command in any view to check information about OSPF interfaces.
- Run the display ospf [ process-id ] routing command in any view to check information about the OSPF routing table.
- Run the display ospf [ process-id ] topology [ area area-id ] [ statistics | verbose ] command in any view to check information about the topology calculated for OSPF routes.
- Run the display ospf [ process-id ] spf-statistics [ verbose ] command in any view to check information about route calculation statistics in OSPF processes.
- Run the display ospf [ process-id ] request-queue [ interface-type interface-number ] [ neighbor-id ] command in any view to check information about OSPF request list.
- Run the display ospf [ process-id ] retrans-queue [ interface-type interface-number ] [ neighbor-id ] command in any view to check information about OSPF retransmission list.
- Run the display ospf [ process-id ] statistics updated-lsa [ originate-router advertising-router-id | history ] command in any view to check information about the frequent updates of the LSAs that the LSDB receives
- Run the display ospf [ process-id ] statistics maxage-lsa command to check information about router LSAs that have reached the aging time.
- Run the display ospf [ process-id ] router-id conflict command in any view to check information about router ID conflicts (if any).
Configuring OSPF on the NBMA or P2MP Network
This section describes how to configure OSPF and modify attributes on the NBMA or point-to-multipoint (P2MP) network to flexibly construct the OSPF network.
Usage Scenario
This section describes only the OSPF configurations that are different on the NBMA network and P2MP network. The OSPF configurations not provided here are applicable to the four types of networks.
Network Type |
Characteristic |
Default Configuration |
---|---|---|
Broadcast |
On such a type of network, Hello, LSU, and LSAck packets are multicast; DD and LSR packets are unicast. |
If the link layer protocol is Ethernet or Fiber Distributed Data Interface (FDDI), OSPF regards the network as a broadcast network by default. |
Non-broadcast multiple access (NBMA) |
On such a type of network, Hello, DD, LSR, LSU, and LSAck packets are unicast. The NBMA network must be fully meshed. Any two routers on the NBMA network must be directly reachable. |
- If the link layer protocol is ATM, OSPF regards the network as an NBMA network by default. |
Point-to-point (P2P) |
On such a type of network, Hello, DD, LSR, LSU, and LSAck packets are multicast. |
If the link layer protocol is PPP, HDLC, or Link Access Procedure Balanced (LAPB), OSPF regards the network as a P2P network by default. NOTE:
Only the NetEngine 8000 M8K and NetEngine 8000 M14K do not support HDLC. |
Point-to-multipoint (P2MP) |
On such a type of network, Hello packets are multicast; DD, LSR, LSU, and LSAck packets are unicast. The mask lengths of the routers on the P2MP network must be the same. |
OSPF does not regard a network as a P2MP network by default regardless of any link layer protocol. A P2MP network is forcibly changed from the network of another type. |
Configuring Network Types for OSPF Interfaces
OSPF classifies networks into four types based on the types of link layer protocols. You can configure the network type for an OSPF interface to forcibly change its original network type.
Context
Network types of OSPF interfaces on both ends of a link must be the same. Otherwise, the two interfaces cannot establish an OSPF neighbor relationship. By default, the network type of an interface is determined by the physical interface. The network type of Ethernet interfaces is broadcast, the network type of serial interfaces is p2p, the network type of Frame-relay interfaces is nbma.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf network-type { broadcast | nbma | p2mp | p2p [ peer-ip-ignore ] }
A network type is configured for the OSPF interface.
When a new network type is configured for an interface, the original network type of the interface is replaced.
Configure a network type for the interface as required. For example:- If the network type of an interface is broadcast but some routers on the broadcast network do not support multicast addresses, you can change the network type of the interface to NBMA.
- If the network type of an interface is NBMA and the network is fully meshed (any two routers are directly reachable), you can change the interface type to broadcast, without the need to configure neighbor routers.
- If the network type of an interface is NBMA but the network is not fully meshed, you need to change the network type of the interface to P2MP. In this manner, two routers that are not directly reachable can exchange routing information through one router that is directly reachable to the two routers. After the network type of the interface is changed to P2MP, there is no need to configure neighbor routers.
- If only two routers run OSPF on the same network segment, changing the interface network type to P2MP is recommended.
peer-ip-ignore is used to disable network segment check during OSPF neighbor relationship establishment on an interface for which the network type is changed from broadcast to P2P and address unnumbering is not configured. For network segment check, the local interface performs an AND operation between its mask and the local interface address and between this mask and the peer interface address. If the results are the same, an OSPF neighbor relationship can be established. If the results are different, no OSPF neighbor relationship can be established.
OSPF does not support the configuration of a null interface.
- Run commit
The configuration is committed.
Configuring NBMA Network Attributes
To implement OSPF functions, configure NBMA network attributes.
Procedure
- (Optional) Set the network type to NBMA.
The NBMA network must be fully meshed. Any two routers on the NBMA network must be directly reachable. In most cases, however, this requirement cannot be met. To resolve this problem, run specific commands to forcibly change the network type to NBMA. For details, see Configuring Network Types for OSPF Interfaces.
- (Optional) Run ospf timer poll interval
The interval at which Hello packets for polling are sent by an NBMA interface is set.
On the NBMA network, after the neighbor relationship becomes invalid, the router sends Hello packets at an interval defined in the polling mechanism.
- (Optional) Run ospf dr-priority priovalue
Sets the priority of an interface that runs for the DR or BDR.
The priority of an interface determines whether the interface is qualified to be a DR or BDR. The interface with the highest priority is elected as the DR or BDR. If the priority of an interface on a device is 0, the device cannot be elected as a DR or BDR. On a broadcast or an NBMA network, you can set the priority of an interface to control the DR or BDR selection. When the DR and BDR are elected on a network segment, they send DD packets to all neighboring nodes and set up adjacencies with all neighboring nodes.
- (Optional) Run ospf timer wait interval
If no Backup Seen event is received within the interval, the designated router (DR) election starts. Setting a proper value for the wait timer can slow down changes of the DR and the backup designated router (BDR) on the network, reducing network flapping. When setting the wait timer, note the following points:
- The wait timer takes effect only on broadcast and NBMA interfaces.
- The value of the wait timer cannot be greater than the value of the dead timer.
- Configure a neighboring router on the NBMA network.
The interface with the network type of NBMA cannot broadcast Hello packets to discover neighboring routers. Therefore, the IP address of a neighboring router must be configured on the process and whether the neighboring router can participate in DR election must be determined on the process.
- Run commit
The configuration is committed.
Configuring P2MP Network Attributes
To implement OSPF functions, configure P2MP network attributes.
Procedure
- Disable OSPF from checking the network mask.
The OSPF neighbor relationship cannot be established between the devices with different mask lengths on the P2MP network. After OSPF is disabled from checking the network mask, the OSPF neighbor relationship can be properly established.
- (Optional) Configure the device to filter the LSA packets to be sent.
When multiple links exist between two devices, you can configure the local device to filter the LSA packets to be sent. This can reduce unnecessary LSA retransmission attempts and save bandwidth resources.
Verifying the Configuration
After OSPF attributes are set on networks of different types, you can check OSPF neighbor and interface information.
Procedure
- Run the display ospf [ process-id ] interface [ all | no-peer | interface-type interface-number ] [ verbose ] command to check information about OSPF interfaces.
- Run the display ospf [ process-id ] peer command to check information about OSPF neighbors.
- Run the display ospf brief command to check the interval at which Hello packets are sent on an NBMA network.
Adjusting OSPF Route Selection
By adjusting OSPF route selection, you can enable OSPF to meet the requirements of complex networks.
Usage Scenario
In real world situations, you can configure an OSPF route selection rule by setting OSPF route attributes to meet the requirements of complex networks.
- Set the cost of an interface. The link connected to the interface with a smaller cost value preferentially transmits routing information.
- Configure equal-cost routes to implement load balancing.
- Configure a stub router during the maintenance operations such as upgrade to ensure stable data transmission through key routes.
- Suppress interfaces from sending or receiving packets to help select the optimal route.
- Configuring an OSPF interface to automatically adjust the link cost based on link quality that facilitates route selection control and improves network reliability.
Setting the Interface Cost
You can adjust and optimize route selection by setting the OSPF interface cost.
Context
After the OSPF interface costs are set, the interface with a smaller cost value preferentially transmits routing information. This helps select the optimal route.
The OSPF interface cost can be set or calculated based on the interface bandwidth.
External factors may affect the physical bandwidth of links and change the physical bandwidth of interfaces, which in turn affects network performance. To address this problem, you can run the bandwidth bandwidth command in the interface view to set configuration bandwidth for the interface, and then run the bandwidth-config enable command to enable the device to calculate the cost for the OSPF interface based on the configuration bandwidth of the interface.
Procedure
- Manually configure a cost for an OSPF interface.
- Configure bandwidth-based automatic OSPF interface cost calculation.
The calculation formula is as follows:
. The integer of the calculation result is used as the cost of the interface. If the result is less than 1, the cost is 1.Perform the following operations as required:
- To use the bandwidth reference value to determine the interface cost, run the bandwidth-reference command.
- To use the interface bandwidth to determine the interface cost, run the bandwidth command to set configuration bandwidth for an interface, and then run the bandwidth-config enable command to enable the device to calculate the cost for the OSPF interface based on the configuration bandwidth of the interface.
- To use both the bandwidth reference value and interface bandwidth to determine the interface cost, run the preceding three commands.
Configuring Equal-Cost Routes
You can set the number of OSPF equal-cost routes and route preference to implement load balancing and adjust route selection.
Context
If the destinations and costs of the multiple routes discovered by one routing protocol are the same, load balancing can be implemented among the routes.
As shown in Figure 1-1516, three routes between Device A and Device B that run OSPF have the same costs. The three routes are equal-cost routes for load balancing.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run maximum load-balancing number
The maximum number of equal-cost routes is set.
If the number of equal-cost routes is greater than number specified in the maximum load-balancing command, routes are selected for load balancing based on the following criteria:
- Route priority: Routes with smaller priority values are selected for load balancing. For details about route priority configuration, see 4.
- Interface index: If routes have the same priority, those with greater interface index values are selected for load balancing.
- Next hop IP address: If routes have the same priority and interface index, those with larger IP addresses are selected for load balancing.
- (Optional) Run either of the following commands:
To configure a priority for an equal-cost route, run the nexthop ip-address weight value command.
Among equal-cost OSPF routes, those with smaller priority values configured using the nexthop command are selected for load balancing.
- ip-address specifies the next hop address of the equal-cost route.
- value specifies the weight of the next hop.
To configure priorities for the routes with a TE tunnel interface or an IPv4 interface as the outbound interface for route selection if both an IGP-Shortcut-enabled TE tunnel and IP link are available, run the ecmp prefer { te-tunnel | intact } command.
- Run commit
The configuration is committed.
Setting the convergence priority for OSPF routes
You can adjust and optimize route selection by setting the convergence priority for OSPF routes.
Context
To set the convergence priority of OSPF routes based on a specified IP prefix list takes effect on the public network only.
OSPF route calculation, link-state advertisement (LSA) flooding, and LSDB synchronization can be implemented according to the configured priority. Therefore, route convergence can be controlled.
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 enables OSPF to calculate the three types of routes separately according to the specified route calculation priorities. Convergence priorities are critical, high, medium, and low. To speed up the processing of LSAs with the higher priority, during LSA flooding, the LSAs need to be placed into the corresponding critical, high, medium, and low queues according to priorities.
Procedure
- Run system-view
The system view is displayed.
- Run ip ip-prefix ip-prefix-name [ index index-number ] { permit | deny } ipv4-address mask-length [ match-network ] [ greater-equal greater-equal-value ] [ less-equal less-equal-value ] [ description text ]
An IP prefix list is configured.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run prefix-priority { critical | high | medium } ip-prefix ip-prefix-name
The convergence priority for OSPF routes is set.
- Run commit
The configuration is committed.
Configuring a Stub Router
To ensure that a route is not interrupted during flapping-triggering maintenance operations such as upgrade, you can configure a router as a stub router to allow traffic to bypass the route on the stub router.
Context
After a stub router is configured, the route on the stub router will not be preferentially selected. After the route cost is set to the maximum value 65535, traffic generally bypasses the router. This ensures an uninterrupted route on the router during maintenance operations such as upgrade.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run stub-router [ [ on-startup [ interval ] ] | [ include-stub ] | [ external-lsa [ externallsa-metric ] ] | [ summary-lsa [ summarylsa-metric ] ] ] *
A stub router is configured.
The stub router configured in this manner is irrelevant to the router in the stub area.
- (Optional) Run maximum-link-cost cost
The maximum cost is set for OSPF links.
- Run commit
The configuration is committed.
Suppressing an Interface from Receiving and Sending OSPF Packets
After an interface is suppressed from receiving and sending OSPF packets, routing information can bypass a specific router and the local router can reject routing information advertised by another router.
Context
Suppressing an interface from receiving and sending OSPF packets helps routing information to bypass a specific router and enables the local router to reject routing information advertised by another router. This ensures that an optimal route is provided.
For example, there are three routes between Device A and Device B, as shown in Figure 1-1517. To configure the route with the outbound interface of Interface 2 to be the optimal route, suppress Interface 1 and Interface 3 from receiving and sending OSPF packets.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run silent-interface { all | interface-type interface-number }
An interface is suppressed from receiving and sending OSPF packets.
The same interface in different processes can be suppressed from sending and receiving OSPF packets, but the silent-interface command is valid only for the OSPF interface in the local process.
After an OSPF interface is configured to be in the silent state, the interface can still advertise its direct routes. Hello packets on the interface, however, cannot be forwarded. Therefore, no neighbor relationship can be established on the interface. This can enhance the networking adaptability of OSPF and reduce system resource consumption.
- Run commit
The configuration is committed.
Configuring an OSPF Interface to Automatically Adjust the Link Cost
Configuring an OSPF interface to automatically adjust the link cost based on link quality facilitates route selection control and improves network reliability.
Context
A bit error refers to the deviation between a bit that is sent and the bit that is received. The bit error rate (BER) refers to the number of bit errors divided by the total number of bits transferred during a studied time interval. During data transmission, a high BER will degrade or even interrupt services in extreme cases.
To prevent this problem, configure OSPF interfaces to automatically adjust link costs based on link quality so that unreliable links are not used by the optimal routes.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf link-quality low incr-cost { cost | max-reachable }
The OSPF interface is configured to automatically adjust the link cost based on link quality.
The cost parameter specifies the link cost adjustment value. After this parameter is specified:
- If the link quality changes to low, the link cost equals the original link cost plus the adjustment value. The maximum link cost allowed is 65535.
- If the link quality recovers from low, the original link cost applies.
- Run commit
The configuration is committed.
Configuring a Fallback Cost for an Eth-Trunk Interface
A fallback cost of an Eth-Trunk interface helps adjust route selection dynamically.
Context
After an Eth-trunk member interface goes down, the OSPF cost value is automatically adjusted. When an Eth-trunk member interface becomes invalid, the remaining bandwidth may fail to meet user requirements, causing service loss. In this fault scenario, the cost of the Eth-Trunk can be dynamically adjusted to a larger value so that traffic is transmitted through other paths. When the interface bandwidth is less than the fallback bandwidth threshold, the device changes the interface cost to the configured fallback cost in time so that a better transmission path is selected. When the bandwidth of an Eth-Trunk interface is greater than or equal to the configured fallback bandwidth threshold, cost-fallback does not take effect.
Verifying the Configuration
After OSPF route selection is adjusted, you can check OSPF routing table and interface information.
Procedure
- Run the display ospf [ process-id ] interface [ all | no-peer | interface-type interface-number ] [ verbose ] command to check information about OSPF interfaces.
- Run the display ospf [ process-id ] routing command to check information about the OSPF routing table.
- Run the display ospf [ process-id ] ecmp-group command to check information about OSPF ECMP groups
Controlling OSPF Routing Information
You can control the advertising and receiving of OSPF routing information and import routes of other protocols.
Configuring OSPF to Import External Routes
Importing the routes discovered by other routing protocols can enrich OSPF routing information.
Context
To access a router running a non-OSPF protocol, an OSPF-capable router needs to import routes of the non-OSPF protocol into the OSPF network.
OSPF provides loop-free intra-area routes and inter-area routes; however, OSPF cannot prevent external routing loops. Therefore, exercise caution when configuring OSPF to import external routes.
Perform the following steps on the ASBR running OSPF.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run import-route { bgp [ permit-ibgp ] | direct | rip [ process-id-rip ] | static | unr | isis [ process-id-isis ] | ospf [ process-id-ospf ] } [ cost cost | tag tag | type type | route-policy route-policy-name | route-filter route-filter-name ] *
The device is configured to import routes from another protocol.
- (Optional) Run default { cost { cost | inherit-metric } | tag tag | type type } *
The default values of parameters (the cost, number of routes, tag, and type) are set for imported routes.
When OSPF imports external routes, you can set default values for some additional parameters, such as the cost, number of routes to be imported, route tag, and route type. The route tag is used to identify the protocol-related information. For example, it can be used to differentiate AS numbers carried in BGP routes imported by OSPF.
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 priorities.- Run the apply cost command to set the cost of a route.
- Run the import-route command to set the cost of the imported route.
- Run the default command to set the default cost of the imported route.
- (Optional) Run any of the following commands as required:
- Based on a basic ACL:
Run filter-policy { acl-number | acl-name acl-name } export [ direct | static | unr | bgp | { rip | isis | ospf } [ process-id ] ]
The device is configured to filter the routes imported in step 3 so that only the matched routes are advertised.
Run quit
Return to the system view.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
An ACL rule is configured.
When the rule command is used to configure a filtering rule for a named ACL, only the configurations specified by source and time-range take effect.
When a filter-policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route matching the rule will be accepted or advertised by the system.
If the action specified in an ACL rule is deny, a route matching the rule will not be accepted or advertised by the system.
If the network segment of a route is not within the range specified in an ACL rule, the route will not be accepted or advertised by the system.
If an ACL does not contain any rules, none of the routes matched against the filter-policy that uses this ACL will be accepted or advertised by the system.
Routes can be filtered using a blacklist or whitelist:
If ACL rules are used for matching in configuration order, the system matches the rules in ascending order of their IDs.
Filtering using a blacklist: Configure a rule with a smaller ID and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger ID in the same ACL and specify the action permit in this rule to accept or advertise the other routes.
Filtering using a whitelist: Configure a rule with a smaller ID and specify the action permit in this rule to permit the routes to be accepted or advertised. Then, configure another rule with a larger ID in the same ACL and specify the action deny in this rule to filter out the unwanted routes.
- Run ospf [ process-id ]
The OSPF view is displayed.
Based on an IP prefix list:
Run filter-policy ip-prefix ip-prefix-name export [ direct | static | unr | bgp | { rip | isis | ospf } [ process-id ] ]
The device is configured to filter the routes imported in step 3 so that only the matched routes are advertised.
OSPF filters the imported routes. OSPF uses Type 5 LSAs to carry routes that meet the filtering conditions and advertises these Type 5 LSAs.
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 imported routes.
The import-route command cannot be used to import external default routes.
- Based on a basic ACL:
- Run import-route limit limit-number [ threshold-alarm { upper-limit upper-limit-value | lower-limit lower-limit-value } * ]
The maximum number of LSAs generated when OSPF imports routes is set.
If OSPF imports a large number of external routes and advertises them to a device with a small routing table capacity, the device may restart unexpectedly. To address this problem, set a limit on the number of LSAs generated when OSPF imports external routes. You can check the overload status based on the value of the Current status field in the display ospf brief command output.- Normal: The number is less than or equal to the lower alarm threshold.
- Approach limit: The number is approaching (reaching or exceeding 90% of) the upper alarm threshold.
- Exceed limit: The number has reached or exceeded the limit.
Ensure that upper-limit-value is greater than or equal to lower-limit-value.
- Run commit
The configuration is committed.
Configuring OSPF to Import a Default Route
The default route is widely applied on the OSPF network to reduce routing entries in the routing table and filter specific routing information.
Context
On the area border and AS border of an OSPF network generally reside multiple routers for next-hop backup or traffic load balancing. A default route can be configured to reduce routing entries and improve resource usage on the OSPF network.
The default route is generally applied to the following scenarios:
- An ABR in an area advertises Type 3 LSAs carrying the default route within the area. routers in the area use the received default route to forward inter-area packets.
- An ASBR in an AS advertises Type 5 or Type 7 LSAs carrying the default route within the AS. routers in the AS use the received default route to forward AS external packets.
When no exactly matched route is discovered, the router can forward packets through the default route.
The priorities of the default routes corresponding to Type 3 LSAs are higher than those of the routes corresponding to Type 5 or Type 7 LSAs.
The advertising mode of OSPF default routes is determined by the type of the area to which the default routes are imported, as shown in Table 1-625.
Area Type |
Generated By |
Advertised By |
LSA Type |
Flooding Area |
---|---|---|---|---|
Common area |
The default-route-advertise command |
ASBR |
Type 5 LSA |
Common area |
Stub area |
Automatically |
ABR |
Type 3 LSA |
Stub area |
NSSA |
The nssa [ default-route-advertise ] command |
ASBR |
Type 7 LSA |
NSSA |
Automatically |
ABR |
Type 3 LSA |
NSSA |
|
Totally NSSA |
Automatically |
ABR |
Type 3 LSA |
NSSA |
Perform the following steps on the ASBR running OSPF.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run default-route-advertise [ [ always | permit-calculate-other ] | cost cost | type type | { route-policy route-policy-name | route-filter route-filter-name } | distribute-delay delay-time | permit-preference-less-than preference-val ] *
The default route is imported to the OSPF process.
To prevent loops, you are advised to use the permit-preference-less-than parameter to prevent the import of activated default routes with low priorities. This parameter is used only when the always parameter is not specified.
Configure the default route for the NSSA. For details, see Configuring an OSPF NSSA.
- Run commit
The configuration is committed.
Configuring Route Summarization
When a large-scale OSPF network is deployed, you can configure route summarization to reduce routing entries.
Context
Route summarization on a large-scale OSPF network reduces routing entries, minimizes system resource consumption, and maintains system performance. In addition, if a specific link frequently alternates between Up and Down, the links not involved in the route summarization will not be affected, which prevents route flapping and improves network stability.
Configuring OSPF to Filter LSAs in an Area
Filtering LSAs in an area can prevent unnecessary LSA transmission. This reduces the size of the LSDB on the neighboring router and speeds up network convergence.
Context
After filtering conditions are set for the incoming or outgoing Type 3 LSAs (Summary LSAs) in an area, only the Type 3 LSAs that meet the filtering conditions can be received or advertised.
This function is applicable only to the ABR.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run area area-id
The OSPF area view is displayed.
- Filter incoming or outgoing Type 3 LSAs in the area.
Filter outgoing Type 3 LSAs in the area. Run any of the following commands as required:
- Based on the basic ACL:
Run quit
Return to the system view.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
An ACL rule is configured.
When the rule command is used to configure a filtering rule for a named ACL, only the configurations specified by source and time-range take effect.
When a filter-policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route matching the rule will be accepted or advertised by the system.
If the action specified in an ACL rule is deny, a route matching the rule will not be accepted or advertised by the system.
If the network segment of a route is not within the range specified in an ACL rule, the route will not be accepted or advertised by the system.
If an ACL does not contain any rules, none of the routes matched against the filter-policy that uses this ACL will be accepted or advertised by the system.
Routes can be filtered using a blacklist or whitelist:
If ACL rules are used for matching in configuration order, the system matches the rules in ascending order of their IDs.
Filtering using a blacklist: Configure a rule with a smaller ID and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger ID in the same ACL and specify the action permit in this rule to accept or advertise the other routes.
Filtering using a whitelist: Configure a rule with a smaller ID and specify the action permit in this rule to permit the routes to be accepted or advertised. Then, configure another rule with a larger ID in the same ACL and specify the action deny in this rule to filter out the unwanted routes.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run area area-id
The OSPF area view is displayed.
- Run filter { acl-number | acl-name acl-name } export
The outgoing Type 3 LSAs of the local area are filtered based on the basic ACL.
Based on the IP prefix list:
Run filter ip-prefix ip-prefix-name export
Outgoing Type 3 LSAs in the area are filtered based on the IP prefix list.
Based on the route-policy:
Run filter route-policy route-policy-name export
Outgoing Type 3 LSAs in the area are filtered based on the route-policy.
Based on a route-filter:
Run filter route-filter route-filter-name export
Outgoing Type 3 LSAs in the area are filtered based on the route-filter.
- Based on the basic ACL:
Filter incoming Type 3 LSAs in the area. Run any of the following commands as required:
- Based on the basic ACL:
Run quit
Return to the system view.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
An ACL rule is configured.
When the rule command is used to configure a filtering rule for a named ACL, only the configurations specified by source and time-range take effect.
When a filter-policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route matching the rule will be accepted or advertised by the system.
If the action specified in an ACL rule is deny, a route matching the rule will not be accepted or advertised by the system.
If the network segment of a route is not within the range specified in an ACL rule, the route will not be accepted or advertised by the system.
If an ACL does not contain any rules, none of the routes matched against the filter-policy that uses this ACL will be accepted or advertised by the system.
Routes can be filtered using a blacklist or whitelist:
If ACL rules are used for matching in configuration order, the system matches the rules in ascending order of their IDs.
Filtering using a blacklist: Configure a rule with a smaller ID and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger ID in the same ACL and specify the action permit in this rule to accept or advertise the other routes.
Filtering using a whitelist: Configure a rule with a smaller ID and specify the action permit in this rule to permit the routes to be accepted or advertised. Then, configure another rule with a larger ID in the same ACL and specify the action deny in this rule to filter out the unwanted routes.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run area area-id
The OSPF area view is displayed.
Run filter { acl-number | acl-name acl-name } import [ include-abr-summary ]
Incoming Type 3 LSAs in the area are filtered based on the basic ACL.
Based on the IP prefix list:
Run filter ip-prefix ip-prefix-name import [ include-abr-summary ]
Incoming Type 3 LSAs in the area are filtered based on the IP prefix list.
Based on the route-policy:
Run filter route-policy route-policy-name import [ include-abr-summary ]
Incoming Type 3 LSAs in the area are filtered based on the route-policy.
Based on the XPL route-filter:
Run filter route-filter route-filter-name import [ include-abr-summary ]
Incoming Type 3 LSAs in the area are filtered based on the route-filter.
- Based on the basic ACL:
- Run commit
The configuration is committed.
Configuring OSPF to Filter LSAs to Be Sent
Filtering the LSAs to be sent on the local router can prevent unnecessary LSA transmission. This reduces the size of the LSDB on the neighboring device and speeds up network convergence.
Context
When multiple links exist between two devices, you can configure the local device to filter the LSAs to be sent. This prevents unnecessary LSA transmission and saves bandwidth resources.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Based on the basic ACL:
Run quit
Return to the system view.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
An ACL rule is configured.
When the rule command is used to configure a filtering rule for a named ACL, only the configurations specified by source and time-range take effect.
When a filter-policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route matching the rule will be accepted or advertised by the system.
If the action specified in an ACL rule is deny, a route matching the rule will not be accepted or advertised by the system.
If the network segment of a route is not within the range specified in an ACL rule, the route will not be accepted or advertised by the system.
If an ACL does not contain any rules, none of the routes matched against the filter-policy that uses this ACL will be accepted or advertised by the system.
Routes can be filtered using a blacklist or whitelist:
If ACL rules are used for matching in configuration order, the system matches the rules in ascending order of their IDs.
Filtering using a blacklist: Configure a rule with a smaller ID and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger ID in the same ACL and specify the action permit in this rule to accept or advertise the other routes.
Filtering using a whitelist: Configure a rule with a smaller ID and specify the action permit in this rule to permit the routes to be accepted or advertised. Then, configure another rule with a larger ID in the same ACL and specify the action deny in this rule to filter out the unwanted routes.
- Run quit
Return to the system view.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf filter-lsa-out { all | { summary [ acl { acl-number | acl-name } ] | ase [ acl { acl-number | acl-name } ] | nssa [ acl { acl-number | acl-name } ] } * }
The OSPF interface is enabled to filter outgoing LSAs.
- Run commit
The configuration is committed.
Configuring OSPF to Filter Received Routes
After a filtering policy is configured for the OSPF routes that need to be delivered to the routing management module, only the routes that match the policy will be added to the routing table.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run any of the following commands as required:
- Based on the basic ACL:
Run quit
Return to the system view.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
An ACL rule is configured.
When the rule command is used to configure a filtering rule for a named ACL, only the configurations specified by source and time-range take effect.
When a filter-policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route matching the rule will be accepted or advertised by the system.
If the action specified in an ACL rule is deny, a route matching the rule will not be accepted or advertised by the system.
If the network segment of a route is not within the range specified in an ACL rule, the route will not be accepted or advertised by the system.
If an ACL does not contain any rules, none of the routes matched against the filter-policy that uses this ACL will be accepted or advertised by the system.
Routes can be filtered using a blacklist or whitelist:
If ACL rules are used for matching in configuration order, the system matches the rules in ascending order of their IDs.
Filtering using a blacklist: Configure a rule with a smaller ID and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger ID in the same ACL and specify the action permit in this rule to accept or advertise the other routes.
Filtering using a whitelist: Configure a rule with a smaller ID and specify the action permit in this rule to permit the routes to be accepted or advertised. Then, configure another rule with a larger ID in the same ACL and specify the action deny in this rule to filter out the unwanted routes.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run filter-policy { acl-number | acl-name acl-name } import
An import policy is configured to filter received routes.
Based on the IP prefix list:
Run filter-policy ip-prefix ip-prefix-name import
An import policy is configured to filter received routes.
Based on the route-policy:
Run filter-policy route-policy route-policy-name [ secondary ] import
An import policy is configured to filter received routes.
Based on the route-filter:
Run filter-policy route-filter route-filter-name [ secondary ] import
An import policy is configured to filter received routes.
OSPF is a link-state dynamic routing protocol, with routing information carried in the link status advertisement (LSA). Therefore, the filter-policy import command cannot be used to filter the advertised or received LSAs. The filter-policy import command is used to filter the routes calculated by OSPF. Only the routes that match the filtering rules are added to the routing table and can be advertised. Routes that do not match the filtering rules can be added to the OSPF routing table but not to the routing information base (RIB) and cannot be advertised.
- Based on the basic ACL:
- Run commit
The configuration is committed.
Configuring OSPF to Filter the Routes to Be Advertised
After a filtering policy is configured for routes imported by OSPF, only the routes that match the policy can be advertised.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Set the conditions to filter routes to be advertised.
Run any of the following commands as required:
- Based on a basic ACL:
Run quit
Return to the system view.
Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The basic ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
A rule for the basic ACL is configured.
When the rule command is run to configure rules for a named ACL, only the source address range specified by source and the time period specified by time-range are valid as the rules.
When a filtering policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route that matches the rule will be received or advertised by the system.
If the action specified in an ACL rule is deny, a route that matches the rule will not be received or advertised by the system.
If a route has not matched any ACL rules, the route will not be received or advertised by the system.
If an ACL does not contain any rules, all routes matching the route-policy that references the ACL will not be received or advertised by the system.
In the configuration order, the system first matches a route with a rule that has a smaller number and then matches the route with a rule with a larger number. Routes can be filtered using a blacklist or a whitelist:
Route filtering using a blacklist: Configure a rule with a smaller number and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger number in the same ACL and specify the action permit in this rule to receive or advertise the other routes.
Route filtering using a whitelist: Configure a rule with a smaller number and specify the action permit in this rule to permit the routes to be received or advertised by the system. Then, configure another rule with a larger number in the same ACL and specify the action deny in this rule to filter out unwanted routes.
- Run ospf [ process-id ]
The OSPF view is displayed.
Run filter-policy { acl-number | acl-name acl-name } export [ direct | static | unr | bgp | { rip | isis | ospf } [ process-id ] ]
An export policy that is based on the basic ACL is configured for OSPF to filter imported routes to be advertised.
Based on an IP prefix list:
Run filter-policy ip-prefix ip-prefix-name export [ direct | static | unr | bgp | { rip | isis | ospf } [ process-id ] ]
An export policy that is based on the IP prefix list is configured for OSPF to filter imported routes to be advertised.
Based on a route-policy:
Run filter-policy route-policy route-policy-name export [ direct | static | unr | bgp | { rip | isis | ospf } [ process-id ] ]
An export policy that is based on the route-policy is configured for OSPF to filter imported routes to be advertised.
- Based on a basic ACL:
- Run commit
The configuration is committed.
(Optional) Configuring OSPF to Discard Specified LSAs
Context
OSPF can be configured to discard specified LSAs in the following scenarios:
- When devices on the entire network restart repeatedly due to abnormal LSAs and you have located the LSA that causes protocol restarts, you can configure this function as a last resort to prevent the device from restarting continuously. However, if this function is incorrectly configured, routing loops may occur.
- If an LSA is identified as an attack packet, which is not supposed to appear in the local area, and has caused serious problems, such as device restarts, you can configure this function to filter out the LSA under the condition that the attack source cannot be located temporarily and that the LSA does not affect topology path computation.
- If an LSA is identified as an attack packet, which is not supposed to appear in the local area, and it affects topology path computation and has caused serious problems, such as network-wide device restarts, you can configure this function on each device to discard the LSA to prevent it from participating in network-wide calculation.
To filter out the LSA that affects topology path computation, you must ensure that it is removed from all the LSDBs on the entire network. Otherwise, routing loops may occur.
- If an LSA is identified as an unreachable residual LSA and the device that advertised the LSA becomes permanently unreachable, you can configure this function to filter out the LSA upon reception under the condition that the LSA does not affect topology path computation.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run ignore-receive-lsa advertise-router adv-rtr-id [ lsa-type type-value [ area { area-id | area-idipv4 } ] | link-state-id ls-id ] *
The device is configured to discard LSAs of a specified type.
If this command is incorrectly configured, services cannot be restored even if the undo ignore-receive-lsa advertise-router adv-rtr-id [ lsa-type type-value [ area { area-id | area-idipv4 } ] | link-state-id ls-id ] * command is run. In this case, you may need to reset the process or neighbor to restore services.
You are not advised to run this command to filter out the LSAs that exist on the network as running this command may filter out normal LSAs.
As an attack LSA can have any key, it is difficult to defend against the LSA using this command. Therefore, you are advised to directly isolate the attack source.
This command cannot be used to defend against attacks as it goes against protocol processing rules and affects services. Therefore, exercise caution when running this command.
If the fault is caused by a bug, you are advised to run this command temporarily. After the patch is installed, run the undo ignore-receive-lsa advertise-router adv-rtr-id [ lsa-type type-value [ area { area-id | area-idipv4 } ] | link-state-id ls-id ] * command immediately and check whether services are affected. If services are affected, re-establish all neighbor relationships to restore services.
- Run commit
The configuration is committed.
Configuring the Maximum Number of External Routes Supported by the OSPF LSDB
You can set the maximum number of external routes in the LDSB to keep a proper number of external routes.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run lsdb-overflow-limit number
If the number of external routes imported by OSPF exceeds the maximum number allowed by the LSDB, the device deletes self-generated non-default external routes to ensure proper forwarding of the other external routes imported by OSPF.
- Run commit
The configuration is committed.
Adjusting the OSPF Network Convergence Speed
By adjusting OSPF timers, you can implement OSPF network convergence speed.
Setting the Interval at Which Hello Packets Are Sent
You can adjust the value of the Hello timer to change the speed of the OSPF neighbor relationship establishment and change the network convergence speed.
Context
Hello packets are periodically sent between OSPF interfaces to establish and maintain neighbor relationships. The intervals set on the interfaces at both ends must be the same. Otherwise, the OSPF neighbor relationship cannot be established.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The OSPF interface view is displayed.
- Run ospf timer hello interval [ conservative ]
The interval at which Hello packets are sent is set on the interface.
The conservative parameter indicates that the conservative mode is enabled for the neighbor dead timer. If the conservative mode is enabled, the value configured for the dead timer using the ospf timer dead command takes effect even when the value is less than 10s.
To speed up OSPF convergence in the case of a link failure, configuring BFD for OSPF is recommended. If the remote end does not support BFD for OSPF or the user does not want to have BFD for OSPF enabled, you are advised to specify conservative when running the ospf timer dead command. In conservative mode, the value set for the dead timer using the ospf timer dead command takes effect even if the value is less than 10 seconds; otherwise, route convergence is performed based on the OSPF neighbor dead timer, which takes a long time and has a great impact on services.
This interval must not be less than the time taken to perform an active/standby switchover. Otherwise, an intermittent protocol interruption may occur during a switchover. The default timer value is recommended.
- Run commit
The configuration is committed.
Setting the Delay for Transmitting LSAs on an Interface
This configuration is important for low-speed networks.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The OSPF interface view is displayed.
- Run the ospf trans-delay delayvalue command to set the delay for the interface to transmit LSAs.
The LSAs in the LSDB of the local device age with time (increase by 1 each second), but not during transmission. Therefore, an LSA transmission delay needs to be set before LSAs are sent.
- Run commit
The configuration is committed.
Setting the Dead Time of an OSPF Neighbor
If no Hello packet is received from a neighbor within a dead interval, the neighbor is considered Down.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The OSPF interface view is displayed.
- Run ospf timer dead interval
A dead timer is set for OSPF neighbor relationships.
If the dead timer is shorter than 10s, the neighbor relationship may be torn down. To prevent this issue, the dead timer of 10 seconds takes effect if the value of dead interval configured for OSPF neighbor relationships is less than 10 seconds. However, if the ospf timer hello command is run, the conservative parameter is specified to enable the conservative mode for the neighbor dead timer, and the configured dead timer is less than 10s, the system still uses the configured value to determine whether a neighbor is down.
Changing the network type will restore both the Hello timer and dead timer to their default values.
- Run commit
The configuration is committed.
Configuring OSPF Sham Hello
With OSPF sham hello, device can exchange Hello and LSU and LSAck packets to maintain OSPF neighbor relationships, which strengthens the neighbor detection mechanism.
Configuring Smart-discover
After Smart-discover is configured, when the neighbor status changes or the DR or BDR on the multiple-access network (broadcast network or NBMA network) changes, the local router sends Hello packets to its neighbor immediately without waiting for the Hello timer to expire.
Context
Without Smart-discover, when the neighbor status of the router changes or the DR/BDR on the multiple-access network (broadcast or NBMA network) changes, the router does not send Hello packets to its neighbor until the Hello timer expires; after Smart-discover is configured, the router sends Hello packets to its neighbor immediately without waiting for the Hello timer to expire, which speeds up the neighbor relationship establishment and OSPF network convergence.
Setting the Interval at Which LSAs Are Updated
You can set the interval at which LSAs are updated based on network connections and router resources.
Context
OSPF sets the interval for updating LSAs to 5s. This prevents network connections or route flapping from consuming excessive network bandwidth or device resources. On a stable network that requires fast route convergence, you can set the interval for updating LSAs to 0 seconds. In this manner, when the topology or a route changes, the change can be immediately advertised to the network through LSAs. This speeds up route convergence on the network. On an unstable network, routes are calculated frequently, consuming excessive CPU resources. In addition, LSAs that describe the unstable topology are frequently generated and transmitted on the unstable network. Due to the frequent processing of such LSAs, the entire network cannot become stable quickly. You can configure an intelligent timer so that the device can dynamically adjust the interval based on the user configuration and frequency of triggering events (such as route calculation) to quickly stabilize the network.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run lsa-originate-interval { 0 | intelligent-timer max-interval start-interval hold-interval [ other-type interval ] | other-type interval [ intelligent-timer max-interval start-interval hold-interval ] }
The interval at which LSAs are updated is configured.
- intelligent-timer: uses the intelligent timer to set the update interval for OSPF Type 1 LSAs (router LSAs) and Type 2 LSAs (network LSAs).
- max-interval: specifies the maximum interval at which OSPF LSAs are updated, in milliseconds.
- start-interval: specifies the initial interval at which OSPF LSAs are updated, in milliseconds.
- hold-interval: specifies the hold interval at which OSPF LSAs are updated, in milliseconds.
- other-type: sets the update interval for OSPF Type 3 LSAs (network-summary-LSAs), Type 4 LSAs (ASBR-summary-LSAs), and Type 10 LSAs (opaque LSAs).
The interval for updating LSAs is as follows:- The initial interval at which LSAs are updated is specified by start-interval.
- The interval at which LSAs are updated for the nth (n ≥ 2) time equals hold-interval x 2(n – 2).
- When the interval specified by hold-interval x 2(n – 2) reaches the maximum interval specified by max-interval, OSPF updates LSAs at the maximum interval for three consecutive times. Then, OSPF updates LSAs at the initial interval specified by start-interval.
- (Optional) Run lsa-originate-interval suppress-flapping suppress-interval [ threshold threshold ]
The suppression period that takes effect when the OSPF LSAs to be sent flap is configured.
If no flapping occurs among the OSPF LSAs to be sent, the configuration of the lsa-originate-interval command prevents the device from frequently sending LSAs. If the OSPF LSAs to be sent flap, the configuration of the lsa-originate-interval suppress-flapping command reduces the impact of the flapping on services. The larger value of the two intervals is used as the suppression period.
- Run commit
The configuration is committed.
Setting the Interval at Which LSAs Are Received
You can set the interval at which LSAs are received based on network connections and router resources.
Context
In OSPF, the defined interval at which LSAs are received is 1s. This aims to prevent network connections or frequent route flapping from consuming excessive network bandwidth or device resources.
On a stable network that requires fast route convergence, you can cancel the interval at which LSAs are received by setting the interval to 0s. After the interval is set to 0s, topology or route changes can be immediately advertised on the network through LSAs, which speeds up route convergence.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run lsa-arrival-interval { interval | intelligent-timer max-interval start-interval hold-interval }
The interval at which LSAs are received is set.
- interval: specifies the interval at which LSAs are received, in milliseconds.
- intelligent-timer: uses the intelligent timer to set the interval at which OSPF router LSAs and network LSAs are updated.
- max-interval: specifies the maximum interval at which OSPF LSAs are received, in milliseconds.
- start-interval: specifies the initial interval at which OSPF LSAs are received, in milliseconds.
- hold-interval: specifies the hold interval at which OSPF LSAs are received, in milliseconds.
The maximum interval for receiving LSAs is as follows:- The initial interval at which LSAs are received is specified by start-interval.
- The interval at which LSAs are received for the nth (n ≥ 2) time equals hold-interval x 2(n – 1).
- When the interval specified by hold-interval x 2(n – 1) reaches the maximum interval specified by max-interval, OSPF receives LSAs at the maximum interval for three consecutive times. Then, OSPF returns to 3.a and receives LSAs at the initial interval specified by start-interval.
- (Optional) Run lsa-arrival-interval suppress-flapping suppress-interval [ threshold threshold ]
The suppression period that takes effect when received OSPF LSAs flap is configured.
If no flapping occurs among received OSPF LSAs, the configuration of the lsa-arrival-interval command prevents the device from frequently receiving LSAs. If received OSPF LSAs flap, the configuration of the lsa-arrival-interval suppress-flapping command reduces the impact of the flapping on services. The larger value of the two intervals is used as the suppression period.
- Run commit
The configuration is committed.
Setting the Interval for the SPF Calculation
By setting the interval for the SPF calculation, you can save resources consumed by frequent network changes.
Context
When the OSPF LSDB changes, the shortest path needs to be recalculated. If a network changes frequently, the shortest path is calculated accordingly, which consumes a large number of system resources degrades system performance. By configuring an intelligent timer and a proper interval for the SPF calculation, you can prevent excessive system memory and bandwidth resources from being occupied.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run spf-schedule-interval { interval1 | intelligent-timer max-interval start-interval hold-interval [ conservative ] | millisecond interval2 }
The interval for SPF calculation is set.
The interval for SPF calculation based on the intelligent timer is described as follows:- The initial interval for SPF calculation is specified by start-interval.
- The interval for SPF calculation for the nth (n ≥ 2) time equals hold-interval x 2(n – 2).
- After the interval specified by hold-interval x 2(n – 2) reaches the maximum interval specified by max-interval, OSPF keeps using the maximum interval for SPF calculation.
If no flapping occurs during the interval from the end of the last SPF calculation to the start of the next SPF calculation, and the interval exceeds the maximum interval specified by max-interval, the intelligent timer exits.
If no flapping occurs in the previous interval but occurs in the current interval, SPF calculation is delayed for a period of start-interval. After the SPF calculation is complete, the current interval will be applied when waiting for the next SPF calculation.
- Run commit
The configuration is committed.
Configuring the Function to Suppress the Advertisement of Interface Addresses
This section describes how to configure the function to suppress the advertisement of interface addresses so that interface addresses can be reused.
Configuring the Route Calculation Delay Function to Suppress Frequent LSA Flapping
A route calculation delay can suppress frequent OSPF LSA flapping.
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.
Disabling Active/Standby Board Switching Triggered by Abnormal OSPF Aging
By default, active/standby board switching triggered by abnormal OSPF aging is enabled. To disable this function, perform this task.
Context
When the local device's aging timer expires, the local device incorrectly clears all Router LSAs received from the peer device, which causes large-scale route flapping and service interruptions. To resolve this issue, active/standby board switching triggered by abnormal OSPF aging is automatically enabled. Such 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)
Disabling OSPF LSA Aging Management
By default, the OSPF LSA aging management function is enabled. To disable this function, perform this task.
Context
LSAs are aged out if their LS age field encounters an exception, and this may cause LSA flapping or incorrect route calculation. For example, the actual LSA aging time of a device is 500 seconds and the device receives an LSA with the aging time of 2500 seconds, the LSA is aged too early because LSAs automatically age in 3600 seconds according to the protocol mechanism. To address this issue, the OSPF LSA aging management function is enabled by default. If the aging time in a received LSA is longer than 1800 seconds, OSPF considers the LSA abnormal and changes the aging time to 1700 seconds. This operation is performed for each abnormal LSA until the aging time values of all LSAs in the area are the same. This ensures that routes can be calculated correctly.
Setting a Period During Which OSPF Keeps the Maximum Cost in Local LSAs
If a period during which OSPF keeps the maximum cost in local LSAs is configured and an OSPF interface changes from Down to Up, traffic is switched back only when the period elapses.
Context
When an OSPF interface changes from down to up, the OSPF neighbor relationship is re-established. After IGP route convergence is completed, traffic is switched back. In most cases, IGP routes converge quickly. However, many services that depend on IGP routes may require a delayed switchback. In this case, you can run the ospf peer hold-max-cost command to specify a period during which OSPF keeps the maximum cost in local LSAs. After the OSPF neighbor relationship reaches the Full state, the traffic forwarding path remains unchanged during the specified period. After this period expires, the normal cost is restored, and traffic is switched back normally.
Configuring Secure Synchronization
Secure synchronization prevents traffic loss after a device is restarted.
Context
When the routers in an area just finish synchronizing the LSDBs, the LSDBs of these routers 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 neighbor relationship.
Configuring OSPF Delay Advertisement
With OSPF delay advertisement, intra-domain link delay information can be collected and flooded.
Usage Scenario
Traditional path computation algorithms compute the optimal path to a destination address based on costs. However, the path computed in this way may not have the minimum delay. For services that have stringent requirements on delay, path computation can be performed based on the delay rather than on the cost to ensure that service traffic is transmitted along the path with the minimum delay. After OSPF delay advertisement is configured, OSPF collects and floods intra-domain link delay information and reports the information to the controller through BGP-LS. The controller then computes paths on the P2P network based on delay constraints.
Pre-configuration Tasks
- Configure the TWAMP Light controller to detect delay information.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
An OSPF process is created, and the OSPF view is displayed.
process-id specifies an OSPF process. If the process-id parameter is not specified, the system creates process 1 by default.
- Run opaque-capability enable
The Opaque capability is enabled on the device.
- Run metric-delay advertisement enable
Delay advertisement is enabled.
- Run commit
The configuration is committed.
Configuring OSPF Neighbor Relationship Flapping Suppression
OSPF neighbor relationship flapping suppression works by delaying OSPF neighbor relationship reestablishment or setting the link cost to the maximum value.
Usage Scenario
If an interface carrying OSPF services alternates between Up and Down, OSPF neighbor relationship flapping occurs on the interface. During the flapping, OSPF frequently sends Hello packets to reestablish the neighbor relationship, synchronizes LSDBs, and recalculates routes. In this process, a large number of packets are exchanged, adversely affecting neighbor relationship stability, OSPF services, and other OSPF-dependent services, such as LDP and BGP. OSPF neighbor relationship flapping suppression can address this problem by delaying OSPF neighbor relationship reestablishment or preventing service traffic from passing through flapping links.
The following steps are optional, choose them as required.
Pre-configuration Tasks
Before configuring OSPF neighbor relationship flapping suppression, complete the following tasks:
- Configure an IP address for each interface to ensure that neighboring routers are reachable at the network layer.
- Configure basic OSPF functions.
Procedure
- Run system-view
The system view is displayed.
To disable the function globally, run the suppress-flapping peer disable command.
- Run interface interface-type interface-number
The interface view is displayed.
To disable OSPF neighbor relationship flapping suppression from one of the interfaces, run the ospf suppress-flapping peer disable command.
- Run ospf suppress-flapping peer hold-down interval
The Hold-down mode and its duration are configured.
OSPF neighbor relationship flapping suppression works in either Hold-down or Hold-max-cost mode.
Hold-down mode: In the case of frequent flooding and topology changes during neighbor relationship establishment, interfaces prevent neighbor relationship reestablishment during Hold-down suppression, which minimizes LSDB synchronization attempts and packet exchanges.
Hold-max-cost mode: If the traffic forwarding path changes frequently, interfaces use 65535 as the cost of the flapping link during Hold-max-cost suppression, which prevents traffic from passing through the flapping link.
To change the maximum cost for OSPF links, run the maximum-link-cost cost command.
The Hold-down and Hold-max-cost modes can work together. When both modes take effect, the device first enters the Hold-down mode. After exiting the Hold-down mode, the device enters the Hold-max-cost mode.
To disable the Hold-max-cost mode, run the ospf suppress-flapping peer hold-max-cost disable command.
- Run ospf suppress-flapping peer { detecting-interval detecting-interval | threshold threshold | resume-interval resume-interval } *
Detection parameters are configured for OSPF neighbor relationship flapping suppression.
Configure a threshold for exiting OSPF neighbor relationship flapping suppression.
If the interval between two successive neighbor relationship state changes from Full to a non-Full state is longer than the resume-interval, the flapping_count is reset.
- If OSPF neighbor relationship flapping suppression works in Hold-max-cost mode, the value of resume-interval indicates the duration of this mode.
The value of resume-interval must be greater than that of detecting-interval.
You can configure detection parameters for OSPF neighbor relationship flapping suppression on specific interfaces according to network conditions. However, using the default values of these parameters is recommended.
- Run quit
The system view is displayed.
- Run quit
The user view is displayed.
- Run reset ospf process-id suppress-flapping peer [ interface-type interface-number ] [ notify-peer ]
Interfaces are forced to exit OSPF neighbor relationship flapping suppression.
Interfaces exit flapping suppression in the following scenarios:
- The suppression timer expires.
- The corresponding OSPF process is reset.
- An OSPF neighbor is reset using the reset ospf peer command.
- OSPF neighbor relationship flapping suppression is disabled globally using the suppress-flapping peer disable command in the OSPF view.
- The reset ospf suppress-flapping peer command is run.
- Run commit
The configuration is committed.
Disabling OSPF Interface Flapping Suppression
OSPF interface flapping suppression is globally enabled by default. If this function is not needed, you can disable it.
Usage Scenario
If OSPF interfaces frequently alternate between up and down, the interfaces will flap, and protocol packets will be frequently exchanged, affecting OSPF services and other services relying on OSPF. Interface flapping suppression can address this issue. This function allows a device to delay interface state changes to up. If this function is not needed, you can disable it.
Pre-configuration Tasks
Before configuring OSPF interface flapping suppression, configure basic OSPF functions.
Configuring Routing Loop Detection for Routes Imported into OSPF
Usage Scenario
Routing loops may occur when an OSPF process imports routes. If routing loop detection is enabled for routes imported into OSPF on a device and this device detects that it imports a route advertised by itself, it sends this route with a large link cost to other devices. After receiving this route, these devices preferentially select other paths, thereby preventing routing loops.
Procedure
- Run system-view
The system view is displayed.
- (Optional) Run clear route loop-detect ospf alarm-state
Exit the routing loop detection alarm state and the related alarms are cleared.
If the device detects an OSPF routing loop, it reports an alarm. Because the device cannot automatically detect whether the routing loop is eliminated, you need to run this command after the routing loop is eliminated to prevent the device from advertising a large link cost for imported routes and manually clear the OSPF routing loop alarm.
- Run route loop-detect ospf enable
The routing loop detection for routes imported to OSPF is enabled.
To reduce the impact of routing loops on services, you are advised to keep routing loop detection enabled for routes imported to OSPF.
- Run commit
The configuration is committed.
Configuring OSPF Flush LSA Source Tracing
OSPF flush LSA source tracing helps improve the efficiency in locating the devices that flushed OSPF LSAs.
Usage Scenario
If network-wide OSPF LSPs are deleted, purge LSPs are flooded, which adversely affects network stability. In this case, source tracing must be implemented to locate the root cause of the fault immediately to minimize the impact. However, OSPF itself does not support source tracing. A conventional solution is isolation node by node until the faulty node is located, but the solution is complex and time-consuming. To address this problem, enable OSPF flush source tracing.
The following steps are optional, choose them as required.
Pre-configuration Tasks
Before configuring OSPF flush LSA source tracing, complete the following task:
- Configure an IP address for each interface to ensure that neighboring routers are reachable at the network layer.
- Configure basic OSPF functions.
Procedure
- Run system-view
The system view is displayed.
To disable OSPF flush LSA source tracing globally, run the ospf flush-source-trace disable command.
- Run interface interface-type interface-number
The interface view is displayed.
To disable OSPF flush LSA source tracing on an interface, run the ospf flush-source-trace block command.
- Run quit
The system view is displayed.
- Run ospf flush-source-trace port port-number
A UDP port number is configured for OSPF flush source tracing packets.
An OSPF flush source tracing port is used to send and receive OSPF flush source tracing packets and is represented by a UDP port number.
- Run quit
The user view is displayed.
- Run reset ospf process-id flush-source-trace
OSPF flush source tracing is reset.
If a large number of OSPF flush source tracing statistics exist on a device, you can run the reset ospf flush-source-trace command to reset the statistics and restart OSPF flush source tracing. If the command is run, all dynamic source tracing statistics are deleted, and the device needs to re-negotiate the source tracing capability with neighboring devices.
- Run commit
The configuration is committed.
Configuring an OSPF Hostname
Compared with router IDs, OSPF hostnames are easier to memorize. Therefore, using hostnames to identify routers can facilitate network management.
Usage Scenario
To facilitate network management, configure hostnames to identify routers.
Either dynamic or static OSPF hostnames can be configured. In dynamic mode, a hostname can be configured on and advertised by the local device. The mapping between the local device's router ID and hostname can then be queried on a remote router that successfully learns this dynamic hostname.
Pre-configuration Tasks
Before configuring a hostname, complete the following tasks:
- Configure an IP address for each interface to ensure that neighboring routers can use the IP addresses to communicate with each other.
- Configure basic OSPF functions.
Checking the Configurations
Run either of the following commands to check dynamic OSPF hostnames:
- display ospf [ process-id ] hostname-table
- display ospf [ process-id ] lsdb [ router | network | summary | asbr | ase | nssa | opaque-link | opaque-area ] [ link-state-id ] [ originate-router [ advertising-router-id ] | self-originate | hostname hostname ] [ age { min-value min-age-value | max-value max-age-value } * ]
- display ospf [ process-id ] lsdb [ router | network | summary | asbr | ase | nssa | opaque-link | opaque-area ] [ link-state-id ] [ originate-router [ advertising-router-id ] | self-originate ] [ age { min-value min-age-value | max-value max-age-value } * ] [ resolve-hostname ]
Configuring an OSPF Stub Area
Configuring a non-backbone area as a stub area can reduce routing entries in the area in an AS does not transmit routes learned from other areas in the AS or AS external routes. This reduces bandwidth and storage resource consumption.
Applicable Environment
The number of LSAs can be reduced by partitioning an AS into different areas. To reduce the number of entries in the routing table and the number of LSAs to be transmitted in a non-backbone area, configure the non-backbone area on the border of the AS as a stub area.
Configuring a stub area is optional. A stub area generally resides on the border of an AS. For example, a non-backbone area with only one ABR can be configured as a stub area. In a stub area, the number of entries in the routing table and the amount of routing information to be transmitted greatly decrease.
Note the following points when configuring a stub area:
- The backbone area (Area 0) cannot be configured as a stub area.
- If an area needs to be configured as a stub area, all the routers in this area must be configured with stub attributes using the stub command.
- An ASBR cannot exist in a stub area. External routes are not transmitted in the stub area.
- Virtual links cannot exist in the stub area.
Pre-configuration Tasks
Before configuring a stub area, complete the following tasks:
Configuring IP addresses for interfaces to ensure that neighboring routers are reachable at the network layer
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run area area-id
The OSPF area view is displayed.
- Run stub
The specified area is configured as a stub area.
- All routers in a stub area must have the stub command configuration.
- Running the stub command or canceling the configuration may cause the stub area to be updated. The stub command configuration on a device can be canceled or the configuration can be performed on new devices in the stub area only after the last area update is complete.
- (Optional) Run stub no-summary
The ABR is prevented from sending Type 3 LSAs to the stub area.
- (Optional) Run stub default-route-advertise backbone-peer-ignore
The ABR is prevented from checking the neighbor status when it generates a default Type 3 LSA and advertises it to the stub area.
- (Optional) Run default-cost cost
A cost is set for the default route advertised to the stub area.
To ensure the reachability of AS external routes, the ABR in the stub area generates a default route and advertises it to non-ABR routers in the stub area.
- Run commit
The configuration is committed.
Verifying the Configuration
After configuring the stub area, verify the configuration.
Run the display ospf [ process-id ] lsdb command to check OSPF LSDB information.
Run the display ospf [ process-id ] peer command to check information about OSPF neighbors.
Run the display ospf [ process-id ] routing command to check information about the OSPF routing table.
When routers are in a common area, there are AS external routes in the routing table. After the area where the router resides is configured as a stub area, AS external routes no longer exist in the routing table, and the ASE field is displayed as 0 in the command output.
Configuring an NSSA
Configuring a non-backbone area on the border of an AS as an NSSA can reduce entries in the routing table and the amount of routing information to be transmitted. This section describes how to set the cost of the default route to an NSSA and adjust the selection of the default route.
Usage Scenario
An excessive number of entries in a routing table wastes network resources and causes high 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 Configuring an OSPF Stub Area.
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 where it resides. Different from the stub area, the NSSA allows AS external routes to be imported and forwarded in the entire AS.
If you want to import AS external routes to an area and prevent these routes from consuming resources, configure the area as an NSSA.
Type 7 link state advertisements (LSAs) are used to carry imported AS external routes in the NSSA. Type 7 LSAs are generated by ASBRs of NSSAs and flooded only in the NSSAs where ASBRs reside. The 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.
- A Type 7 LSA was introduced to support NSSAs and describe imported external routes.
- Type 7 LSAs can be used to carry default route to transmit traffic to other ASs.
To configure an area as an NSSA, configure NSSA attributes on all the routers in this area.
Pre-configuration Tasks
Before configuring an NSSA, complete the following tasks:
- Configure IP addresses for interfaces to ensure that neighboring routers are reachable at the network layer.
- Configure basic OSPF functions.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run area area-id
The OSPF area view is displayed.
- 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 ] *
The area is configured as an NSSA.
- NSSA attributes must be configured on all routers in the NSSA using the nssa command.
- Configuring or deleting NSSA attributes may trigger routing update in the area and disconnection from neighbors. The NSSA attributes can be reconfigured or re-canceled only after the routing update is complete.
The nssa command is applicable to the following scenarios:
Default Type 7 LSAs are generated and advertised to an NSSA.
- OSPF neighbor relationships that are in the Full state and interfaces that are Up exist in the backbone area.
- The default-route-advertise parameter is configured.
- Other default routes destined for 0.0.0.0 exist in the local routing table.
If condition 1 is met, ABRs generate default Type 7 LSAs and advertise them to the NSSA. If conditions 2 and 3 are met, ASBRs generate default Type 7 LSAs and advertise them to the NSSA.
The parameter backbone-peer-ignore is used to prevent the ABR from checking the neighbor status when the ABR generates default Type 7 LSAs and advertises them to the NSSA. Specifically, the ABR generates default Type 7 LSAs and advertises them to the NSSA as long as an interface that is Up exist in the backbone area.
- An ASBR also functions as an ABR, and the no-import-route parameter is configured to prevent external routes imported using the import-route command from being advertised to the NSSA.
- The no-summary parameter is configured on an ABR to reduce the number of LSAs to be transmitted to the NSSA, which prevents the ABR from transmitting Type 3 LSAs to the NSSA.
After the nssa default-route-advertise backbone-peer-ignore no-summary command is run, the ABR generates default Type 7 and Type 3 LSAs as long as an interface that is Up exist in the backbone area. The default Type 3 LSAs preferentially take effect.
- After the set-n-bit parameter is configured, the N-bit is set in the database description (DD) packets during the synchronization between the router and neighboring routers.
- The suppress-forwarding-address parameter sets the forwarding address (FA) of the Type 5 LSAs translated from Type 7 LSAs by the NSSA ABR to 0.0.0.0.
- If multiple ABRs are deployed in the NSSA, the system automatically selects an ABR (the router with the largest router ID) as a translator to convert Type 7 LSAs into Type 5 LSAs. You can configure the translator-always parameter on an ABR to specify the ABR as an all-the-time translator. To specify two ABRs for load balancing, configure the translator-always parameter on the chosen ABRs to specify the ABRs as all-the-time translators. You can use this command to pre-configure a fixed translator to prevent LSA flooding caused by translator role changes.
- The translator-interval parameter is used to ensure uninterrupted services when translator roles change. The value of interval-value must be greater than the flooding interval.
- The zero-address-forwarding parameter is used to set the FA of the generated NSSA LSAs to 0.0.0.0 when external routes are imported to the ABR in an NSSA.
- (Optional) Run default-cost cost
The cost of the default route carried in Type 3 LSAs that are transmitted by the ABR to the NSSA is set.
To ensure the reachability of AS external routes, the ABR in the NSSA generates a default route and advertises it to other routers in the NSSA.
- Run commit
The configuration is committed.
Checking the Configurations
Run either of the following commands to check LSDB information:
display ospf [ process-id ] lsdb [ brief ]
display ospf [ process-id ] lsdb [ router | network | summary | asbr | ase | nssa | opaque-link | opaque-area ] [ link-state-id ] [ originate-router [ advertising-router-id ] | self-originate ]
Run either of the following commands to check routing table information:
display ospf [ process-id ] routing [ ip-address [ mask | mask-length ] ] [ interface interface-type interface-number ] [ nexthop nexthop-address ]
display ospf [ process-id ] routing router-id [ router-id ]
Run the display ospf [ process-id ] interface [ all | no-peer | interface-type interface-number ] [ verbose ] command to check OSPF interface information.
By comparing the routing tables before and after an NSSA is configured, you can reach the following conclusions:
- After an area is configured as an NSSA, the number of entries in the routing table is reduced.
- AS external routes are imported to the NSSA.
Configuring OSPF Local MT
By configuring local multicast topology (MT), you can create a routing table for multicast traffic when multicast and a Multiprotocol Label Switching (MPLS) traffic engineering (TE) tunnel are configured on a network.
Usage Scenario
When multicast and an Interior Gateway Protocol (IGP) Shortcut-enabled MPLS TE tunnel are configured on a network, the outbound interface of the route calculated by an IGP may not be a physical interface but a TE tunnel interface. The TE tunnel interface on the router sends multicast Join packets over a unicast route to the multicast source address. The multicast Join packets are transparent to the router through which the TE tunnel passes. As a result, the router through which the TE tunnel passes cannot generate multicast forwarding entries.
To resolve this problem, enable OSPF local MT. After local MT is enabled, if the outbound interface of a calculated route is an IGP Shortcut-enabled TE tunnel interface, the route management (RM) module creates an independent Multicast IGP (MIGP) routing table for the multicast protocol, calculates a physical outbound interface for the route, and adds the route to the MIGP routing table. Multicast packets are then forwarded along this route.
You can configure a routing policy for local MT to control the number of routing entries in an MIGP routing table and speed up MIGP routing table lookup.
Pre-configuration Tasks
Before configuring local MT, complete the following tasks:
- Configure IP addresses for interfaces to ensure that neighboring Devices are reachable at the network layer.
- Configure basic OSPF functions.
- Configure the IGP Shortcut.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run local-mt enable
Local MT is enabled.
- Local MT takes effect only to the OSPF process of a public network instance.
- Local MT does not support Forwarding Adjacency (FA).
- (Optional) Run any of the following commands as required:
- Based on the basic ACL:
Run local-mt filter-policy acl { acl-number | acl-name }
A routing policy is configured for local MT.
Run quit
Return to the system view.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
An ACL rule is configured.
When the rule command is used to configure a filtering rule for a named ACL, only the configurations specified by source and time-range take effect.
When a filter-policy of a routing protocol is used to filter routes:If the action specified in an ACL rule is permit, a route matching the rule will be accepted or advertised by the system.
If the action specified in an ACL rule is deny, a route matching the rule will not be accepted or advertised by the system.
If the network segment of a route is not within the range specified in an ACL rule, the route will not be accepted or advertised by the system.
If an ACL does not contain any rules, none of the routes matched against the filter-policy that uses this ACL will be accepted or advertised by the system.
Routes can be filtered using a blacklist or whitelist:
If ACL rules are used for matching in configuration order, the system matches the rules in ascending order of their IDs.
Filtering using a blacklist: Configure a rule with a smaller ID and specify the action deny in this rule to filter out the unwanted routes. Then, configure another rule with a larger ID in the same ACL and specify the action permit in this rule to accept or advertise the other routes.
Filtering using a whitelist: Configure a rule with a smaller ID and specify the action permit in this rule to permit the routes to be accepted or advertised. Then, configure another rule with a larger ID in the same ACL and specify the action deny in this rule to filter out the unwanted routes.
Based on the IP prefix:
Run local-mt filter-policy ip-prefix ip-prefix-name
A routing policy is configured for local MT.
Based on the Route-Policy:
Run local-mt filter-policy route-policy route-policy-name
A routing policy is configured for local MT.
Based on a route-filter:
Run local-mt filter-policy route-filter route-filter-name
A routing policy is configured for local MT.
After an MIGP routing table is created, OSPF performs route calculation. If the outbound interface of the calculated route is an IGP Shortcut-enabled TE tunnel interface, the router saves the physical interface on which the tunnel interface is configured as the outbound interface in the MIGP routing table. Multicast packets are then forwarded along this route.
After the routing policy is configured, only the matching routes to the multicast source address are added to the MIGP routing table, which controls the number of entries in the MIGP routing table and speeds up MIGP routing table lookup.
Configure a routing policy before you enable local MT, because if an excessive number of routes to a non-multicast source address exist in an MIGP routing table, the number of entries may exceed the upper limit.
- Based on the basic ACL:
- Run commit
The configuration is committed.
Verifying the Configuration
- Run the display ospf [ process-id ] migp-routing [ ip-address [ mask | mask-length ] ] [ interface interface-type interface-number ] [ nexthop nexthop-address ] command to check MIGP routing table information.
- Run the display ospf [ process-id ] routing command to check OSPF routing table information.
- Run the display ospf [ process-id ] brief command to check brief OSPF information.
Configuring an OSPF Sham Link
This section describes how to configure an OSPF sham link so that traffic between sites of the same VPN in the same OSPF area is forwarded through the OSPF intra-area route over the BGP/MPLS IP VPN backbone network.
Usage Scenario
Generally, BGP peers use BGP extended community attributes to carry routing information over the BGP/MPLS IP VPN backbone network. PEs can use the routing information to exchange inter-area routes between PEs and CEs through OSPF. OSPF sham links are unnumbered P2P links between two PEs over an MPLS VPN backbone network. The source and destination IP addresses of each sham link are IP addresses with a 32-bit mask of loopback interfaces. The loopback interfaces must be bound to a VPN instance, and routes of the two IP addresses are advertised through BGP.
On the BGP/MPLS IP VPN backbone network, if an intra-area OSPF link exists between the network segment where the local CE resides and the network segment where the remote CE resides, the route over this intra-area OSPF link is an intra-area route and has a higher priority than the inter-area route over the BGP/MPLS IP VPN backbone network. In this case, VPN traffic is always forwarded through this intra-area route. To prevent this problem, you can set up an OSPF sham link between the PEs so that the route over the MPLS IP VPN backbone network becomes an OSPF intra-area route and ensure that this route is preferentially selected.
Pre-configuration Tasks
Before configuring an OSPF sham link, complete the following tasks:
Configure basic BGP/MPLS IP VPN functions and configure OSPF between each PE and its corresponding CE.
Configure OSPF in the LAN of each CE.
Procedure
- Configure endpoint IP addresses for a sham link.
Perform the following steps on PEs at both ends of the sham link:
- Advertise routes of the sham link's endpoint IP addresses.
Perform the following steps on PEs at both ends of the sham link:
- Create an OSPF sham link.
Perform the following steps on PEs at both ends of the sham link:
Checking the Configurations
After configuring the OSPF sham link, run the following commands to check the configurations.
- Run the display ip routing-table vpn-instance vpn-instance-name command on PEs to check the VPN routing table.
- Run the display ip routing-table command on CEs to check the routing table.
- Run the tracert host command on a CE to check the nodes through which data is forwarded to the remote end.
- Run the display ospf process-id sham-link [ area area-id ] command on PEs to check whether the sham link is established.
- Run the display ospf routing command on CEs to check OSPF routes.
Configuring BFD for OSPF
After BFD for OSPF is enabled, if a link fails, the router rapidly detects the failure, notifies the OSPF process or interface of the fault, and instructs OSPF to recalculate routes. This speeds up OSPF network convergence.
Usage Scenario
OSPF enables the router to periodically send Hello packets to a neighboring router for fault detection. Detecting a fault takes more than 1s. As voice, video, and other VOD services are widely used. These services are sensitive to packet loss and delays. When traffic is transmitted at gigabit rates, long-time fault detection will cause packet loss. This cannot meet high reliability requirements of the carrier-class network. BFD for OSPF was introduced to resolve this problem. After BFD for OSPF is configured in a specified process or on a specified interface, the link status can be rapidly detected and fault detection can be completed in milliseconds. This speeds up OSPF convergence when the link status changes.
Configuring BFD Globally
On two devices that need to establish a BFD session with each other, you can configure BFD for all the interfaces in a certain OSPF process.
Configuring BFD for an OSPF Process
Configuring BFD for an OSPF process helps the system rapidly detect link states and speeds up OSPF convergence in the case of a link state change.
Context
After BFD is configured for an OSPF process, when detecting a link failure, BFD rapidly notifies the failure to routers on both ends of the link, triggering rapid OSPF convergence. When the OSPF neighbor relationship goes Down, the BFD session will be dynamically deleted.
Before configuring BFD for OSPF, enable BFD globally.
To configure BFD on all the interfaces in an OSPF process, perform the following operations on the routers at both ends of the link where a BFD session is to be set up:
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run bfd all-interfaces enable
BFD is enabled for the OSPF process to create BFD sessions.
- (Optional) Run bfd all-interfaces { min-rx-interval receive-interval | min-tx-interval transmit-interval | detect-multiplier multiplier-value | frr-binding } *
BFD session parameters are modified.
You can skip this step. The default interval at which BFD packets are transmitted and the default detection multiplier are recommended.
The parameters are configured based on the network status and network reliability requirements. A short interval at which BFD packets are transmitted can be configured for a link that has a higher requirement for reliability. A long interval at which BFD packets are transmitted can be configured for a link that has a lower requirement for reliability.
- Actual interval at which BFD packets are transmitted on the local router = Max { configured interval transmit-interval at which BFD packets are transmitted on the local router, configured interval receive-interval at which BFD packets are received on the peer router }
- Actual interval at which BFD packets are received on the local router = Max { configured interval transmit-interval at which BFD packets are transmitted on the peer router, configured interval receive-interval at which BFD packets are received on the local router }
- Actual time for detecting BFD packets = Actual interval at which BFD packets are received on the local router x Configured detection multiplier multiplier-value on the peer router
For example:
- On the local router, the configured interval at which BFD packets are transmitted is 200 ms; the configured interval at which BFD packets are received is 300 ms; the detection multiplier is 4.
- On the peer router, the configured interval at which BFD packets are transmitted is 100 ms; the interval at which BFD packets are received is 600 ms; the detection multiplier is 5.
Then:
- On the local router, the actual interval at which BFD packets are transmitted is 600 ms calculated by using the formula max {200 ms, 600 ms}; the interval at which BFD packets are received is 300 ms calculated by using the formula max {100 ms, 300 ms}; the detection period is 1500 ms calculated by multiplying 300 ms by 5.
- On the peer router, the actual interval at which BFD packets are transmitted is 300 ms calculated by using the formula max {100 ms, 300 ms}, the actual interval at which BFD packets are received is 600 ms calculated by using the formula max {200 ms, 600 ms}, and the detection period is 2400 ms calculated by multiplying 600 ms by 4.
- (Optional) Prevent an interface from dynamically creating a BFD session.
After BFD for OSPF is configured, all interfaces on which neighbor relationships are Full in the OSPF process will create BFD sessions. To prevent specific interfaces from being enabled with BFD, disable these interfaces from dynamically creating BFD sessions.
- (Optional) Run bfd all-interfaces incr-cost { cost | max-reachable } [ wtr <wtr-value> ]
The OSPF process is enabled to adjust the cost based on the BFD session status.
If the function of adjusting the cost based on the status of an associated BFD session is configured both for a process and an interface, the configuration on the interface takes precedence.
If the function of adjusting the cost based on the status of an associated BFD session is configured both for a process and an interface, the configuration on the interface takes precedence.
- Run commit
The configuration is committed.
(Optional) Configuring BFD for a Specified Interface
Configuring BFD for OSPF on a specified interface helps speed up OSPF convergence in the case of an interface failure.
Context
After BFD for OSPF is configured on a specified interface and the interface becomes faulty, the router rapidly detects the fault and instructs OSPF to recalculate routes. This speeds up OSPF convergence. When the OSPF neighbor relationship goes Down, the BFD session between OSPF neighbors is dynamically deleted.
Before configuring BFD for OSPF, enable BFD globally.
The interface can be a physical interface or a GRE tunnel interface. If BFD is enabled on a GRE tunnel interface, millisecond-level fault detection can be implemented for the GRE tunnel.
Procedure
- Run system-view
The system view is displayed.
- Run bfd
BFD is globally configured.
- Run quit
Return to the system view.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf bfd enable
BFD for OSPF is configured, and the default parameter values are used to establish a BFD session.
If BFD is enabled globally and the neighbor relationships on the interface are in the Full state, OSPF creates a BFD session with default parameter values for the interface.
The ospf bfd enable [ per-link one-arm-echo ] command can be run only in the VLANIF interface view.
If BFD for OSPF is configured for an Eth-Trunk with multiple physical interfaces added in a VLAN and per-link one-arm-echo is not specified, the BFD session may go down even if only one of the physical interfaces goes down. As a result, the OSPF neighbor relationship also goes down. If per-link one-arm-echo is specified in this case, the BFD session goes down only if all the physical interfaces are down, which ensures that the OSPF neighbor relationship can be established normally.
The configuration of BFD for OSPF on an interface takes precedence over that in the OSPF process.
- (Optional) Run ospf bfd { min-rx-interval receive-interval | min-tx-interval transmit-interval | detect-multiplier multiplier-value | frr-binding } *
BFD session parameters are modified.
The default interval at which BFD packets are transmitted and the default detection multiplier are recommended. As such, this step can be skipped.
The parameters need to be configured based on network conditions and requirements on network reliability. A short transmission interval for BFD packets can be set for a link that requires higher reliability, and a long transmission interval can be configured for a link that requires lower reliability.
- Actual interval at which BFD packets are transmitted on the local device = Max { transmit-interval (interval at which BFD packets are transmitted) set on the local device, receive-interval (interval at which BFD packets are received) set on the peer device }
- Actual interval at which BFD packets are received on the local device = Max { transmit-interval (interval at which BFD packets are transmitted) set on the peer device, receive-interval (interval at which BFD packets are received) set on the local device }
- Actual period for BFD detection on the local device = Actual interval at which BFD packets are received on the local device x Detection multiplier specified by multiplier-value on the peer device
For example:
- On the local device, the interval at which BFD packets are transmitted is set to 200 ms, the interval at which BFD packets are received is set to 300 ms, and the detection multiplier is set to 4.
- On the peer device, the interval at which BFD packets are transmitted is set to 100 ms, the interval at which BFD packets are received is set to 600 ms, and the detection multiplier is set to 5.
Then:
- On the local device, the actual interval at which BFD packets are transmitted is 600 ms (calculated through Max { 200 ms, 600 ms }); the actual interval at which BFD packets are received is 300 ms (calculated through Max { 100 ms, 300 ms }); the actual detection period is 1500 ms (calculated through 300 ms x 5).
- On the peer device, the actual interval at which BFD packets are transmitted is 300 ms (calculated through Max { 100 ms, 300 ms }); the actual interval at which BFD packets are received is 600 ms (calculated through Max { 200 ms, 600 ms }); the actual detection period is 2400 ms (calculated through 600 ms x 4).
- (Optional) Run ospf bfd incr-cost { cost | max-reachable } [ wtr <wtr-value> ]
The OSPF interface is enabled to adjust the cost based on the BFD session status.
If the function of adjusting the cost based on the status of an associated BFD session is configured both for a process and an interface, the configuration on the interface takes precedence.
If the function of adjusting the cost based on the status of an associated BFD session is configured both for a process and an interface, the configuration on the interface takes precedence.
- Run commit
The configuration is committed.
Configuring OSPF IP FRR
If a link fails, an OSPF IP FRR-capable device can fast switch traffic to a backup link, which protects traffic and improves OSPF network reliability.
Usage Scenario
As networks develop, services such as Voice over IP (VoIP) and on-line video services require high-quality real-time transmission.
Nevertheless, if an OSPF fault occurs, traffic can be switched to a new link only after the fault detection that lasts several milliseconds, fault notification to the routing control plane that lasts several milliseconds, new topology information generation and flooding that last tens of milliseconds, Shortest Path First (SPF) calculation that lasts tens of milliseconds, and new route notification and adding that last hundreds of milliseconds. As a result, it takes much more than 50 ms, the maximum convergence time tolerable for VoIP and on-line video services, which cannot meet the requirement for real-time services on the network.
With OSPF IP FRR that calculates a backup link in advance, devices can fast switch traffic to the backup link without interrupting traffic if the primary link fails, which protects traffic and improves OSPF network reliability.
As shown in Figure 1-1518, traffic flows from Device S to Device D. The preceding inequality is met. Device S switches the traffic to the backup link if the primary link fails.
OSPF IP FRR is applicable to services that are sensitive to packet delay and packet loss.
The NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M supports OSPF IP FRR that uses LFA or Remote LFA as the algorithm.
LFA Auto FRR cannot be used to calculate alternate links on large-scale networks, especially on ring networks. To address this problem, enable Remote LFA Auto FRR. Remote LFA takes effect only when LFA has been enabled.
Both OSPF LFA FRR and OSPF remote LFA FRR use the SPF algorithm to calculate the shortest path to the destination node, with each neighbor that provides a backup link as the root node. The backup next hop is node-based, which applies to single-node routing scenarios. As networks are increasingly diversified, two ABRs or ASBRs are deployed to improve network reliability. In this case, OSPF FRR in a multi-node routing scenario is needed. In Figure 1-1519, Device B and Device C function as ABRs to forward area 0 and area 1 routes. Device E advertises an intra-area route. Upon receipt of the route, Device B and Device C translate it to a Type 3 LSA and flood the LSA to area 0. After OSPF FRR is enabled on Device A, Device A considers Device B and Device C as its neighbors. Without a fixed neighbor as the root node, Device A fails to calculate FRR backup next hop. To solve this problem, a virtual node is constructed between Device B and Device C. The virtual node converts the same route advertised by multiple nodes into a route with a single route source, and then calculates the backup next hop of the virtual node based on the LFA or Remote LFA algorithm. The same route advertised by multiple nodes inherits the backup next hop from the created virtual node.
After OSPF IP FRR is configured, the lower layer needs to fast respond to a link change so that traffic can be fast switched to the backup link. After FRR and BFD are bound, link failures can be detected rapidly so that traffic is rapidly switched to the backup link if the primary link fails.
Pre-configuration Tasks
Before configuring OSPF IP FRR, complete the following tasks:
Configure a link layer protocol.
Configure IP addresses for interfaces to ensure that neighboring nodes are reachable at the network layer.
Before you configure remote LFA FRR, configure LDP LSPs to perform recursion hop by hop between the source node and PQ node. That is, configure a local LDP session between each pair of directly connected nodes along the link from the source node to PQ node.
Enabling OSPF IP FRR
With OSPF IP FRR and loop-free backup links, a device can switch traffic to a backup link immediately if the primary link fails.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id | router-id router-id | vpn-instance vpn-instance-name ] *
An OSPF process is started, and the OSPF view is displayed.
- Run frr
The OSPF FRR view is displayed.
- Run loop-free-alternate
OSPF IP FRR is enabled to generate a loop-free backup link.
- (Optional) Run frr-policy route { route-policy route-policy-name | route-filter route-filter-name }
An OSPF IP FRR filtering policy is configured.
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.
- If you want to configure remote LFA OSPF IP FRR, perform the following steps:
- (Optional) Run the tiebreaker { node-protecting | lowest-cost | ldp-sync hold-max-cost | srlg-disjoint } preference preference command to configure the solution of selecting a backup path for OSPF IP FRR.By default, the solution of selecting a backup path for OSPF IP FRR is node-protection path first. In actual networking scenarios, the solution may need to be changed to smallest-cost path first due to considerations such as interface forwarding capacity and link cost. In Figure 1-1520, the primary path is Link-1 (DeviceS -> DeviceE -> DeviceD), and Link-2 and Link-3 (DeviceS -> DeviceN -> DeviceD) are backup path candidates. By default, Link-3 is selected as the backup path. To change the solution of selecting a backup path for OSPF IP FRR to smallest-cost path first, run the tiebreaker command. After the command is run, Link-2 is selected as the backup path.Figure 1-1521 shows an inter-board scenario, where Link-1 (Device A -> Device D) is the primary path, and Link-2 (Device A -> Device E -> Device D) is the backup path. After the primary path Link-1 fails, the primary path is switched to Link-2, and the backup path is Link-3 (Device A->Device B->Device C->Device D). If Link-1 goes Up again but the LDP session has not gone Up, OSPF enters the Hold-max-cost state. Consequently, the primary path is still Link-2, and the backup path is still Link-3. If the LDP session goes Up but ldp-sync hold-max-cost is not configured, OSPF exits from the Hold-max-cost state when the timer used to delay sending an LDP session Up message expires. In this case, OSPF switches the primary path back to Link-1. Because the upstream and downstream entries reside on different boards and the downstream entry has not been updated when downstream traffic arrives, packet loss occurs. To resolve the problem, configure ldp-sync hold-max-cost so that OSPF preferentially selects the path with the maximum cost set by LDP-IGP synchronization when OSPF is in the Hold-max-cost state. The backup path is switched to Link-1, and backup forwarding entries are delivered in advance. When the timer used to delay sending an LDP session Up message expires, OSPF exits from the Hold-max-cost state and switches the primary path to Link-1. Because the downstream backup entry is available, no packet loss occurs.
- Run commit
The configuration is committed.
(Optional) Binding IP FRR and BFD
Binding IP FRR and BFD enables the lower layer to fast respond to a link change so that traffic can be rapidly switched to the backup link if the primary link fails.
Context
After the parameter frr-binding is set to bind the BFD status to the link status of an interface, link failures can be detected rapidly. This ensures that traffic is rapidly switched to the backup link if the primary link fails.
Perform the following steps on the router where IP FRR and BFD need to be bound:
(Optional) Disabling OSPF IP FRR on an Interface
If an interface runs key services, ensure that the backup path does not pass through this interface so that services will not be affected after FRR calculation.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The view of an OSPF interface on which FRR is enabled is displayed.
- Run ospf frr block
FRR is blocked on the OSPF interface.
- (Optional) Run ospf remote-lfa disable
Interfaces of the specified level are disabled from being calculated as the Remote LFA next hop.
- Run commit
The configuration is committed.
Configuring OSPF GR Helper
To avoid traffic interruption and route flapping caused by the active/standby switchover, you can enable OSPF GR.
Usage Scenario
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.
GR includes the GR restarter and GR helper. NetEngine 8100 M, NetEngine 8000E M, NetEngine 8000 M supports the GR Helper only.
Pre-configuration Tasks
Before configuring OSPF GR, complete the following tasks:
Configure IP addresses for interfaces to ensure that neighboring nodes are reachable at the network layer.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF view is displayed.
- Run opaque-capability enable
The Opaque-LSA capability is enabled.
OSPF supports OSPF GR through Type 9 LSAs (Opaque LSAs). Therefore, before configuring OSPF GR, run the opaque-capability enable command to enable the Opaque-LSA capability.
- Configure GR session parameters on the helper.
- Configure GR session parameters on the helper.
IETF mode and non-IETF mode are mutually exclusive.
- Configure GR session parameters on the helper in IETF mode.
Run graceful-restart helper-role ignore-external-lsa
The helper does not check AS external LSAs.
Run graceful-restart helper-role planned-only
The helper is configured to support only planned GR.
Choose either of the following configuration as required:
- Based on a basic ACL:
- Run graceful-restart [ helper-role { { acl-number acl-number | acl-name acl-name } * } | never } ]
GR session parameters on the helper are configured.
- Run quit
The system view is displayed.
- Run acl { name basic-acl-name { basic | [ basic ] number basic-acl-number } | [ number ] basic-acl-number } [ match-order { config | auto } ]
The ACL view is displayed.
Run rule [ rule-id ] [ name rule-name ] { deny | permit } [ fragment-type { fragment | non-fragment | non-subseq | fragment-subseq | fragment-spe-first } | source { source-ip-address { source-wildcard | 0 | src-netmask } | any } | time-range time-name | vpn-instance vpn-instance-name ] *
The rule for the ACL is configured.
When the rule command is run to configure rules for a named ACL, only the source address range specified by source and the time period specified by time-range are valid as the rules.
- Run graceful-restart [ helper-role { { acl-number acl-number | acl-name acl-name } * } | never } ]
Configure an IP prefix list.
Run graceful-restart [ helper-role { { ip-prefix ip-prefix-name* } | never } ]
GR session parameters on the helper are configured.
- Based on a basic ACL:
Enable the non-IETF mode.
Run graceful-restart non-ietf
GR Helper in non-IETF mode is enabled.
- Configure GR session parameters on the helper in IETF mode.
- Run commit
The configuration is committed.
Improving OSPF Network Security
On a network demanding high security, you can configure OSPF authentication and GTSM to improve OSPF network security.
Usage Scenario
With the increase in attacks on TCP/IP networks and the defects in the TCP/IP protocol suite, network attacks have increasing impacts on the network security. Attacks on network devices may lead to network crash. Configuring OSPF authentication and GTSM can improve OSPF network security.
OSPF authentication encrypts OSPF packets by adding the authentication field to packets to ensure network security. When a local device receives OSPF packets from a remote device, the local device discards the packets if the authentication passwords carried in these packets do not match the local one, which protects the local device from potential attacks.
In terms of the packet type, the authentication is classified as follows:
Area authentication
Area authentication is configured in the OSPF area view and applies to packets received by all interfaces in the OSPF area.
Interface authentication
Interface authentication is configured in the interface view and applies to all packets received by the interface.
Pre-configuration Tasks
Before improving OSPF network security, complete the following tasks:
Configure a link layer protocol.
Configure IP addresses for interfaces to ensure that neighboring nodes are reachable at the network layer.
Configuring Area Authentication
OSPF supports packet authentication. With the authentication, only the packets that are authenticated are accepted; if packets fail to be authenticated, a neighbor relationship cannot be established. If area authentication is used, the authentication mode and password configurations on all the interfaces in the area must be identical.
Context
By default, no authentication mode is configured for an OSPF area. You are advised to configure an authentication mode to ensure system security.
For security purposes, you are advised not to use weak security algorithms in OSPF. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id ]
The OSPF process view is displayed.
- Run area area-id
The OSPF area view is displayed.
- Run any of the following commands to configure the authentication mode for the OSPF area as required:
Run authentication-mode simple [ plain plain-text | [ cipher ] cipher-text ]
Simple authentication is configured for the OSPF area.
- plain indicates the plaintext mode.
- cipher indicates the ciphertext mode. For MD5, HMAC-MD5, or HMAC-SHA256 authentication, cipher is used by default.
When configuring an authentication password, you are advised to use the ciphertext mode. If you select the plaintext mode, the password is saved in configuration files in plaintext, which poses a high security risk. To ensure device security, change the password periodically.
Run authentication-mode { md5 | hmac-md5 | hmac-sha256 } [ key-id { plain plain-text | [ cipher ] cipher-text } ]
Cipher-text authentication is configured for the OSPF area.
- md5 indicates the MD5 ciphertext authentication mode.
- hmac-md5 indicates the HMAC-MD5 ciphertext authentication mode.
- hmac-sha256 indicates the HMAC-SHA256 ciphertext authentication mode.
For the sake of security, using the HMAC-SHA256 algorithm rather than the MD5 or HMAC-MD5 algorithm is recommended.
Run authentication-mode keychain Keychain-Name
The Keychain authentication is configured for the OSPF area.
Before using the Keychain authentication, you must run the keychain command to create a keychain. Then, run the key-id, key-string, and algorithm commands to configure a key ID, a password, and an authentication algorithm for this keychain. Otherwise, the OSPF authentication will fail.
- Run commit
The configuration is committed.
Configuring Interface Authentication
Interface authentication takes effect between neighboring devices' interfaces on which an authentication mode and password are configured. Interface authentication takes precedence over area authentication. Interfaces on the same network segment must have the same authentication mode and password. Interfaces on different network segments can have different authentication modes and passwords.
Context
By default, no authentication mode is configured for an OSPF interface. You are advised to configure an authentication mode to ensure system security.
For security purposes, you are advised not to use weak security algorithms in OSPF. If you need to use such an algorithm, run the undo crypto weak-algorithm disable command to enable the weak security algorithm function first.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The OSPF interface view is displayed.
- Run any of the following commands to configure interface authentication as required:
Run ospf authentication-mode simple [ plain plain-text | [ cipher ] cipher-text ]
Simple authentication is configured for the OSPF interface.
- simple indicates simple authentication.
- plain indicates the plaintext mode. In simple authentication mode, if this parameter is not specified, the cipher type is used by default.
- cipher indicates the ciphertext mode. For MD5, HMAC-MD5, or HMAC-SHA256 authentication, cipher is used by default.
When configuring an authentication password, you are advised to use the ciphertext mode. If you select the plaintext mode, the password is saved in configuration files in plaintext, which poses a high security risk. To ensure device security, change the password periodically.
Run ospf authentication-mode { md5 | hmac-md5 | hmac-sha256 } [ key-id { plain plain-text | [ cipher ] cipher-text } ]
Ciphertext authentication is configured for the OSPF interface.
- md5 indicates the MD5 ciphertext authentication mode.
- hmac-md5 indicates the HMAC-MD5 ciphertext authentication mode.
- hmac-sha256 indicates the HMAC-SHA256 ciphertext authentication mode.
For the sake of security, using the HMAC-SHA256 algorithm rather than the MD5 or HMAC-MD5 algorithm is recommended.
Run ospf authentication-mode keychain keychain-name
The Keychain authentication is configured for the OSPF interface.
Before using keychain authentication, run the keychain command to create a keychain. Then, run the key-id, key-string, and algorithm commands to configure a key ID, a password, and an authentication algorithm, respectively, for this keychain. If a keychain or its parameters are not configured, the OSPF authentication will fail.
Run ospf authentication-mode null
The OSPF interface does not perform authentication.
- Run commit
The configuration is committed.
Configuring the Network Management Function of OSPF
OSPF supports the network management function. You can bind the OSPF MIB to an OSPF process and configure trap and log functions.
Usage Scenario
Through the Simple Network Management Protocol (SNMP), the OSPF Management Information Base (MIB) manages information exchanged between the NMS and agents.
Pre-configuration Tasks
Before configuring the network management function of OSPF, complete the following tasks:
Configure a link layer protocol.
Configure IP addresses for interfaces to ensure that neighboring nodes are reachable at the network layer.
Configuring Whitelist Session-CAR for OSPF
You can configure whitelist session-CAR for OSPF to isolate bandwidth resources by session for OSPF packets. This configuration prevents bandwidth preemption among OSPF sessions in the case of a traffic burst.
Context
When OSPF packets suffer a traffic burst, bandwidth may be preempted among OSPF sessions. To resolve this problem, you can configure whitelist session-CAR for OSPF to isolate bandwidth resources by session. If the default parameters of whitelist session-CAR for OSPF do not meet service requirements, you can adjust them as required.
Procedure
- Run system-view
The system view is displayed.
- Run whitelist session-car ospf { cir cir-value | cbs cbs-value | pir pir-value | pbs pbs-value } *
Parameters of whitelist session-CAR for OSPF are configured.
In normal cases, you are advised to use the default values of these parameters.
- (Optional) Run whitelist session-car ospf disable
Whitelist session-CAR for OSPF is disabled.
By default, whitelist session-CAR for OSPF is enabled. In normal cases, you are advised to keep this function enabled. Disable it if it becomes abnormal or adversely affects other services.
- Run commit
The configuration is committed.
Configuring Micro-Segment CAR for OSPF
Context
By default, micro-isolation CAR is enabled for OSPF, implementing micro-isolation protection for OSPF packets based on interfaces and destination IP addresses to protect session establishment. When OSPF packets encounter a traffic burst, a large number of packets of non-OSPF neighbors may preempt interface bandwidth resources. In the case of an attack, a large number of invalid packets sent to other IP addresses may preempt the bandwidth. Therefore, you are advised not to disable this function.
Procedure
- Run system-view
The system view is displayed.
- Run micro-isolation protocol-car ospf { cir cir-value | cbs cbs-value | pir pir-value | pbs pbs-value } *
Micro-isolation CAR parameters are configured for OSPF.
In normal cases, you are advised to use the default values of these parameters. pir-value must be greater than or equal to cir-value, and pbs-value must be greater than or equal to cbs-value.
- (Optional) Run micro-isolation protocol-car ospf disable
Micro-isolation CAR is disabled for OSPF.
By default, micro-isolation CAR for OSPF is enabled. To disable this function, run the micro-isolation protocol-car ospf disable command. If this function is disabled, micro-isolation protection is no longer implemented for OSPF packets based on interfaces and destination IP addresses. In normal cases, you are advised to keep micro-isolation CAR enabled for OSPF.
- Run commit
The configuration is committed.
Configuring the Threshold Alarm Function for the Number of OSPF Neighbors
Context
When the number of established OSPF neighbor relationships exceeds the specifications of the device, establishing more OSPF neighbor relationships may cause the neighbor status to be unstable. To prevent this problem, you can enable the alarm function for the number of OSPF neighbor relationships so that an alarm is generated when the number of OSPF neighbor relationships exceeds the upper alarm threshold.
Maintaining OSPF
Maintaining OSPF involves resetting OSPF and clearing OSPF statistics.
Clearing OSPF Statistics
This section describes how to clear OSPF statistics, including statistics about OSPF counters and statistics about session-CAR.
Context
OSPF information cannot be restored after you clear it. Exercise caution when clearing it.
To clear OSPF information, run the following reset commands in the user view.
Procedure
- Run the reset ospf [ process-id ] counters [ neighbor [ interface-type interface-number ] [ router-id ] ] command to reset OSPF counters.
- counters indicates OSPF counters.
- neighbor indicates neighbor information on the specified interface.
- Run the reset ospf [ process-id ] counters maxage-lsa command to delete the statistics about router LSAs that have reached the aging time.
- Run the reset ospf [ process-id ] frr command to perform OSPF IP FRR calculation again.
- Run the reset ospf [ process-id ] peer [ interface-type interface-number ] router-id command to restart an OSPF neighbor.
- Run the reset cpu-defend whitelist session-car ospf statistics slot slot-id command to clear statistics about whitelist session-CAR for OSPF on a specified interface board.
Resetting OSPF
Restarting OSPF can reset OSPF.
Context
The OSPF neighbor relationships will be torn down if you run the reset ospf command to reset OSPF connections. Exercise caution when running the command.
To reset OSPF connections, perform the following operation:
Procedure
- Run the reset ospf [ process-id ] process command to restart the OSPF process.
After the reset ospf process command is used to restart OSPF, the following situations may occur:
- If the router ID is changed, the new router ID takes affect after the reset ospf process command is run.
- The DR and BDR are re-selected after the reset ospf process command is run.
- Run the reset ospf [ process-id ] spf to recalculate OSPF routes.
- Run the reset ospf [ process-id ] redistribution to reset OSPF route redistribution.
Disabling OSPF Memory Overload Control
Context
By default, OSPF memory overload control is enabled. When the system memory is overloaded, each module needs to take necessary measures to control the memory usage. Upon receiving a memory overload notification from the system, the OSPF module no longer imports new routes and starts to control neighbor relationship establishment based on the memory overload condition to enhance OSPF resilience. In this case, new neighbor relationships cannot be established. For existing neighbor relationships, if they are in the Full state, they will be retained; if they are in a non-Full state, they are not reestablished until the memory recovers from overload.
Procedure
- Run the system-view command to enter the system view.
- Run the ospf memory-overload control disable command to disable OSPF memory overload control.
To reduce the impact of memory overload on services, you are advised not to disable OSPF memory overload control.
- Run the commit command to commit the configuration.
Disabling OSPF CPU Overload Control
Context
By default, OSPF CPU overload control is enabled. If a device's CPU is overloaded, each module takes necessary measures to control its own CPU usage accordingly. Upon receiving a CPU overload notification from the system, the OSPF module controls the speeds of some internal computing processes and the establishment of neighbor relationships based on the CPU overload condition to enhance the resilience of OSPF. In this case, new neighbor relationships cannot be established. For original neighbor relationships, if a neighbor relationship is in the Full state, it will be retained; if a neighbor relationship is in a non-Full state, establishment of the neighbor relationship is paused and can continue only after the CPU recovers from overload.
Configuring OSPF Multi-Area Adjacency
OSPF multi-area adjacency allows one link to be shared by multiple OSPF areas.
Usage Scenario
According to OSPF, intra-area paths take precedence over inter-area paths. If a link in an area is a high-speed link, routes in other areas cannot use the high-speed link for transmission at the same time. Instead, they can use only low-speed links. To solve this problem, run the ospf enable multi-area command to enable OSPF on the multi-area adjacency interface so that a path can be shared by multiple areas.
Among the OSPF features supported by an OSPF multi-area adjacency interface, some can be inherited from the main interface, whereas others need to be configured independently. For details, see Table 1-626.
OSPF Feature |
Description |
Related Configuration Links |
---|---|---|
BFD for OSPF |
BFD for OSPF can be inherited from main interfaces, except for the configuration that disables BFD from an interface. This configuration needs to be configured independently. |
Disabling an OSPF Multi-Area Adjacency Interface from Creating BFD Sessions |
OSPF fast convergence |
OSPF multi-area adjacency interfaces support OSPF fast convergence which needs to be configured independently for these interfaces and cannot be inherited from their main interfaces. |
Configuring Fast Convergence for a Multi-Area Adjacency Interface |
IGP-LDP synchronization |
OSPF multi-area adjacency interfaces support IGP-LDP synchronization which needs to be configured independently for these interfaces and cannot be inherited from their main interfaces. |
Configuring LDP-IGP Synchronization |
OSPF IP FRR |
OSPF multi-area adjacency interfaces support OSPF IP FRR. OSPF IP FRR can be inherited from main interfaces, except for the configuration that disables FRR from a specified OSPF interface. This configuration needs to be configured independently for OSPF multi-area adjacency interfaces. |
Disabling OSPF IP FRR on an OSPF Multi-Area Adjacency Interface |
OSPF neighbor relationship flapping suppression |
OSPF multi-area adjacency interfaces support OSPF neighbor relationship flapping suppression which needs to be configured independently for these interfaces and cannot be inherited from their main interfaces. |
Configuring Neighbor Relationship Flapping Suppression on an OSPF Multi-Area Adjacency Interface |
OSPF flush LSA source tracing |
OSPF multi-area adjacency interfaces support OSPF flush LSA source tracing which can be inherited from their main interfaces. |
Configuring OSPF Flush LSA Source Tracing |
OSPF TE |
OSPF multi-area adjacency interfaces inherit TE information from their main interfaces. |
Configuring IGP TE (OSPF or IS-IS) |
Enabling OSPF on a Multi-Area Adjacency Interface
Enabling OSPF on a multi-area adjacency interface is the prerequisite for configuring basic multi-area adjacency functions.
Procedure
- Run system-view
The system view is displayed.
- Run ospf [ process-id | router-id router-id ] *
An OSPF process is started, and the OSPF view is displayed.
- Run area area-id
The OSPF area view is displayed.
- Enable OSPF on an interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- Run ospf mtu-enable multi-area area-id
The multi-area adjacency interface is configured to fill in DD packets with the MTU value when sending the packets and check whether the MTU in each DD packet received from a neighbor exceeds the MTU of the local interface.
Enabling an interface to fill in DD Packets with its MTU will cause the involved neighbor relationship to be re-established.
- Run commit
The configuration is committed.
Configuring a Cost for a Multi-Area Adjacency Interface
Configuring a cost for a multi-area adjacency interface can control route selection.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- Run ospf cost cost multi-area area-id
A cost is configured for the multi-area adjacency interface.
- Run commit
The configuration is committed.
Configuring an Authentication Mode for a Multi-Area Adjacency Interface
Configuring an authentication mode for a multi-area adjacency interface improves OSPF network security.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- Run either of the following commands:
Run the ospf authentication-mode simple [ plain plain-text | [ cipher ] cipher-text ] multi-area area-id command to configure simple authentication for the multi-area adjacency interface.
Run the ospf authentication-mode { md5 | hmac-md5 | hmac-sha256 } [ key-id { plain plain-text | [ cipher ] cipher-text } ] multi-area area-id command to configure ciphertext authentication for the multi-area adjacency interface.
Run the ospf authentication-mode keychain keychain-name multi-area area-id command to configure keychain authentication for the multi-area adjacency interface.
Run the ospf authentication-mode null multi-area area-id command to configure null authentication for the multi-area adjacency interface.
- Run commit
The configuration is committed.
Configuring Fast Convergence for a Multi-Area Adjacency Interface
Configuring fast convergence for a multi-area adjacency interface improves network performance.
Procedure
- Configure the interval at which a multi-area adjacency interface sends Hello packets.
- Configure the dead interval of OSPF neighbor relationships for a multi-area adjacency interface.
- Configure an LSA retransmission interval on a multi-area adjacency interface.
- Configure an LSA transmission delay on a multi-area adjacency interface.
- Configure smart-discover on a multi-area adjacency interface.
- Configure an OSPF multi-area adjacency interface to filter the LSAs to be sent.
Configuring Neighbor Relationship Flapping Suppression on an OSPF Multi-Area Adjacency Interface
Neighbor relationship flapping suppression can be configured on an OSPF multi-area adjacency interface to delay OSPF neighbor relationship reestablishment or set the link cost to the maximum value in case of neighbor relationship flapping.
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.
The following steps are optional, and choose them as required.
Procedure
- Run system-view
The system view is displayed.
To disable the function globally, run the suppress-flapping peer disable command.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- (Optional) Run ospf suppress-flapping peer disable multi-area area-id
OSPF neighbor relationship flapping suppression on a multi-area adjacency interface is disabled.
To disable OSPF neighbor relationship flapping suppression from one of the interfaces, run this command.
- Run ospf suppress-flapping peer hold-down interval multi-area area-id
The Hold-down mode and its duration are configured for the multi-area adjacency interface.
OSPF neighbor relationship flapping suppression operates in Hold-down or Hold-max-cost mode.
Hold-down mode: In the case of frequent flooding and topology changes during neighbor relationship establishment, interfaces prevent neighbor relationship reestablishment during the suppression period, which reduces LSDB synchronization attempts and packet exchanges.
Hold-max-cost mode: If the traffic forwarding path changes frequently, interfaces use 65535 (maximum value) as the cost of the flapping link during the suppression period. This prevents traffic from passing through the flapping link.
To change the value of Max-cost for OSPF links, run the maximum-link-cost cost command.
The Hold-down mode and Hold-max-cost mode can be both used. When both modes are configured, the device first enters the Hold-down mode. After exiting the Hold-down mode, the device enters the Hold-max-cost mode.
To disable the Hold-max-cost mode, run the ospf suppress-flapping peer hold-max-cost disable multi-area command.
- Run ospf suppress-flapping peer { detecting-interval detecting-interval | threshold threshold | resume-interval resume-interval } * multi-area area-id
Detection parameters are configured for OSPF neighbor relationship flapping suppression on the multi-area adjacency interface.
Configure a threshold for exiting OSPF neighbor relationship flapping suppression.
If the interval between two successive neighbor relationship state changes from Full to a non-Full state is longer than the resume-interval, the flapping_count is reset.
- If OSPF neighbor relationship flapping suppression works in Hold-max-cost mode, the value of resume-interval indicates the duration of this mode.
The value of resume-interval must be greater than that of detecting-interval.
You can configure detection parameters for OSPF neighbor relationship flapping suppression on specific interfaces according to network conditions. However, using the default values of these parameters is recommended.
- Run quit
The system view is displayed.
- Run quit
The user view is displayed.
- Run reset ospf suppress-flapping process-id peer [ interface-name [ all-areas | area area-id ] | interface-type interface-number [ all-areas | areaarea-id ] ] [ notify-peer ]
The OSPF multi-area adjacency interface is configured to exit OSPF neighbor relationship flapping suppression.
The interface exits flapping suppression in the following scenarios:
- The suppression timer expires.
- The corresponding OSPF process is reset.
- An OSPF neighbor is reset using the reset ospf peer command.
- OSPF neighbor relationship flapping suppression is disabled globally using the suppress-flapping peer disable (OSPF) command.
- The reset ospf suppress-flapping peer command is run.
- Run commit
The configuration is committed.
Disabling an OSPF Multi-Area Adjacency Interface from Creating BFD Sessions
After BFD for OSPF is configured, all interfaces on which neighbor relationships are in Full state in the OSPF process create BFD sessions. You can disable an interface from creating BFD sessions as required.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- Run ospf bfd block multi-area area-id
The OSPF multi-area adjacency interface is disabled from creating BFD sessions.
- Run commit
The configuration is committed.
Disabling OSPF IP FRR on an OSPF Multi-Area Adjacency Interface
OSPF IP fast reroute (FRR) can be disabled on an OSPF multi-area adjacency interface that is connected to a link carrying key services. This prevents FRR from calculating the link as the backup link and minimizes any potential impact on the services.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- Run ospf frr block multi-area area-id
OSPF IP FRR is disabled on the OSPF multi-area adjacency interface.
- (Optional) Run ospf remote-lfa disable multi-area area-id
Remote loop-free alternate (LFA) is disabled on the OSPF multi-area adjacency interface.
- Run commit
The configuration is committed.
Configuring a Fallback Cost for an Eth-Trunk Multi-Area Adjacency Interface
Configuring a fallback cost for an Eth-Trunk multi-area adjacency interface helps control route selection.
Context
After an Eth-trunk member interface goes down, the OSPF cost value is automatically adjusted. When an Eth-trunk member interface becomes invalid, the remaining bandwidth may fail to meet user requirements, causing service loss. In this fault scenario, the cost of the Eth-Trunk can be dynamically adjusted to a larger value so that traffic is transmitted through other paths. When the interface bandwidth is less than the fallback bandwidth threshold, the device changes the interface cost to the configured fallback cost in time so that a better transmission path is selected. When the bandwidth of an Eth-Trunk interface is greater than or equal to the configured fallback bandwidth threshold, cost-fallback does not take effect.
Procedure
- Run system-view
The system view is displayed.
- Run interface eth-trunk trunk-id
The Eth-Trunk interface view is displayed.
- Run ospf enable [ process-id ] area area-id
OSPF is enabled on the interface.
- Run ospf enable multi-area area-id
OSPF is enabled on the multi-area adjacency interface.
- Run ospf cost-fallback fallbackcost threshold fallbackbw multi-area area-id
A fallback cost is configured for an Eth-Trunk multi-area adjacency interface.
- Run commit
The configuration is committed.
Maintaining OSPF on a Multi-Area Adjacency Interface
Configuration Examples for OSPF
This section provides several OSPF configuration examples.
Example for Configuring Basic OSPF Functions
This section describes how to configure basic OSPF functions, including enabling OSPF on each router and specifying network segments in different areas.
Networking Requirements
On the network shown in Figure 1-1522, all routers run OSPF, and the entire AS is divided into three areas. DeviceA and DeviceB function as ABRs to forward inter—area routes.
After the configuration is complete, each router should learn the routes to all network segments in the AS.
Precautions
When configuring basic OSPF functions, note the following rules:
The backbone area is responsible for forwarding inter-area routes. In addition, the routing information between non-backbone areas must be forwarded through the backbone area. OSPF defines the following rules for the backbone area:
- Connectivity must be available between non-backbone areas and the backbone area.
- Connectivity must be available over the backbone area.
- The intervals at which Hello, Dead, and Poll packets are sent on the local interface must be the same as those on the remote interface. Otherwise, the OSPF neighbor relationship cannot be established.
Configuration Roadmap
The configuration roadmap is as follows:
Enable OSPF on each router.
Specify network segments in different areas.
- Configure ciphertext authentication for the OSPF area.
Data Preparation
To complete the configuration, you need the following data:
Device Name |
Router ID |
Process ID |
IP Address |
Device A |
1.1.1.1 |
1 |
Area 0: 192.168.0.0/24 Area 1: 192.168.1.0/24 |
Device B |
2.2.2.2 |
1 |
Area 0: 192.168.0.0/24 Area 2: 192.168.2.0/24 |
Device C |
3.3.3.3 |
1 |
Area 1: 192.168.1.0/24 and 172.16.1.0/24 |
Device D |
4.4.4.4 |
1 |
Area 2: 192.168.2.0/24 and 172.17.1.0/24 |
Device E |
5.5.5.5 |
1 |
Area 1: 172.16.1.0/24 |
Device F |
6.6.6.6 |
1 |
Area 2: 172.17.1.0/24 |
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions.
# Configure DeviceA.
[~DeviceA] router id 1.1.1.1
[*DeviceA] ospf 1
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.0] quit
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.1] quit
[*DeviceA-ospf-1] commit
# Configure DeviceB.
[~DeviceB] router id 2.2.2.2
[*DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] quit
[*DeviceB-ospf-1] area 2
[*DeviceB-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.2] quit
[*DeviceB-ospf-1] commit
# Configure DeviceC.
[~DeviceC] router id 3.3.3.3
[*DeviceC] ospf 1
[*DeviceC-ospf-1] area 1
[*DeviceC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.1] commit
[~DeviceC-ospf-1-area-0.0.0.1] quit
# Configure DeviceD.
[~DeviceD] router id 4.4.4.4
[*DeviceD] ospf 1
[*DeviceD-ospf-1] area 2
[*DeviceD-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.2] commit
[~DeviceD-ospf-1-area-0.0.0.2] quit
# Configure DeviceE.
[~DeviceE] router id 5.5.5.5
[~DeviceE] ospf 1
[*DeviceE-ospf-1] area 1
[*DeviceE-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[*DeviceE-ospf-1-area-0.0.0.1] commit
[~DeviceE-ospf-1-area-0.0.0.1] quit
# Configure DeviceF.
[~DeviceF] router id 6.6.6.6
[~DeviceF] ospf 1
[*DeviceF-ospf-1] area 2
[*DeviceF-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[*DeviceF-ospf-1-area-0.0.0.2] commit
[~DeviceF-ospf-1-area-0.0.0.2] quit
- Configure ciphertext authentication for the OSPF area.
# Configure DeviceA.
[~DeviceA] ospf 1
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] authentication-mode hmac-sha256 1 cipher YsHsjx_202206
[*DeviceA-ospf-1-area-0.0.0.0] quit
[*DeviceA-ospf-1] commit
# Configure DeviceB.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] authentication-mode hmac-sha256 1 cipher YsHsjx_202206
[*DeviceB-ospf-1-area-0.0.0.0] quit
[*DeviceB-ospf-1] commit
Device B and Device A must be configured with the same password. Otherwise, the neighbor relationship cannot be established.
- Verify the configuration.
# Display the OSPF neighbors of DeviceA.
[~DeviceA] display ospf peer
(M) Indicates MADJ interface OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface 192.168.0.1(GigabitEthernet0/1/0)'s neighbors Router ID: 2.2.2.2 Address: 192.168.0.2 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.0.2 BDR: 192.168.0.1 MTU: 0 Dead timer due in 36 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.1 interface 192.168.1.1(GigabitEthernet0/2/0)'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.2 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.1.2 BDR: 192.168.1.1 MTU: 0 Dead timer due in 39 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
# Display the OSPF routes of DeviceA.
[~DeviceA] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 172.16.1.0/24 2 Transit 192.168.1.2 3.3.3.3 0.0.0.1 172.17.1.0/24 3 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0 192.168.2.0/24 2 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0 Total Nets: 3 Intra Area: 1 Inter Area: 2 ASE: 0 NSSA: 0
# Display the LSDB of DeviceA.
[~DeviceA] display ospf lsdb
OSPF Process 1 with Router ID 1.1.1.1 Link State Database Area: 0.0.0.0 Type LinkState ID AdvRouter Age Len Sequence Metric Router 1.1.1.1 1.1.1.1 93 48 80000004 1 Router 2.2.2.2 2.2.2.2 92 48 80000004 1 Sum-Net 172.16.1.0 1.1.1.1 1287 28 80000002 2 Sum-Net 192.168.1.0 1.1.1.1 1716 28 80000001 1 Sum-Net 172.17.1.0 2.2.2.2 1336 28 80000001 2 Sum-Net 192.168.2.0 2.2.2.2 87 28 80000002 1 Area: 0.0.0.1 Type LinkState ID AdvRouter Age Len Sequence Metric Router 1.1.1.1 1.1.1.1 1420 48 80000002 1 Router 3.3.3.3 3.3.3.3 1294 60 80000003 1 Router 5.5.5.5 5.5.5.5 1296 36 80000002 1 Network 172.16.1.1 3.3.3.3 1294 32 80000001 0 Sum-Net 172.17.1.0 1.1.1.1 1325 28 80000001 3 Sum-Net 192.168.0.0 1.1.1.1 1717 28 80000001 1 Sum-Net 192.168.2.0 1.1.1.1 1717 28 80000001 2
# Display the routing table on DeviceD and perform the ping operation to test the connectivity.
[~DeviceD] display ospf routing
OSPF Process 1 with Router ID 4.4.4.4 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 172.16.1.0/24 4 Inter-area 192.168.2.1 2.2.2.2 0.0.0.2 192.168.0.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.2 192.168.1.0/24 3 Inter-area 192.168.2.1 2.2.2.2 0.0.0.2 Total Nets: 3 Intra Area: 0 Inter Area: 3 ASE: 0 NSSA: 0
[~DeviceD] 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
Configuration Files
Device A configuration file
#
sysname DeviceA
#
router id 1.1.1.1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.0.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
authentication-mode hmac-sha256 1 cipher %^%#c;\wJ4Qi8I1FMGM}KmIK9rha/.D.!$"~0(Ep66z~%^%#
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
authentication-mode hmac-sha256 1 cipher %^%#c;\wJ4Qi8I1FMGM}KmIK9rha/.D.!$"~0(Ep66z~%^%#
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
router id 4.4.4.4
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.17.1.1 255.255.255.0
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
return
DeviceE configuration file
#
sysname DeviceE
#
router id 5.5.5.5
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
ospf 1
area 0.0.0.1
network 172.16.1.0 0.0.0.255
#
return
DeviceF configuration file
#
sysname DeviceF
#
router id 6.6.6.6
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.17.1.2 255.255.255.0
#
ospf 1
area 0.0.0.2
network 172.17.1.0 0.0.0.255
#
return
Example for Configuring OSPF Virtual Links
This section describes how to configure virtual links to connect a non-backbone area to the backbone area.
Networking Requirements
On the network shown in Figure 1-1523, Area 2 is not directly connected to the backbone area Area 0. Area 1 serves as a transit area to connect Area 2 and Area 0. A virtual link is configured between DeviceA and DeviceB.
Precautions
The default value is recommended when a virtual link is created. You can modify the value in actual scenarios.
Suggestions for configuring parameters are as follows:
- The smaller the hello parameter, the more rapidly a router detects network topology change, the more network resources are consumed.
- If the retransmit parameter is set too small, LSAs may be retransmitted. Setting the parameter to a large value is recommended in a low-speed network.
- The authentication modes of a virtual link and the backbone area must be the same.
- To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each router.
Configure a virtual link between DeviceA and DeviceB to connect a non-backbone area to the backbone area.
Data Preparation
To complete the configuration, you need the following data:
Device Name |
Router ID |
Process ID |
IP Address |
DeviceA |
1.1.1.1 |
1 |
Area 0: 10.0.0.0/8 Area 1: 192.168.1.0/24 |
DeviceB |
2.2.2.2 |
1 |
Area 1: 192.168.1.0/24 Area 2: 172.16.0.0/16 |
DeviceC |
3.3.3.3 |
1 |
Area 0: 10.0.0.0/8 |
DeviceD |
4.4.4.4 |
1 |
Area 2: 172.16.0.0/16 |
Procedure
- Assign an IP address to each interface according to Configuration Files. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions.
Configuring Basic OSPF Functions shows how to configure basic OSPF functions. For configuration details, see Configuration Files in this section.
- Check the OSPF routes on DeviceA
[~DeviceA] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 10.0.0.0/8 1 Transit 10.1.1.1 3.3.3.3 0.0.0.0 192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1 Total Nets: 2 Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
The routing table on Device A contains no route in Area 2 because Area 2 is not directly connected to Area 0.
- Configure an OSPF virtual link.
# Configure DeviceA.
[~DeviceA] router id 1.1.1.1
[~DeviceA] ospf 1
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2
[*DeviceA-ospf-1-area-0.0.0.1] quit
[*DeviceA-ospf-1] quit
[*DeviceA] commit
# Configure DeviceB.
[~DeviceB] router id 2.2.2.2
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 1
[*DeviceB-ospf-1-area-0.0.0.1] vlink-peer 1.1.1.1
[*DeviceB-ospf-1-area-0.0.0.1] quit
[*DeviceB-ospf-1] quit
[*DeviceB] commit
- Verify the configuration.
# Display the OSPF vlink on DeviceA.
[~DeviceA] display ospf vlink
OSPF Process 1 with Router ID 1.1.1.1 Virtual Links Virtual-link Neighbor-id -> 2.2.2.2, Neighbor-State: Full Interface: 192.168.1.1 (GigabitEthernet0/1/0) Cost: 1 State: P-2-P Type: Virtual Transit Area: 0.0.0.1 Timers: Hello 10 , Dead 40 , Retransmit 5 , Transmit Delay 1 GR State: Normal
The preceding command output shows that the OSPF vlink neighbor status is "Full".
# Display the OSPF routes on DeviceA.
[~DeviceA] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 172.16.0.0/16 2 Inter-area 192.168.1.2 2.2.2.2 0.0.0.2 10.0.0.0/8 1 Transit 10.1.1.1 1.1.1.1 0.0.0.0 192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1 Total Nets: 3 Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
After the virtual link is configured, the routing table on DeviceA contains routes in Area 2.
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
router id 1.1.1.1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.1 255.0.0.0
#
ospf 1
area 0.0.0.0
network 10.0.0.0 0.255.255.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
vlink-peer 2.2.2.2
#
return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.1 255.255.0.0
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
vlink-peer 1.1.1.1
area 0.0.0.2
network 172.16.0.0 0.0.255.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.2 255.0.0.0
#
ospf 1
area 0.0.0.0
network 10.0.0.0 0.255.255.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
router id 4.4.4.4
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.2 255.255.0.0
#
ospf 1
area 0.0.0.2
network 172.16.0.0 0.0.255.255
#
return
Example for Configuring an OSPF Stub Area
This section describes how to configure a stub area that imports static routes. Such configuration can reduce the number of LSAs advertised to this area without affecting route reachability.
Networking Requirements
On the network shown in Figure 1-1524, all routers run OSPF, and the entire AS is divided into three areas. DeviceA and DeviceB function as ABRs to advertise inter-area routes; DeviceD functions as the ASBR and imports external routes (static routes).
Configure Area 1 as a stub area to reduce the LSAs advertised to this area without affecting route reachability.
Precautions
When configuring an OSPF stub area, note the following rules:
- The backbone area cannot be configured as a stub area.
- An ASBR cannot exist in a stub area. That is, AS-external routes are not flooded in the stub area.
- A virtual link cannot pass through a stub area.
- To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
Configure a static route on DeviceD and import it into OSPF.
Configure Area 1 as a stub area by running the stub command on all routers in Area 1 and check the OSPF routing information on DeviceC.
Prevent DeviceA from advertising Type 3 LSAs to the stub area, and check the OSPF routing information on DeviceC.
Data Preparation
To complete the configuration, you need the following data:
Device Name |
Router ID |
Process ID |
IP Address |
DeviceA |
1.1.1.1 |
1 |
Area 0: 192.168.0.0/24 Area 1: 192.168.1.0/24 |
DeviceB |
2.2.2.2 |
1 |
Area 0: 192.168.0.0/24 Area 2: 192.168.2.0/24 |
DeviceC |
3.3.3.3 |
1 |
Area 1: 192.168.1.0/24 and 172.16.1.0/24 |
DeviceD |
4.4.4.4 |
1 |
Area 2: 192.168.2.0/24 and 172.17.1.0/24 |
DeviceE |
5.5.5.5 |
1 |
Area 1: 172.16.1.0/24 |
DeviceF |
6.6.6.6 |
1 |
Area 2: 172.17.1.0/24 |
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Configure DeviceD to import static routes.
[*DeviceD] ip route-static 10.0.0.0 8 null 0
[*DeviceD] ospf 1
[*DeviceD-ospf-1] import-route static type 1
[*DeviceD-ospf-1] commit
[~DeviceD-ospf-1] quit
# Display the ABR and ASBR information on DeviceC.
[~DeviceC] display ospf abr-asbr
OSPF Process 1 with Router ID 3.3.3.3
Routing Table to ABR and ASBR
Type Destination Area Cost NextHop RtType
Intra-area 1.1.1.1 0.0.0.1 1 192.168.1.1 ABR
Inter-area 4.4.4.4 0.0.0.1 3 192.168.1.1 ASBR
# Display the OSPF routing table on DeviceC.
If the area where DeviceC resides is a common area, external routes exist in the routing table.
[~DeviceC] display ospf routing
OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 172.17.1.0/24 4 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.0.0/24 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.2.0/24 3 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 10.0.0.0/8 4 Type1 1 192.168.1.1 4.4.4.4 Total Nets: 4 Intra Area: 0 Inter Area: 3 ASE: 1 NSSA: 0
- Configure Area 1 as a stub area.
# Configure DeviceA.
[~DeviceA] ospf 1
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] stub
[*DeviceA-ospf-1-area-0.0.0.1] commit
[~DeviceA-ospf-1-area-0.0.0.1] quit
# Configure DeviceC.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 1
[*DeviceC-ospf-1-area-0.0.0.1] stub
[*DeviceC-ospf-1-area-0.0.0.1] commit
[~DeviceC-ospf-1-area-0.0.0.1] quit
# Configure DeviceE.
[~DeviceE] ospf 1
[*DeviceE-ospf-1] area 1
[*DeviceE-ospf-1-area-0.0.0.1] stub
[*DeviceE-ospf-1-area-0.0.0.1] commit
[~DeviceE-ospf-1-area-0.0.0.1] quit
# Display the routing table on DeviceC.
After the area where DeviceC resides is configured as a stub area, a default route rather than AS external routes is displayed in the routing table.
[~DeviceC] display ospf routing
OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 0.0.0.0/0 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 172.17.1.0/24 4 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.0.0/24 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 192.168.2.0/24 3 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 Total Nets: 4 Intra Area: 0 Inter Area: 4 ASE: 0 NSSA: 0
- # Prevent DeviceA from advertising Type 3 LSAs to the stub area.
[~DeviceA] ospf
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] stub no-summary
[*DeviceA-ospf-1-area-0.0.0.1] commit
[~DeviceA-ospf-1-area-0.0.0.1] quit
- Verify the configuration.
# Display the OSPF routing table on DeviceC.
[~DeviceC] display ospf routing
OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 0.0.0.0/0 2 Inter-area 192.168.1.1 1.1.1.1 0.0.0.1 Total Nets: 1 Intra Area: 0 Inter Area: 1 ASE: 0 NSSA: 0
After the advertisement of summary LSAs to the stub area is disabled, the number of routing entries on the routers in the stub area further decreases, and only the default route to a destination beyond the stub area is reserved.
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
router id 1.1.1.1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.0.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
stub no-summary
#
return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
stub
#
return
DeviceD configuration file
#
sysname DeviceD
#
router id 4.4.4.4
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.17.1.1 255.255.255.0
#
ospf 1
import-route static type 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
ip route-static 10.0.0.0 255.0.0.0 NULL0
#
return
DeviceE configuration file
#
sysname DeviceE
#
router id 5.5.5.5
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
ospf 1
area 0.0.0.1
network 172.16.1.0 0.0.0.255
stub
#
return
DeviceF configuration file
#
sysname DeviceF
#
router id 6.6.6.6
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 172.17.1.2 255.255.255.0
#
ospf 1
area 0.0.0.2
network 172.17.1.0 0.0.0.255
#
return
Example for Configuring an OSPF NSSA
This section describes how to configure an OSPF not-so-stubby area (NSSA).
Networking Requirements
An excessive number of entries in a routing table wastes network resources and causes high CPU usage. To solve this problem, a non-backbone area on the border of an AS can be configured as an NSSA to reduce the amount of routing information to be transmitted. An NSSA in an AS does not transmit routes learned from other areas in the AS but imports AS external routes. This reduces bandwidth and storage resource consumption.
On the network shown in Figure 1-1525, all routers run OSPF and the entire AS is divided into two areas. DeviceA and DeviceB function as Area Border Routers (ABRs) to forward inter-area routes; DeviceD functions as an Autonomous System Boundary Router (ASBR) and imports the external static route 10.0.0.0/8. To import AS-external routes but reduce the number of Link State Advertisements (LSAs) advertised to area 1 without affecting route reachability, configure area 1 as an NSSA and configure DeviceA as an LSA translator in the NSSA.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
- Enable OSPF on all routers and configure basic OSPF functions to ensure that routers communicate with each other using OSPF. For details, see Configuring Basic OSPF Functions.
- Configure area 1 as an NSSA.
- Configure DeviceD to import the static route 10.0.0.0/8.
- Configure DeviceA in the NSSA as an LSA translator.
Data Preparation
To complete the configuration, you need the following data:
- Router ID 1.1.1.1 of DeviceA; OSPF process ID 1; network segment 192.168.0.0/24 of area 0; network segments 192.168.1.0/24 and 192.168.3.0/24 of area 1
- Router ID 2.2.2.2 of DeviceB; OSPF process ID 1; network segment 192.168.2.0/24 of area 0; network segments 192.168.1.0/24 and 192.168.4.0/24 of area 1
- Router ID 3.3.3.3 of DeviceC; OSPF process ID 1; network segments 192.168.0.0/24 and 192.168.2.0/24 of area 0
- Router ID 4.4.4.4 of DeviceD; OSPF process ID 1; network segments 192.168.3.0/24 and 192.168.4.0/24 of area 1
Procedure
- Assign an IP address to each interface.
Configure an IP address for each interface as shown in Figure 1-1525. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions.
Configuring Basic OSPF Functions shows how to configure basic OSPF functions. For details about the configuration, see Configuration Files in this section.
- Configure area 1 as an NSSA.
# Configure DeviceA.
[~DeviceA] ospf
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] nssa
[*DeviceA-ospf-1-area-0.0.0.1] commit
[~DeviceA-ospf-1-area-0.0.0.1] quit
# Configure DeviceB.
[~DeviceB] ospf
[*DeviceB-ospf-1] area 1
[*DeviceB-ospf-1-area-0.0.0.1] nssa
[*DeviceB-ospf-1-area-0.0.0.1] commit
[~DeviceB-ospf-1-area-0.0.0.1] quit
# Configure DeviceD.
[~DeviceD] ospf
[*DeviceD-ospf-1] area 1
[*DeviceD-ospf-1-area-0.0.0.1] nssa
[*DeviceD-ospf-1-area-0.0.0.1] commit
[~DeviceD-ospf-1-area-0.0.0.1] quit
NSSA attributes must be configured on all routers in the NSSA using the nssa command.
- Configure DeviceD to import the static route 10.0.0.0/8.
[~DeviceD] ip route-static 10.0.0.0 8 null 0
[*DeviceD] ospf
[*DeviceD-ospf-1] import-route static
[*DeviceD-ospf-1] commit
[~DeviceD-ospf-1] quit
# Display the OSPF routing table on DeviceC.
[~DeviceC] display ospf routing
OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 192.168.3.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0 192.168.4.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0 192.168.0.0/24 1 Stub 192.168.0.2 3.3.3.3 0.0.0.0 192.168.1.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0 192.168.1.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0 192.168.2.0/24 1 Stub 192.168.2.2 3.3.3.3 0.0.0.0 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 10.0.0.0/8 1 Type2 1 192.168.2.1 2.2.2.2 Total Nets: 7 Intra Area: 2 Inter Area: 4 ASE: 1 NSSA: 0
The command output shows that the router ID of the router that advertised the AS external route imported to the NSSA is 2.2.2.2. That is, DeviceB functions as a translator router because OSPF selects the ABR with the largest router ID as a translator router.
- # Configure DeviceA as an LSA translator.
[~DeviceA] ospf
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] nssa default-route-advertise no-summary translator-always
[*DeviceA-ospf-1-area-0.0.0.1] commit
[~DeviceA-ospf-1-area-0.0.0.1] quit
- Verify the configuration.
# View the OSPF routing table on DeviceC.
[~DeviceC] display ospf routing
OSPF Process 1 with Router ID 3.3.3.3 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 192.168.3.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0 192.168.4.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0 192.168.0.0/24 1 Stub 192.168.0.2 3.3.3.3 0.0.0.0 192.168.1.0/24 2 Inter-area 192.168.2.1 2.2.2.2 0.0.0.0 192.168.1.0/24 2 Inter-area 192.168.0.1 1.1.1.1 0.0.0.0 192.168.2.0/24 1 Stub 192.168.2.2 3.3.3.3 0.0.0.0 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 10.0.0.0/8 1 Type2 1 192.168.0.1 1.1.1.1 Total Nets: 7 Intra Area: 2 Inter Area: 4 ASE: 1 NSSA: 0
The command output shows that DeviceC has imported an AS external route and that the router ID of the router that advertised the imported AS external route is 1.1.1.1. DeviceA functions as the translator router.
Configuration Files
DeviceA configuration file
# sysname DeviceA # router id 1.1.1.1 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.0.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 192.168.3.1 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown ip address 192.168.1.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.0.0 0.0.0.255 area 0.0.0.1 network 192.168.1.0 0.0.0.255 network 192.168.3.0 0.0.0.255 nssa default-route-advertise no-summary translator-always # return
DeviceB configuration file
# sysname DeviceB # router id 2.2.2.2 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 192.168.2.1 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown ip address 192.168.4.2 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.2.0 0.0.0.255 area 0.0.0.1 network 192.168.1.0 0.0.0.255 network 192.168.4.0 0.0.0.255 nssa # return
DeviceC configuration file
# sysname DeviceC # router id 3.3.3.3 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.0.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 192.168.2.2 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.0.0 0.0.0.255 network 192.168.2.0 0.0.0.255 # return
DeviceD configuration file
# sysname DeviceD # router id 4.4.4.4 # interface GigabitEthernet0/1/0 undo shutdown ip address 192.168.3.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 192.168.4.1 255.255.255.0 # ospf 1 import-route static area 0.0.0.1 network 192.168.3.0 0.0.0.255 network 192.168.4.0 0.0.0.255 nssa # ip route-static 10.0.0.0 255.0.0.0 NULL0 # return
Example for Configuring OSPF DR Election
This section describes how to set the DR priority on an interface for DR election on a broadcast network.
Networking Requirements
On the network shown in Figure 1-1526, the interface of DeviceA has the highest priority of 100 on the network and is elected as the DR; DeviceC has the second highest priority and is elected as the BDR. DeviceB has the priority of 0 and cannot be elected as a DR or a BDR; no priority is configured for DeviceD and therefore, DeviceD uses the default value (1).
Precautions
Reconfiguring the DR priority for a router does not change the DR or BDR on a network. You can use either of the following methods to re-elect a DR or BDR. However, the following methods will disconnect OSPF neighbors. Therefore, use the following methods only when necessary.
Restart the OSPF processes on all routers.
Configure the shutdown and undo shutdown commands on the interfaces where the OSPF neighboring relationships are established.
- To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
- Configure a router ID for each router.
Check the DR or BDR status on each router when the default priority is used.
Configure the DR priority on an interface and check whether the device is the DR or BDR.
Data Preparation
To complete the configuration, you need the following data:
Router ID (1.1.1.1) and priority (100) of DeviceA
Router ID (2.2.2.2) and priority (0) of DeviceB
Router ID (3.3.3.3) and priority (2) of DeviceC
Router ID (4.4.4.4) and priority (1) of DeviceD
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions.
# Configure DeviceA.
[~DeviceA] router id 1.1.1.1
[*DeviceA] ospf 1
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.0] commit
[~DeviceA-ospf-1-area-0.0.0.0] quit
# Configure DeviceB.
[~DeviceB] router id 2.2.2.2
[*DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
# Configure DeviceC.
[~DeviceC] router id 3.3.3.3
[*DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
# Configure DeviceD.
[~DeviceD] router id 4.4.4.4
[*DeviceD] ospf 1
[*DeviceD-ospf-1] area 0
[*DeviceD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[*DeviceD-ospf-1-area-0.0.0.0] commit
[~DeviceD-ospf-1-area-0.0.0.0] quit
# Display the status of the DR or BDR.
[~DeviceA] display ospf peer
OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface 192.168.1.1 ( GE0/1/0 )'s neighbors Router ID: 2.2.2.2 Address: 192.168.1.2 State: 2-Way Mode:Nbr is Slave Priority: 1 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 32 sec Retrans timer interval: 0 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.1 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.3 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 34 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.1 ( GE0/1/0 )'s neighbors Router ID: 4.4.4.4 Address: 192.168.1.4 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 32 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
Check the neighbor information of DeviceA. You can view the DR priority and the neighbor status. By default, the DR priority is 1. Now DeviceD functions as the DR and DeviceC functions as the BDR.
- Set the DR priority on each interface.
# Configure DeviceA.
[~DeviceA] interface gigabitethernet 0/1/0
[~DeviceA-GigabitEthernet0/1/0] ospf dr-priority 100
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] quit
# Configure DeviceB.
[~DeviceB] interface gigabitethernet 0/1/0
[~DeviceB-GigabitEthernet0/1/0] ospf dr-priority 0
[*DeviceB-GigabitEthernet0/1/0] commit
[~DeviceB-GigabitEthernet0/1/0] quit
# Configure DeviceC.
[~DeviceC] interface gigabitethernet 0/1/0
[~DeviceC-GigabitEthernet0/1/0] ospf dr-priority 2
[*DeviceC-GigabitEthernet0/1/0] commit
[~DeviceC-GigabitEthernet0/1/0] quit
# Display the status of the DR or BDR.
[~DeviceD] display ospf peer
OSPF Process 1 with Router ID 4.4.4.4 Neighbors Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 1.1.1.1 Address: 192.168.1.1 State: Full Mode:Nbr is Slave Priority: 100 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 38 sec Retrans timer interval: 5 Neighbor is up for 2h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 2.2.2.2 Address: 192.168.1.2 State: Full Mode:Nbr is Slave Priority: 0 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 38 sec Retrans timer interval: 5 Neighbor is up for 2h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.3 State: Full Mode:Nbr is Slave Priority: 2 DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0 Dead timer due in 30 sec Retrans timer interval: 5 Neighbor is up for 2h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
- Restart the OSPF processes.
In the user view of each router, run the reset ospf 1 process command to restart the OSPF process.
- Verify the configuration.
# Display the status of OSPF neighbors.
[~DeviceD] display ospf peer
OSPF Process 1 with Router ID 4.4.4.4 Neighbors Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 1.1.1.1 Address: 192.168.1.1 State: Full Mode:Nbr is Slave Priority: 100 DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 5 Neighbor is up for 3h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 2.2.2.2 Address: 192.168.1.2 State: 2-Way Mode:Nbr is Slave Priority: 0 DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 0 Neighbor is up for 3h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 192.168.1.4 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 192.168.1.3 State: Full Mode:Nbr is Slave Priority: 2 DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0 Dead timer due in 37 sec Retrans timer interval: 5 Neighbor is up for 3h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
# Display the status of OSPF interfaces.
[~DeviceA] display ospf interface
2020-11-21 15:55:20.606 (M) Indicates MADJ interface OSPF Process 1 with Router ID 1.1.1.1 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) Interface IP Address Type State Cost Pri GigabitEthernet0/1/0 192.168.1.1 Broadcast DR 1 100
[~DeviceB] display ospf interface
2020-11-21 15:55:20.606 (M) Indicates MADJ interface OSPF Process 1 with Router ID 2.2.2.2 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) Interface IP Address Type State Cost Pri GigabitEthernet0/1/0 192.168.1.2 Broadcast DROther 1 100
If the neighbor is in the Full state, the device has established a neighbor relationship with its neighbor. If the neighbor remains in the 2-Way state, neither of them is the DR or BDR. In this case, they do not need to exchange LSAs.
If the status of the OSPF interface is DROther, the interface is neither DR nor BDR.
Configuration Files
Device A configuration file
#
sysname DeviceA
#
router id 1.1.1.1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
ospf dr-priority 100
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
ospf dr-priority 0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.3 255.255.255.0
ospf dr-priority 2
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
router id 4.4.4.4
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.4 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
Example for Configuring OSPF Load Balancing
This section describes how to configure OSPF load balancing, including enabling load balancing and setting priorities for equal-cost routes.
Networking Requirements
On the network shown in Figure 1-1527:
DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE are connected to each other through OSPF.
DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE belong to Area 0.
Load balancing is configured so that the traffic from DeviceA to DeviceE is load-balanced by DeviceC and DeviceD.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
Configure load balancing on DeviceA.
Set the priority for equal-cost routes on DeviceA.
Configure per-packet load balancing on DeviceA.
Data Preparation
To complete the configuration, you need the following data.
Data of DeviceA, including router ID (1.1.1.1), OSPF process ID (1), and network segment addresses of Area 0 (10.1.1.0/24, 10.1.2.0/24 and 10.1.3.0/24)
Data of DeviceB, including router ID (2.2.2.2), OSPF process ID (1), and network segment addresses of area 0 (10.1.1.0/24 and 192.168.0.0/24)
Data of DeviceC, including router ID (3.3.3.3), OSPF process ID (1), and network segment addresses of area 0 (10.1.2.0/24 and 192.168.1.0/24)
Data of DeviceD, including router ID (4.4.4.4), OSPF process ID (1), and network segment addresses of area 0 (10.1.3.0/24 and 192.168.2.0/24)
Data of DeviceE, including router ID (5.5.5.5), OSPF process ID (1), and network segment addresses of area 0 (192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, and 172.17.1.0/24)
Number of equal-cost routes for load balancing on DeviceA (2)
Next hop weights of the routes from DeviceA to DeviceB, DeviceC, and DeviceD (2, 1, and 1, respectively)
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Display the routing table of DeviceA.
DeviceA has three valid next hops: DeviceB (10.1.1.2), DeviceC (10.1.2.2), and DeviceD (10.1.3.2) because the default maximum number of equal-cost routes is 64.
<DeviceA> display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ---------------------------------------------------------------------------- Routing Table: _public_ Destinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.2.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/2/0 10.1.3.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/3/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/3/0 10.1.3.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/3/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.0.0/24 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/1/0 192.168.1.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/2/0 192.168.2.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/3/0 172.17.1.0/24 OSPF 10 3 D 10.1.1.2 GigabitEthernet0/1/0 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0 OSPF 10 3 D 10.1.3.2 GigabitEthernet0/3/0
- Set the maximum number of routes for load balancing to 2 on DeviceA.
[~DeviceA] ospf 1
[*DeviceA-ospf-1] maximum load-balancing 2
[*DeviceA-ospf-1] commit
[~DeviceA-ospf-1] quit
# Check the routing table of DeviceA. The command output shows that DeviceA has two routes for load balancing. The maximum number of equal-cost routes is 2. Therefore, the next hops 10.1.1.2 (DeviceB) and 10.1.2.2 (DeviceC) are valid routes.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ---------------------------------------------------------------------------- Routing Table: _public_ Destinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.2.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/2/0 10.1.3.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/3/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/3/0 10.1.3.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/3/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.0.0/24 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/1/0 192.168.1.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/2/0 192.168.2.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/3/0 172.17.1.0/24 OSPF 10 3 D 10.1.1.2 GigabitEthernet0/1/0 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0
- Set the priority for equal-cost routes on DeviceA.
[~DeviceA] ospf 1
[*DeviceA-ospf-1] nexthop 10.1.1.2 weight 2
[*DeviceA-ospf-1] nexthop 10.1.2.2 weight 1
[*DeviceA-ospf-1] nexthop 10.1.3.2 weight 1
[*DeviceA-ospf-1] commit
[*DeviceA-ospf-1] quit
- Verify the configuration.
# Check the routing table of DeviceA.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ---------------------------------------------------------------------------- Routing Table: _public_ Destinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.2.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/2/0 10.1.3.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/3/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/3/0 10.1.3.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/3/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.0.0/24 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/1/0 192.168.1.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/2/0 192.168.2.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/3/0 172.17.1.0/24 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0 OSPF 10 3 D 10.1.3.2 GigabitEthernet0/3/0
As shown in the routing table, the priority of the route with 10.1.2.2 and 10.1.3.2 as the next hop addresses is higher than that of the route with 10.1.1.2 as the next hop address. Therefore, DeviceA has only two valid next hops, DeviceC (10.1.2.2) and DeviceD (10.1.3.2).
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
ospf 1 router-id 1.1.1.1
maximum load-balancing 2
nexthop 10.1.1.2 weight 2
nexthop 10.1.2.2 weight 1
nexthop 10.1.3.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 10.1.3.0 0.0.0.255
#
return
DeviceB configuration file
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.0.1 255.255.255.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.0.0 0.0.255.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
ip address 10.1.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.1.2.0 0.0.0.255
network 192.168.1.0 0.0.0.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.2.1 255.255.255.0
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 10.1.3.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
return
DeviceE configuration file
#
sysname DeviceE
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.0.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/4/0
undo shutdown
ip address 172.17.1.1 255.255.255.0
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 192.168.0.0 0.0.255.255
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
return
Example for Configuring OSPF Fast Convergence
This section describes how to configure OSPF fast convergence by adjusting the timer parameter and configuring BFD.
Networking Requirements
On the broadcast network shown in Figure 1-1528, OSPF runs on the four devices, which belong to the same OSPF area.
Precautions
When configuring OSPF fast convergence, note the following rules:
You can decrease the interval at which Hello packets are sent and values of the Dead, Poll, and Wait timers for fast OSPF network convergence. Frequent packet transmission, however, may overload the device. In addition, the OSPF network convergence slows down if the values of these timers are too large. Therefore, set values based on the network stability.
- The intervals at which Hello packets are sent and values of the Dead, Poll, and Wait timers at both ends must be the same. Otherwise, the OSPF neighbor relationship cannot be established.
- To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
Configure the BFD function on each router.
Adjust the holddown time of the OSPF neighbors on each router.
Configure the Smart-discover function on each router.
Adjust the intervals for configuration update, LSA reception, and SPF calculation through an intelligent timer on each router.
Data Preparation
To complete the configuration, you need the following data:
Holddown time of the OSPF neighbors
Intervals for LSA update, LSA reception, and SPF calculation
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Adjust the holddown time of the OSPF neighbors on each router.
# Configure Device A.
[~DeviceA] interface gigabitethernet 0/1/0
[*DeviceA-GigabitEthernet0/1/0] ospf timer dead 30
[*DeviceA-GigabitEthernet0/1/0] commit
The holddown time of neighbors of the OSPF-capable interfaces must be longer than the interval at which Hello packets are sent, and the values of dead interval on the routers in the same network segment must be the same.
In this configuration example, the following configurations on each router are the same as that on DeviceA. For configuration details, see Configuration Files in this section.
Adjust the holddown time of the OSPF neighbors on each router.
Configure the Smart-discover function on each router.
Adjust the intervals for configuration update, LSA reception, and SPF calculation through an intelligent timer on the router.
- Configure the Smart-discover function on each router.
# Configure DeviceA.
[*DeviceA-GigabitEthernet0/1/0] ospf smart-discover
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] quit
- Configure the BFD function on each router.
# Configure DeviceA.
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] ospf
[*DeviceA-ospf-1] bfd all-interfaces enable
[*DeviceA-ospf-1] commit
[~DeviceA-ospf-1] quit
- Adjust the intervals for configuration update, LSA reception, and SPF calculation through an intelligent timer on each router.
# Configure DeviceA.
[~DeviceA] ospf 1
[~DeviceA-ospf-1] lsa-arrival-interval intelligent-timer 3000 200 500
[*DeviceA-ospf-1] lsa-originate-interval intelligent-timer 3000 200 500
[*DeviceA-ospf-1] spf-schedule-interval intelligent-timer 3000 200 500
[*DeviceA-ospf-1] commit
- Verify the configuration.
# Run the display ospf brief command on each router to view the brief information about OSPF. Use Router A as an example. You can view the values of timers.
[~DeviceA] display ospf brief
OSPF Process 1 with Router ID 9.9.9.9 OSPF Protocol Information RouterID: 9.9.9.9 Border Router: AREA Multi-VPN-Instance is not enabled Global DS-TE Mode: Non-Standard IETF Mode Graceful-restart capability: disabled Helper support capability : not configured OSPF Stub Router State Reason: Startup Synchronize Router LSA stub links with cost 65535 Summary LSA with cost 16777214 External LSA with cost 16777214 Applications Supported: MPLS Traffic-Engineering Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms Default ASE parameters: Metric: 1 Tag: 1 Type: 2 Route Preference: 10 ASE Route Preference: 150 Intra Route Preference: 50 Inter Route Preference: 50 SPF Computation Count: 56 RFC 1583 Compatible Retransmission limitation is disabled bfd enabled BFD Timers: Tx-Interval 10 , Rx-Interval 10 , Multiplier 3 Area Count: 2 Nssa Area Count: 0 ExChange/Loading Neighbors: 0 Area: 0.0.0.0 MPLS TE not enabled Authtype: None Area flag: Normal SPF scheduled count: 2 Exchange/Loading neighbors: 0 Router ID conflict state: Normal Interface: 1.1.1.1 (GE0/3/1) Cost: 1 State: DR Type: Broadcast MTU: 1500 Priority: 1 Designated Router: 1.1.1.1 Backup Designated Router: 0.0.0.0 Timers: Hello 10, Dead 40, Wait 40, Poll 120, Retransmit 5, Transmit Delay 1
Configuration Files
Device A configuration file
#
sysname DeviceA
#
router id 1.1.1.1
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
ospf timer dead 30
ospf smart-discover
#
ospf 1
bfd all-interfaces enable
spf-schedule-interval intelligent-timer 3000 200 500
lsa-arrival-interval intelligent-timer 3000 200 500
lsa-originate-interval intelligent-timer 3000 200 500
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.2 255.255.255.0
ospf timer dead 30
ospf smart-discover
#
ospf 1
bfd all-interfaces enable
spf-schedule-interval intelligent-timer 3000 200 500
lsa-arrival-interval intelligent-timer 3000 200 500
lsa-originate-interval intelligent-timer 3000 200 500
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.3 255.255.255.0
ospf timer dead 30
ospf smart-discover
#
ospf 1
bfd all-interfaces enable
spf-schedule-interval intelligent-timer 3000 200 500
lsa-arrival-interval intelligent-timer 3000 200 500
lsa-originate-interval intelligent-timer 3000 200 500
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
router id 4.4.4.4
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 192.168.1.4 255.255.255.0
ospf timer dead 30
ospf smart-discover
#
ospf 1
bfd all-interfaces enable
spf-schedule-interval intelligent-timer 3000 200 500
lsa-arrival-interval intelligent-timer 3000 200 500
lsa-originate-interval intelligent-timer 3000 200 500
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
Example for Configuring OSPF Local MT
This section provides an example for configuring OSPF local multicast topology (MT).
Networking Requirements
When multicast and an Interior Gateway Protocol (IGP) Shortcut-enabled Multiprotocol Label Switching (MPLS) traffic engineering (TE) tunnel are configured on a network, the outbound interface of the route calculated by an IGP may not be a physical interface but a TE tunnel interface. The TE tunnel interface on the Device sends multicast Join packets over a unicast route to the multicast source address. The multicast Join packets are transparent to the Device through which the TE tunnel passes. As a result, the Device through which the TE tunnel passes cannot generate multicast forwarding entries.
On the network shown in Figure 1-1529, DeviceA, DeviceB, DeviceC, DeviceD, and DeviceE are running OSPF. DeviceB and DeviceD set up an MPLS TE tunnel with the tunnel interface Tunnel 10, and IGP Shortcut is enabled on Tunnel 10 of DeviceB. The outbound interface calculated by DeviceB may be the TE tunnel interface, not the physical interface GE 0/2/0. Tunnel 10 on DeviceB sends multicast Join packets over a unicast route to the multicast source address. The multicast Join packets are transparent to DeviceC through which the TE tunnel passes. As a result, DeviceC cannot generate multicast forwarding entries.
To resolve the problem, enable OSPF local MT on DeviceB. After local MT is enabled, if the outbound interface of a calculated route is an IGP Shortcut-enabled TE tunnel interface, the route management (RM) module creates an independent Multicast IGP (MIGP) routing table for the multicast protocol, calculates a physical outbound interface for the route, and adds the route to the MIGP routing table. Multicast packets are then forwarded along this route.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Enable OSPF and configure basic OSPF functions on each Device.
Enable PIM-SM on each Device.
Configure an MPLS Resource Reservation Protocol (RSVP)-TE tunnel.
Configure an MPLS TE tunnel and enable IGP Shortcut for it on DeviceB.
Enable OSPF local MT on DeviceB.
Data Preparation
To complete the configuration, you need the following data:
- Table 1-627 lists the IP addresses of interfaces on the router.
The TE tunnel interface Tunnel 10 uses the IP address of Loopback 0 and runs the MPLS TE protocol. The destination address of the TE tunnel is 4.4.4.4, and the tunnel ID is 100. The TE tunnel uses RSVP-TE as a signaling protocol.
Procedure
- Assign an IP address to each interface.
Figure 1-1529 shows how to assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions.
Configuring Basic OSPF Functions shows how to configure basic OSPF functions. For configuration details, see Configuration Files in this section.
- Configure Protocol Independent Multicast-Sparse Mode (PIM-SM).
# Enable PIM-SM on DeviceA.
[~DeviceA] multicast routing-enable
[*DeviceA] interface Gigabitethernet 0/2/0
[~DeviceA-GigabitEthernet0/2/0] pim sm
[*DeviceA-GigabitEthernet0/2/0] quit
[*DeviceA] interface Gigabitethernet 0/1/0
[*DeviceA-GigabitEthernet0/1/0] pim sm
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] quit
Enable PIM-SM on each Device. The configurations for DeviceB, DeviceC, DeviceD, and DeviceE are similar to those on DeviceA. For configuration details, see Configuration Files in this section.
# Enable Internet Group Management Protocol (IGMP) on GE 0/1/0 of DeviceA.
[~DeviceA] interface Gigabitethernet 0/1/0
[~DeviceA-GigabitEthernet0/1/0] igmp enable
[*DeviceA-GigabitEthernet0/1/0] igmp version 3
[*DeviceA-GigabitEthernet0/1/0] commit
[~DeviceA-GigabitEthernet0/1/0] quit
# Configure a C-BSR and a C-RP. Set the service range of the RP on DeviceD and specify the locations of the C-BSR and the C-RP.
[~DeviceD] pim
[*DeviceD-pim] c-bsr Gigabitethernet 0/1/0
[*DeviceD-pim] c-rp Gigabitethernet 0/1/0
[*DeviceD-pim] commit
[~DeviceD-pim] quit
# Check the multicast routing table on DeviceC.
[~DeviceC] display multicast routing-table
Multicast routing table of VPN-Instance: public net Total 3 entries 00001. (192.168.3.8, 224.31.31.31) Uptime: 15:03:04 Upstream Interface: GigabitEthernet0/2/0 List of 1 downstream interface 1: GigabitEthernet0/1/0 00002. (192.168.3.9, 224.31.31.31) Uptime: 15:03:04 Upstream Interface: GigabitEthernet0/2/0 List of 1 downstream interface 1: GigabitEthernet0/1/0 00003. (192.168.3.10, 224.31.31.31) Uptime: 15:03:04 Upstream Interface: GigabitEthernet0/2/0 List of 1 downstream interface 1: GigabitEthernet0/1/0
The preceding command output shows information about the multicast routing table on DeviceC.
- Configure an MPLS RSVP-TE tunnel.
# Configure DeviceB.
[~DeviceB] mpls lsr-id 2.2.2.2
[*DeviceB] mpls
[*DeviceB-mpls] mpls te
[*DeviceB-mpls] mpls rsvp-te
[*DeviceB-mpls] mpls te cspf
[*DeviceB-mpls] commit
[*DeviceB-mpls] quit
[*DeviceB] interface Gigabitethernet 0/2/0
[*DeviceB-GigabitEthernet0/2/0] mpls
[*DeviceB-GigabitEthernet0/2/0] mpls te
[*DeviceB-GigabitEthernet0/2/0] mpls rsvp-te
[*DeviceB-GigabitEthernet0/2/0] commit
[*DeviceB-GigabitEthernet0/2/0] quit
[*DeviceB] ospf 1
[*DeviceB-ospf-1] enable traffic-adjustment
[*DeviceB-ospf-1] opaque-capability enable
[*DeviceB-ospf-1] area 0.0.0.0
[*DeviceB-ospf-1-area-0.0.0.0] mpls-te enable
[*DeviceB-ospf-1-area-0.0.0.0] commit
[*DeviceB-ospf-1-area-0.0.0.0] quit
# Configure DeviceC.
[~DeviceC] mpls lsr-id 3.3.3.3
[*DeviceC] mpls
[*DeviceC-mpls] mpls te
[*DeviceC-mpls] mpls rsvp-te
[*DeviceC-mpls] commit
[*DeviceC-mpls] quit
[*DeviceC] interface Gigabitethernet 0/1/0
[*DeviceC-GigabitEthernet0/1/0] mpls
[*DeviceC-GigabitEthernet0/1/0] mpls te
[*DeviceC-GigabitEthernet0/1/0] mpls rsvp-te
[*DeviceC-GigabitEthernet0/1/0] commit
[*DeviceC-GigabitEthernet0/1/0] quit
[*DeviceC] interface Gigabitethernet 0/2/0
[*DeviceC-GigabitEthernet0/2/0] mpls
[*DeviceC-GigabitEthernet0/2/0] mpls te
[*DeviceC-GigabitEthernet0/2/0] mpls rsvp-te
[*DeviceC-GigabitEthernet0/2/0] commit
[*DeviceC-GigabitEthernet0/2/0] quit
[*DeviceC] ospf 1
[*DeviceC-ospf-1] opaque-capability enable
[*DeviceC-ospf-1] area 0.0.0.0
[*DeviceC-ospf-1-area-0.0.0.0] mpls-te enable
[*DeviceC-ospf-1-area-0.0.0.0] commit
[*DeviceC-ospf-1-area-0.0.0.0] quit
# Configure DeviceD.
[~DeviceD] mpls lsr-id 4.4.4.4
[*DeviceD] mpls
[*DeviceD-mpls] mpls te
[*DeviceD-mpls] mpls rsvp-te
[*DeviceD-mpls] commit
[*DeviceD-mpls] quit
[~DeviceD] interface Gigabitethernet 0/2/0
[*DeviceD-GigabitEthernet0/2/0] mpls
[*DeviceD-GigabitEthernet0/2/0] mpls te
[*DeviceD-GigabitEthernet0/2/0] mpls rsvp-te
[*DeviceD-GigabitEthernet0/2/0] commit
[~DeviceD-GigabitEthernet0/2/0] quit
[*DeviceD] ospf 1
[*DeviceD-ospf-1] opaque-capability enable
[*DeviceD-ospf-1] area 0.0.0.0
[*DeviceD-ospf-1-area-0.0.0.0] mpls-te enable
[*DeviceD-ospf-1-area-0.0.0.0] commit
[*DeviceD-ospf-1-area-0.0.0.0] quit
- Configure an MPLS TE tunnel and enable IGP Shortcut.
# Configure an MPLS TE tunnel and enable IGP Shortcut for it on DeviceB.
[*DeviceB] interface Tunnel 10
[*DeviceB-Tunnel10] ip address unnumbered interface loopback 0
[*DeviceB-Tunnel10] tunnel-protocol mpls te
[*DeviceB-Tunnel10] destination 4.4.4.4
[*DeviceB-Tunnel10] mpls te tunnel-id 100
[*DeviceB-Tunnel10] mpls te igp shortcut ospf
[*DeviceB-Tunnel10] mpls te igp metric relative -10
[*DeviceB-Tunnel10] commit
[*DeviceB-Tunnel10] quit
# Check the OSPF routing table on DeviceB. Information shows that an MPLS TE tunnel has been set up.
[*DeviceB] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ---------------------------------------------------------------------------- Routing Table: _public_ Destinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface 2.2.2.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 3.3.3.3/32 OSPF 10 1 D 10.0.1.1 GigabitEthernet0/2/0 4.4.4.4/32 OSPF 10 1 D 2.2.2.2 Tunnel10 5.5.5.5/32 OSPF 10 2 D 2.2.2.2 Tunnel10 10.0.0.0/24 Direct 0 0 D 10.0.0.2 GigabitEthernet0/1/0 10.0.0.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.0.1.0/24 Direct 0 0 D 10.0.1.2 GigabitEthernet0/2/0 10.0.1.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.0.2.0/24 OSPF 10 2 D 10.0.1.1 GigabitEthernet0/2/0 OSPF 10 2 D 10.0.1.1 Tunnel10 10.0.3.0/24 OSPF 10 2 D 2.2.2.2 Tunnel10 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.1.0/24 OSPF 10 2 D 10.0.0.1 GigabitEthernet0/2/0 192.168.3.0/24 OSPF 10 3 D 2.2.2.2 Tunnel10
# Check the multicast routing table on DeviceC.
[~DeviceC] display multicast routing-table
No multicast entry is displayed, indicating that multicast packets are discarded.
- Enable OSPF local MT.
# Enable OSPF local MT on DeviceB.
[*DeviceB] ospf
[*DeviceB-ospf-1] local-mt enable
[*DeviceB-ospf-1] commit
[*DeviceB-ospf-1] quit
- Verify the configuration.
# Check the multicast routing table on DeviceC.
[*DeviceC] display multicast routing-table
Multicast routing table of VPN-Instance: public net Total 3 entries 00001. (192.168.3.8, 224.31.31.31) Uptime: 00:00:19 Upstream Interface: GigabitEthernet0/2/0 List of 1 downstream interface 1: GigabitEthernet0/1/0 00002. (192.168.3.9, 224.31.31.31) Uptime: 00:00:19 Upstream Interface: GigabitEthernet0/2/0 List of 1 downstream interface 1: GigabitEthernet0/1/0 00003. (192.168.3.10, 224.31.31.31) Uptime: 00:00:19 Upstream Interface: GigabitEthernet0/2/0 List of 1 downstream interface 1: GigabitEthernet0/1/0
The preceding command output shows information about the multicast routing table on DeviceC.
Configuration Files
DeviceA configuration file
#
sysname DeviceA
#
router id 1.1.1.1
#
multicast routing-enable
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.0.0.1 255.255.255.0
pim sm
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
pim sm
igmp enable
igmp version 3
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ospf 1
area 0.0.0.0
network 172.16.1.0 0.0.0.255
network 10.0.0.0 0.0.0.255
network 1.1.1.1 0.0.0.0
#
return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
multicast routing-enable
#
mpls lsr-id 2.2.2.2
#
mpls
mpls te
mpls rsvp-te
mpls te cspf
#
ospf 1
opaque-capability enable
enable traffic-adjustment
local-mt enable
area 0.0.0.0
network 10.0.0.0 0.0.0.255
network 10.0.1.0 0.0.0.255
network 2.2.2.2 0.0.0.0
mpls-te enable
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.0.0.2 255.255.255.0
pim sm
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.0.1.2 255.255.255.0
pim sm
mpls
mpls te
mpls rsvp-te
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
pim sm
#
interface Tunnel10
ip address unnumbered interface LoopBack0
tunnel-protocol mpls te
destination 4.4.4.4
mpls te tunnel-id 100
mpls te igp shortcut ospf
mpls te igp metric relative -10
#
pim
C-BSR LoopBack0
C-RP LoopBack0
#
return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
multicast routing-enable
#
mpls lsr-id 3.3.3.3
#
mpls
mpls te
mpls rsvp-te
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.0.1.0 0.0.0.255
network 10.0.2.0 0.0.0.255
network 3.3.3.3 0.0.0.0
mpls-te enable
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.0.1.1 255.255.255.0
pim sm
mpls
mpls te
mpls rsvp-te
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.0.2.2 255.255.255.0
pim sm
mpls
mpls te
mpls rsvp-te
#
interface LoopBack0
undo shutdown
ip address 3.3.3.3 255.255.255.255
#
return
DeviceD configuration file
#
sysname DeviceD
#
router id 4.4.4.4
#
multicast routing-enable
#
mpls lsr-id 4.4.4.4
#
mpls
mpls te
mpls rsvp-te
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.0.3.1 255.255.255.0
pim sm
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.0.2.1 255.255.255.0
pim sm
mpls
mpls te
mpls rsvp-te
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
pim sm
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.0.2.0 0.0.0.255
network 10.0.3.0 0.0.0.255
network 4.4.4.4 0.0.0.0
mpls-te enable
#
pim
C-BSR GigabitEthernet0/1/0
C-RP GigabitEthernet0/1/0
#
return
Device E configuration file
#
sysname DeviceE
#
router id 5.5.5.5
#
multicast routing-enable
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.0.3.2 255.255.255.0
pim sm
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.3.1 255.255.255.0
pim sm
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
pim sm
#
ospf 1
area 0.0.0.0
network 10.0.3.0 0.0.0.255
network 192.168.3.0 0.0.0.255
network 5.5.5.5 0.0.0.0
#
return
Example for Configuring OSPF IP FRR
This section describes how to configure OSPF IP FRR with an example, including how to block FRR on certain interfaces to prevent the links connected to these interfaces from functioning as backup links and how to bind OSPF IP FRR to a BFD session.
Networking Requirements
- It takes hundreds of milliseconds for the traffic to be switched to a backup link. During this period, services are interrupted.
- Traffic may be switched to the link that passes through DeviceA. DeviceA is an ASBR and is not expected to function as a backup device.
If 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 prevent the link which passes through DeviceA from functioning as the FRR backup link.
- All routers run OSPF.
- The link cost meets the OSPF IP FRR traffic protection inequality.
If the primary link T fails, Device S immediately switches traffic to the backup link which passes through DeviceN.
- Based on the network planning, the link which passes through DeviceA does not function as an FRR backup link.
Precautions
When configuring OSPF IP FRR, note the following rules:
Before configuring OSPF IP FRR, block FRR on certain interfaces to prevent the links connected to these interfaces from functioning as backup links. 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 so that link faults can be rapidly detected.
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
Configure basic OSPF functions on each router.
Configure BFD for OSPF on all the devices in Area 0.
Set the costs of links to ensure that link T is selected to transmit traffic.
Block FRR on a specified interface of DeviceS.
- Enable OSPF IP FRR on DeviceS to protect the traffic forwarded by DeviceS.
Data Preparation
To complete the configuration, you need the following data:
Device |
Router ID |
Interface |
IP Address |
---|---|---|---|
DeviceS |
1.1.1.1 |
GE0/1/0 |
10.1.1.1/24 |
GE0/2/0 |
10.1.2.1/24 |
||
GE0/3/0 |
10.1.3.1/24 |
||
DeviceA |
2.2.2.2 |
GE0/1/0 |
10.1.1.2/24 |
GE0/2/0 |
10.2.1.2/24 |
||
DeviceN |
3.3.3.3 |
GE0/1/0 |
10.1.3.2/24 |
GE0/2/0 |
10.2.3.2/24 |
||
DeviceE |
4.4.4.4 |
GE0/1/0 |
10.2.1.1/24 |
GE0/2/0 |
10.1.2.2/24 |
||
GE0/3/0 |
10.2.3.1/24 |
||
GE0/1/1 |
172.17.1.1/24 |
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Configure BFD for OSPF on all the devices in Area 0. For details, see Example for Configuring BFD for OSPF.
- Set the costs of links to ensure that link T is selected to transmit traffic.
# Configure DeviceS.
[~DeviceS] interface gigabitethernet0/1/0
[*DeviceS-GigabitEthernet0/1/0] ospf cost 10
[*DeviceS-GigabitEthernet0/1/0] quit
[*DeviceS] interface gigabitethernet0/2/0
[*DeviceS-GigabitEthernet0/2/0] ospf cost 15
[*DeviceS-GigabitEthernet0/2/0] quit
[*DeviceS] interface gigabitethernet0/3/0
[*DeviceS-GigabitEthernet0/3/0] ospf cost 10
[*DeviceS-GigabitEthernet0/3/0] quit
[*DeviceS] commit
# Configure DeviceA.
[~DeviceA] interface gigabitethernet0/2/0
[*DeviceA-GigabitEthernet0/2/0] ospf cost 15
[*DeviceA-GigabitEthernet0/2/0] quit
[*DeviceA] commit
# Configure DeviceN.
[~DeviceN] interface gigabitethernet0/2/0
[*DeviceN-GigabitEthernet0/2/0] ospf cost 10
[*DeviceN-GigabitEthernet0/2/0] quit
[*DeviceN] commit
- Block FRR on a specified interface of DeviceS.
[~DeviceS] interface gigabitethernet0/1/0
[*DeviceS-GigabitEthernet0/1/0] ospf frr block
[*DeviceS-GigabitEthernet0/1/0] quit
[*DeviceS] commit
- Enable OSPF IP FRR on DeviceS.
# Enable OSPF IP FRR on DeviceS.
[~DeviceS] ospf
[*DeviceS-ospf-1] frr
[*DeviceS-ospf-1-frr] loop-free-alternate
[*DeviceS-ospf] commit
- Verify the configuration.
# Run the display ospf routing router-id command on DeviceS to view routing information.
[~DeviceS-ospf-1-frr] display ospf routing router-id 4.4.4.4
OSPF Process 1 with Router ID 1.1.1.1 Destination : 4.4.4.4 Route Type : Intra-area Area : 0.0.0.1 AdvRouter : 4.4.4.4 Type : ASBR URT Cost : 59 NextHop : 10.2.2.1. Interface : GE0/2/0 Backup Nexthop : 10.1.3.2 Backup Interface : GE0/3/0 Backup Type : LFA LINK BakLabelStack : {48092,48092}
The preceding display shows that a backup route is generated on DeviceS.
Configuration Files
Device S configuration file
# sysname DeviceS # bfd # interface GigabitEthernet0/1/0 ip address 10.1.1.1 255.255.255.0 ospf frr block ospf cost 10 # interface GigabitEthernet0/2/0 ip address 10.1.2.1 255.255.255.0 ospf cost 15 # interface GigabitEthernet0/3/0 ip address 10.1.3.1 255.255.255.0 ospf cost 10 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # ospf 1 router-id 1.1.1.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
DeviceA configuration file
# sysname DeviceA # bfd # interface GigabitEthernet0/1/0 ip address 10.1.1.2 255.255.255.0 ospf cost 10 # interface GigabitEthernet0/2/0 ip address 10.2.1.2 255.255.255.0 ospf cost 15 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # ospf 1 router-id 2.2.2.2 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.2.2.0 0.0.0.255 # return
DeviceN configuration file
# sysname DeviceN # bfd # interface GigabitEthernet0/1/0 ip address 10.1.3.2 255.255.255.0 ospf cost 10 # interface GigabitEthernet0/2/0 ip address 10.2.3.2 255.255.255.0 ospf cost 10 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # ospf 1 router-id 3.3.3.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 network 10.2.3.0 0.0.0.255 # return
DeviceE configuration file
# sysname DeviceE # bfd # interface GigabitEthernet0/1/0 ip address 10.2.1.1 255.255.255.0 # interface GigabitEthernet0/2/0 ip address 10.1.2.2 255.255.255.0 # interface GigabitEthernet0/3/0 ip address 10.2.3.1 255.255.255.0 # interface GigabitEthernet0/1/1 ip address 172.17.1.1 255.255.255.0 ospf cost 5 # interface LoopBack0 ip address 4.4.4.4 255.255.255.255 # ospf 1 router-id 4.4.4.4 bfd all-interfaces enable bfd all-interfaces frr-binding 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 network 172.17.1.0 0.0.0.255 # return
Example for Configuring BFD for OSPF
This section describes how to configure BFD for OSPF. After BFD for OSPF is configured, BFD can fast detect link faults and report them to OSPF so that service traffic can be transmitted through the backup link.
Networking Requirements
OSPF enables the device to periodically send Hello packets to a neighboring device for fault detection. Detecting a fault takes more than 1s. With the development of technologies, voice, video, and other VOD services are widely used. These services are quite sensitive to packet loss and delays. When traffic is transmitted at gigabit rates, long-time fault detection will cause packet loss. This cannot meet high reliability requirements of the carrier-class network. BFD for OSPF is used to resolve the problem. After BFD for OSPF is configured, the link status can be rapidly detected and fault detection can be completed in milliseconds. This speeds up OSPF convergence when the link status changes.
For example, as shown in Figure 1-1531, the primary link DeviceA -> DeviceB and the secondary link DeviceA -> DeviceC -> DeviceB are deployed on the network. Traffic is transmitted on the primary link normally. When the primary link becomes faulty, the Device is expected to rapidly detect the fault and switch traffic to the secondary link.
You can configure BFD for OSPF to detect the OSPF neighbor relationship between DeviceA and DeviceB. When the link between DeviceA and DeviceB fails, BFD can rapidly detect the failure and report it to OSPF. Traffic is then switched to the secondary link.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each router for interconnection.
Enable global BFD.
Enable OSPF BFD on DeviceA and DeviceB.
Data Preparation
To complete the configuration, you need the following data:
Data of DeviceA, including the router ID (1.1.1.1), OSPF process number (1), and network segment addresses of Area 0 (3.3.3.0/24 and 1.1.1.0/24)
Data of DeviceB, including the router ID (2.2.2.2), OSPF process number (1), and network segment addresses of Area 0 (3.3.3.0/24, 2.2.2.0/24, and 172.16.1.0/24)
Data of DeviceC, including the router ID (3.3.3.3), OSPF process number (1), and network segment addresses of Area 0 (1.1.1.0/24 and 2.2.2.0/24)
Minimum interval at which BFD packets are received and sent and local detection multiplier on DeviceA and DeviceB
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions.
# Configure DeviceA.
[~DeviceA] router id 1.1.1.1
[*DeviceA] ospf 1
[*DeviceA-ospf-1] area 0
[*DeviceA-ospf-1-area-0.0.0.0] network 1.1.1.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.0] network 3.3.3.0 0.0.0.255
[*DeviceA-ospf-1-area-0.0.0.0] commit
[~DeviceA-ospf-1-area-0.0.0.0] quit
[~DeviceA-ospf-1] quit
# Configure DeviceB.
[~DeviceB] router id 2.2.2.2
[*DeviceB] ospf 1
[*DeviceB-ospf-1] area 0
[*DeviceB-ospf-1-area-0.0.0.0] network 2.2.2.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 3.3.3.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[*DeviceB-ospf-1-area-0.0.0.0] commit
[~DeviceB-ospf-1-area-0.0.0.0] quit
[~DeviceB-ospf-1] quit
# Configure DeviceC.
[~DeviceC] router id 3.3.3.3
[*DeviceC] ospf 1
[*DeviceC-ospf-1] area 0
[*DeviceC-ospf-1-area-0.0.0.0] network 1.1.1.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] network 2.2.2.0 0.0.0.255
[*DeviceC-ospf-1-area-0.0.0.0] commit
[~DeviceC-ospf-1-area-0.0.0.0] quit
[~DeviceC-ospf-1] quit
# After the preceding configurations, run the display ospf peer command. You can view that a neighbor relationship is established between DeviceA and DeviceB, and between DeviceB and DeviceC. The following example uses the command output on DeviceA.
<DeviceA> display ospf peer
(M) Indicates MADJ interface OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface 3.3.3.1 ( GE0/2/0 )'s neighbors Router ID: 2.2.2.2 Address: 3.3.3.2 State: Full Mode:Nbr is Master Priority: 1 DR: 3.3.3.1 BDR: 3.3.3.2 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ] Area 0.0.0.0 interface 1.1.1.1 ( GE0/1/0 )'s neighbors Router ID: 3.3.3.3 Address: 1.1.1.2 State: Full Mode:Nbr is Master Priority: 1 DR: 1.1.1.1 BDR: 1.1.1.2 MTU: 0 Dead timer due in 39 sec Retrans timer interval: 5 Neighbor is up for 1h15m4s Neighbor up time : 2020-06-08 01:41:57 Authentication Sequence: [ 0 ]
# Display information about the OSPF routing table on DeviceA, and you can view the routing entries to DeviceB and DeviceC. The next hop address of the route to 172.16.1.0/24 is 3.3.3.2, and service traffic is transmitted on the primary link (DeviceA → DeviceB).
<DeviceA> display ospf routing
OSPF Process 1 with Router ID 1.1.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 2.2.2.0/24 2 Stub 1.1.1.2 3.3.3.3 0.0.0.0 172.16.1.0/24 2 Stub 3.3.3.2 2.2.2.2 0.0.0.0 Total Nets: 2 Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
- Configure OSPF BFD.
# Enable global BFD on DeviceA.
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] ospf 1
[*DeviceA-ospf-1] bfd all-interfaces enable
[*DeviceA-ospf-1] commit
[~DeviceA-ospf-1] quit
# Enable global BFD on DeviceB.
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] ospf 1
[*DeviceB-ospf-1] bfd all-interfaces enable
[*DeviceB-ospf-1] commit
[~DeviceB-ospf-1] quit
# Enable global BFD on DeviceC.
[~DeviceC] bfd
[*DeviceC-bfd] quit
[*DeviceC] ospf 1
[*DeviceC-ospf-1] bfd all-interfaces enable
[*DeviceC-ospf-1] commit
[~DeviceC-ospf-1] quit
# After the preceding configurations, run the display ospf bfd session all command on DeviceA, DeviceB, or DeviceC. You can view that the BFD session is Up.
Use the command output DeviceA as an example.
[~DeviceA] display ospf bfd session all
OSPF Process 1 with Router ID 1.1.1.1 Area 0.0.0.0 interface 1.1.1.1(GE0/1/0)'s BFD Sessions NeighborId:2.2.2.2 AreaId:0.0.0.0 Interface:GE0/1/0 BFDState:up rx :1000 tx :1000 Multiplier:3 BFD Local Dis:0 LocalIpAdd:1.1.1.1 RemoteIpAdd:1.1.1.2 Diagnostic Info:0 Area 0.0.0.0 interface 3.3.3.1(GE0/2/0)'s BFD Sessions NeighborId:3.3.3.3 AreaId:0.0.0.0 Interface:GE0/2/0 BFDState:up rx :1000 tx :1000 Multiplier:3 BFD Local Dis:0 LocalIpAdd:3.3.3.1 RemoteIpAdd:3.3.3.2 Diagnostic Info:0
- Configure BFD on an interface.
# Configure BFD on GigabitEthernet 0/2/0 of DeviceA. Set the minimum intervals at which packets are received and sent to 500 ms and the local detection multiplier to 4.
[~DeviceA] interface gigabitethernet 0/2/0
[*DeviceA-GigabitEthernet0/2/0] ospf bfd enable
[*DeviceA-GigabitEthernet0/2/0] ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4
[*DeviceA-GigabitEthernet0/2/0] commit
[~DeviceA-GigabitEthernet0/2/0] quit
# Configure BFD on GigabitEthernet 0/2/0 of DeviceB. Set the minimum intervals at which packets are received and sent to 500 ms and the local detection multiplier to 4.
[~DeviceB] interface gigabitethernet 0/2/0
[*DeviceB-GigabitEthernet0/2/0] ospf bfd enable
[*DeviceB-GigabitEthernet0/2/0] ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4
[*DeviceB-GigabitEthernet0/2/0] commit
[~DeviceB-GigabitEthernet0/2/0] quit
# After the preceding configurations, run the display ospf bfd session all command on DeviceA or DeviceB. You can check that the minimum intervals at which packets are sent and received are 500 ms and that the local detection multiplier is 4.
Use the command output DeviceB as an example.
[~DeviceB] display ospf bfd session all
OSPF Process 1 with Router ID 2.2.2.2 Area 0.0.0.0 interface 3.3.3.2(GE0/2/0)'s BFD Sessions NeighborId:1.1.1.1 AreaId:0.0.0.0 Interface: GigabitEthernet0/2/0 BFDState:up rx :500 tx :500 Multiplier:4 BFD Local Dis:0 LocalIpAdd:3.3.3.2 RemoteIpAdd:3.3.3.1 Diagnostic Info:0 Area 0.0.0.0 interface 2.2.2.2(GE0/1/0)'s BFD Sessions NeighborId:3.3.3.3 AreaId:0.0.0.0 Interface: GE0/1/0 BFDState:up rx :1000 tx :1000 Multiplier:3 BFD Local Dis:0 LocalIpAdd:2.2.2.2 RemoteIpAdd:2.2.2.1 Diagnostic Info:0
- Verify the configuration.
# Run the shutdown command on GigabitEthernet 0/2/0 of DeviceB to simulate a primary link failure.
[~DeviceB] interface gigabitethernet 0/2/0
[*DeviceB-GigabitEthernet0/2/0] shutdown
[*DeviceB-GigabitEthernet0/2/0] commit
# Display the routing table on routerDeviceA. You can view that the backup link (DeviceA - DeviceC - DeviceB) takes effect after the primary link fails and that the next hop address of the route to 172.16.1.0/24 is 1.1.1.2.
<DeviceA> display ospf routing
OSPF Process 1 with Router ID 1.1.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 2.2.2.0/24 2 Stub 1.1.1.2 3.3.3.3 0.0.0.0 172.16.1.0/24 3 Stub 1.1.1.2 2.2.2.2 0.0.0.0 Total Nets: 2 Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
Configuration Files
DeviceA configuration file
# sysname DeviceA # router id 1.1.1.1 # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 1.1.1.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 3.3.3.1 255.255.255.0 ospf bfd enable ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4 # ospf 1 bfd all-interfaces enable area 0.0.0.0 network 3.3.3.0 0.0.0.255 network 1.1.1.0 0.0.0.255 # return
DeviceB configuration file
#
sysname DeviceB
#
router id 2.2.2.2
#
bfd
#
interface GigabitEthernet0/1/0 undo shutdown ip address 2.2.2.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 3.3.3.2 255.255.255.0 ospf bfd enable ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4 # interface GigabitEthernet0/3/0 undo shutdown ip address 172.16.1.1 255.255.255.0 # ospf 1 bfd all-interfaces enable area 0.0.0.0 network 3.3.3.0 0.0.0.255 network 2.2.2.0 0.0.0.255 network 172.16.1.0 0.0.0.255 # return
DeviceC configuration file
#
sysname DeviceC
#
router id 3.3.3.3
#
bfd
#
interface GigabitEthernet0/1/0 undo shutdown ip address 1.1.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 2.2.2.1 255.255.255.0 ospf bfd enable # ospf 1 bfd all-interfaces enable area 0.0.0.0 network 1.1.1.0 0.0.0.255 network 2.2.2.0 0.0.0.255 # return
Example for Configuring OSPF-BGP Synchronization
This section describes how to configure OSPF-BGP synchronization to minimize the impact of router restart on BGP services on the network.
Networking Requirements
On the network shown in Figure 1-1532, all routers run BGP. An EBGP connection is set up between DeviceD and DeviceE. IBGP connections are set up between devices in AS 10, and OSPF is used as an IGP protocol.
OSPF-BGP synchronization is required on DeviceB so that the restart of DeviceB does not interrupt the traffic from DeviceA to AS 20.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Enable OSPF on DeviceA, DeviceB, DeviceC, and DeviceD (except 10.2.1.1/30) and specify the same area for all OSPF interfaces.
Set up IBGP connections between DeviceA, DeviceB, DeviceC, and DeviceD (except 10.2.1.1/30).
Configure the OSPF cost on DeviceC.
Set up EBGP connections between DeviceD and DeviceE.
Configure BGP to import direct routes and OSPF processes on DeviceD.
Configure BGP on DeviceE.
Data Preparation
To complete the configuration, you need the following data:
Data of DeviceA, including the router ID (1.1.1.1), number of the AS to which DeviceA belongs (10), OSPF process ID (1), network segment addresses of area 0 (10.1.1.0/30 and 10.1.2.0/30), and loopback0 IP address (1.1.1.1/32)
Data of DeviceB, including the router ID (2.2.2.2), number of the AS to which DeviceB belongs (10), OSPF process ID (1), network segment addresses of area 0 (10.1.1.0/30 and 10.1.3.0/30), and loopback0 IP address (2.2.2.2/32)
Data of DeviceC, including the router ID (3.3.3.3), number of the AS to which DeviceC belongs (10), OSPF process ID (1), network segment addresses of area 0 (10.1.2.0/30 and 10.1.4.0/30), and loopback0 IP address (3.3.3.3/32)
Data of DeviceD, including the router ID (4.4.4.4), number of the AS to which DeviceD belongs (10), OSPF process ID (1), network segment addresses of area 0 (10.1.3.0/30 and 10.1.4.0/30), and loopback0 IP address (4.4.4.4/32)
Data of DeviceE, including the router ID (5.5.5.5), number of the AS to which DeviceE belongs (20), and loopback0 IP address (5.5.5.5/32)
Procedure
- Assign an IP address to each interface. For configuration details, see Configuration Files in this section.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Set up IBGP connections.
# Configure DeviceA.
<DeviceA> system-view
[~DeviceA] interface loopback 0
[~DeviceA-LoopBack0] ip address 1.1.1.1 32
[*DeviceA-LoopBack0] quit
[*DeviceA] bgp 10
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 2.2.2.2 as-number 10 [*DeviceA-bgp] peer 2.2.2.2 connect-interface LoopBack 0 [*DeviceA-bgp] peer 3.3.3.3 as-number 10 [*DeviceA-bgp] peer 3.3.3.3 connect-interface LoopBack 0 [*DeviceA-bgp] peer 4.4.4.4 as-number 10 [*DeviceA-bgp] peer 4.4.4.4 connect-interface LoopBack 0
[*DeviceA-bgp] quit
[*DeviceA] commit
# Configure DeviceB.
<DeviceB> system-view
[~DeviceB] interface loopback 0
[~DeviceB-LoopBack0] ip address 2.2.2.2 32
[*DeviceB-LoopBack0] quit
[*DeviceB] bgp 10
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 1.1.1.1 as-number 10 [*DeviceB-bgp] peer 1.1.1.1 connect-interface LoopBack 0 [*DeviceB-bgp] peer 3.3.3.3 as-number 10 [*DeviceB-bgp] peer 3.3.3.3 connect-interface LoopBack 0 [*DeviceB-bgp] peer 4.4.4.4 as-number 10 [*DeviceB-bgp] peer 4.4.4.4 connect-interface LoopBack 0
[*DeviceB-bgp] quit
[*DeviceB] commit
# Configure DeviceC.
<DeviceC> system-view
[~DeviceC] interface loopback 0
[~DeviceC-LoopBack0] ip address 3.3.3.3 32
[*DeviceC-LoopBack0] quit
[*DeviceC] bgp 10
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 1.1.1.1 as-number 10 [*DeviceC-bgp] peer 1.1.1.1 connect-interface LoopBack 0 [*DeviceC-bgp] peer 2.2.2.2 as-number 10 [*DeviceC-bgp] peer 2.2.2.2 connect-interface LoopBack 0 [*DeviceC-bgp] peer 4.4.4.4 as-number 10 [*DeviceC-bgp] peer 4.4.4.4 connect-interface LoopBack 0
[*DeviceC-bgp] quit
[*DeviceC] commit
# Configure DeviceD.
<DeviceD> system-view
[~DeviceD] interface loopback 0
[~DeviceD-LoopBack0] ip address 4.4.4.4 32
[*DeviceD-LoopBack0] quit
[*DeviceD] bgp 10
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] peer 1.1.1.1 as-number 10 [*DeviceD-bgp] peer 1.1.1.1 connect-interface LoopBack 0 [*DeviceD-bgp] peer 2.2.2.2 as-number 10 [*DeviceD-bgp] peer 2.2.2.2 connect-interface LoopBack 0 [*DeviceD-bgp] peer 3.3.3.3 as-number 10 [*DeviceD-bgp] peer 3.3.3.3 connect-interface LoopBack 0
[*DeviceD-bgp] quit
[*DeviceD] commit
- Set up EBGP connections.
# Configure DeviceD.
[~DeviceD] bgp 10
[*DeviceD-bgp] peer 10.2.1.2 as-number 20
[*DeviceD-bgp] import-route direct
[*DeviceD-bgp] import-route ospf 1
[*DeviceD-bgp] quit
[*DeviceD] commit
# Configure DeviceE.
[~DeviceE] bgp 20
[*DeviceE-bgp] peer 10.2.1.1 as-number 10
[*DeviceE-bgp] ipv4-family unicast
[*DeviceE-bgp-af-ipv4] network 10.3.1.0 30
[*DeviceE-bgp-af-ipv4] quit
[*DeviceE-bgp] commit
- Configure the OSPF cost on DeviceC.
[~DeviceC] interface gigabitethernet 0/1/0
[*DeviceC-GigabitEthernet0/1/0] ospf cost 2
[*DeviceC-GigabitEthernet0/1/0] quit
[~DeviceC] interface gigabitethernet 0/2/0
[*DeviceC-GigabitEthernet0/2/0] ospf cost 2
[*DeviceC-GigabitEthernet0/2/0] commit
[~DeviceC-GigabitEthernet0/2/0] quit
After the OSPF cost is set to 2 on DeviceC, DeviceA selects only DeviceB as the intermediate device to the network segment 10.2.1.0, and DeviceC becomes a backup of DeviceB.
# Display the routing table on DeviceA. BGP learns the route to 10.1.3.0, and the outbound interface is GE 0/1/0.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: _public_ Destinations : 20 Routes : 20 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 1.1.1.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 2.2.2.2/32 OSPF 10 3 D 10.1.1.2 GigabitEthernet0/1/0 4.4.4.0/24 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/1/0 4.4.4.4/32 OSPF 10 3 D 10.1.1.2 GigabitEthernet0/1/0 5.5.5.0/24 BGP 255 0 RD 10.2.1.2 GigabitEthernet0/1/0 10.1.1.0/30 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.3/32 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.1.255/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.255/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.2.0/30 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.3/32 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.2.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.2.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/2/0 10.1.2.255/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.3.1.0/30 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/1/0 10.1.3.1/32 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/1/0 10.1.4.0/30 OSPF 10 3 D 10.1.1.2 GigabitEthernet0/1/0 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0 10.1.4.1/32 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/1/0 10.2.1.0/30 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/1/0 10.2.1.2/32 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/1/0 10.3.1.0/30 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/1/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# Display the routing table on DeviceB.
[~DeviceB] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: _public_ Destinations : 19 Routes : 19 Destination/Mask Proto Pre Cost Flags NextHop Interface 2.2.2.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 2.2.2.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 1.1.1.1/32 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/1/0 4.4.4.0/24 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 4.4.4.4/32 OSPF 10 2 D 10.1.3.2 GigabitEthernet0/2/0 5.5.5.0/24 BGP 255 0 RD 10.2.1.2 GigabitEthernet0/2/0 10.1.1.0/30 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.3/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.255/32 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.2.0/30 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/1/0 10.1.3.0/30 Direct 0 0 D 10.1.3.1 GigabitEthernet0/2/0 10.1.3.3/32 Direct 0 0 D 10.1.3.1 GigabitEthernet0/2/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.3.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.3.2/32 Direct 0 0 D 10.1.3.2 GigabitEthernet0/2/0 10.1.3.255/32 Direct 0 0 D 10.1.3.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.4.0/30 OSPF 10 2 D 10.1.3.2 GigabitEthernet0/2/0 10.1.4.1/32 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 10.2.1.0/30 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 10.2.1.2/32 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 10.3.1.0/30 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
As shown in the routing table, DeviceB learns the route to 10.3.1.0 through BGP, and the outbound interface is GE 0/2/0. The routes to 10.1.2.0 and 10.1.4.0 can be learned through OSPF. The costs of these routes are both 2.
- Enable OSPF-BGP synchronization on DeviceB.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] stub-router on-startup
[*DeviceB-ospf-1] commit
- Verify the configuration.
# Restart router DeviceB.
Exercise caution when running this command because it may lead to a temporary network crash. In addition, save the configuration file of the router before restarting it.
<DeviceB> reboot
System will reboot! Continue?[Y/N] y
# Display the routing table on DeviceA. As shown in the routing table, BGP learns the route to 10.3.1.0, and the outbound interface is GigabitEthernet0/2/0.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: _public_ Destinations : 20 Routes : 20 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 2.2.2.2/32 OSPF 10 4 D 10.1.2.2 GigabitEthernet0/2/0 4.4.4.0/24 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/2/0 4.4.4.4/32 OSPF 10 4 D 10.1.2.2 GigabitEthernet0/2/0 5.5.5.0/24 BGP 255 0 RD 10.2.1.2 GigabitEthernet0/2/0 10.1.1.0/30 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.1.2/32 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.2.0/30 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.2.2/32 Direct 0 0 D 10.1.2.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.3.0/30 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/1/0 10.1.3.1/32 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/2/0 10.1.4.0/30 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0 10.1.4.1/32 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/2/0 10.2.1.0/30 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/2/0 10.2.1.2/32 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/2/0 10.3.1.0/30 BGP 255 0 RD 4.4.4.4 GigabitEthernet0/2/0
# Display the routing table on DeviceB. As shown in the routing table, only OSPF routes exist in the routing table because IGP routes converge faster than BGP routes do. The costs of the OSPF routes are 65535.
[~DeviceB] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: _public_ Destinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 OSPF 10 65536 D 10.1.1.1 GigabitEthernet0/1/0 2.2.2.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 4.4.4.4/32 OSPF 10 65536 D 10.1.3.2 GigabitEthernet0/2/0 10.1.1.0/30 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.2.0/30 OSPF 10 65536 D 10.1.1.1 GigabitEthernet0/1/0 10.1.3.0/30 Direct 0 0 D 10.1.3.1 GigabitEthernet0/2/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.3.2/32 Direct 0 0 D 10.1.3.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.4.0/30 OSPF 10 65536 D 10.1.3.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# Display the routing table on DeviceB again.
[~DeviceB] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table: _public_ Destinations : 19 Routes : 19 Destination/Mask Proto Pre Cost Flags NextHop Interface 2.2.2.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 1.1.1.1/32 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/1/0 4.4.4.0/24 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 4.4.4.4/32 OSPF 10 2 D 10.1.3.2 GigabitEthernet0/2/0 5.5.5.0/24 BGP 255 0 RD 10.2.1.2 GigabitEthernet0/2/0 10.1.1.0/30 Direct 0 0 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.2.0/30 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/1/0 10.1.3.0/30 Direct 0 0 D 10.1.3.1 GigabitEthernet0/2/0 10.1.3.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.3.2/32 Direct 0 0 D 10.1.3.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.1.4.0/30 OSPF 10 2 D 10.1.3.2 GigabitEthernet0/2/0 10.1.4.1/32 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 10.2.1.0/30 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 10.2.1.2/32 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0 10.3.1.0/30 BGP 255 0 RD 10.1.3.2 GigabitEthernet0/2/0
As shown in the routing table, BGP routes on DeviceB have converged, and the routing information is the same as that displayed before the restart.
Configuration Files
DeviceA configuration file
# sysname DeviceA # router id 1.1.1.1 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.252 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.1 255.255.255.252 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # bgp 10 router-id 1.1.1.1 peer 2.2.2.2 as-number 10 peer 2.2.2.2 connect-interface LoopBack 0 peer 3.3.3.3 as-number 10 peer 3.3.3.3 connect-interface LoopBack 0 peer 4.4.4.4 as-number 10 peer 4.4.4.4 connect-interface LoopBack 0 # ospf 1 area 0.0.0.0 network 1.1.1.1 0.0.0.0 network 10.1.1.0 0.0.0.3 network 10.1.2.0 0.0.0.3 # return
DeviceB configuration file
# sysname DeviceB # router id 2.2.2.2 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.252 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.3.1 255.255.255.252 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # bgp 10 router-id 2.2.2.2 peer 1.1.1.1 as-number 10 peer 1.1.1.1 connect-interface LoopBack 0 peer 3.3.3.3 as-number 10 peer 3.3.3.3 connect-interface LoopBack 0 peer 4.4.4.4 as-number 10 peer 4.4.4.4 connect-interface LoopBack 0 # ospf 1 stub-router on-startup area 0.0.0.0 network 10.1.1.0 0.0.0.3 network 10.1.3.0 0.0.0.3 network 2.2.2.2 0.0.0.0 # return
DeviceC configuration file
# sysname DeviceC # router id 3.3.3.3 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.1 255.255.255.252 ospf cost 2 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.2 255.255.255.252 ospf cost 2 # interface LoopBack0 ip address 3.3.3.3 255.255.255.255 # bgp 10 router-id 3.3.3.3 peer 1.1.1.1 as-number 10 peer 1.1.1.1 connect-interface LoopBack 0 peer 2.2.2.2 as-number 10 peer 2.2.2.2 connect-interface LoopBack 0 peer 4.4.4.4 as-number 10 peer 4.4.4.4 connect-interface LoopBack 0 # ospf 1 area 0.0.0.0 network 10.1.2.0 0.0.0.3 network 10.1.4.0 0.0.0.3 network 3.3.3.3 0.0.0.0 # return
DeviceD configuration file
# sysname DeviceD # router id 4.4.4.4 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.2 255.255.255.252 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.3.2 255.255.255.252 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.2.1.1 255.255.255.252 # interface LoopBack0 ip address 4.4.4.4 255.255.255.255 # bgp 10 router-id 4.4.4.4 peer 10.2.1.2 as-number 20 peer 1.1.1.1 as-number 10 peer 1.1.1.1 connect-interface LoopBack 0 peer 2.2.2.2 as-number 10 peer 2.2.2.2 connect-interface LoopBack 0 peer 3.3.3.3 as-number 10 peer 3.3.3.3 connect-interface LoopBack 0 # ipv4-family unicast undo synchronization import-route direct import-route ospf 1 peer 10.2.1.2 enable # ospf 1 area 0.0.0.0 network 4.4.4.4 0.0.0.0 network 10.1.3.0 0.0.0.3 network 10.1.4.0 0.0.0.3 # return
DeviceE configuration file
# sysname DeviceE # router id 5.5.5.5 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.2.1.2 255.255.255.252 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.3.1.1 255.255.255.252 # interface LoopBack0 ip address 5.5.5.5 255.255.255.255 # bgp 20 router-id 5.5.5.5 peer 10.2.1.1 as-number 10 # ipv4-family unicast undo synchronization network 10.3.1.0 255.255.255.252 peer 10.2.1.1 enable # return
Example for Configuring Routing Loop Detection for Routes Imported from BGP to OSPF
This section describes how to configure routing loop detection for routes imported from BGP to OSPF.
Networking Requirements
On the live network, OSPF routes can be imported to a BGP process for redistribution. In such a scenario, routing policies are usually configured on multiple devices to prevent routing loops. If routing policies are incorrectly configured on the devices that import routes, routing loops may occur. To prevent this problem, configure routing loop detection for the routes imported to OSPF.
On the network shown in Figure 1-1533, IBGP peer relationships are established between DeviceA and DeviceB, between DeviceB and DeviceC, between DeviceC and DeviceD, and between DeviceB and DeviceD; an OSPF process is configured on DeviceC and DeviceD. OSPF is configured to import BGP routes on DeviceC, and BGP is configured to import OSPF routes on DeviceD.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure IP addresses for interfaces on each device.
Enable OSPF and BGP, and configure basic OSPF and BGP functions.
- Configure route import to construct a routing loop.
Check whether a routing loop occurs.
- Enable routing loop detection to check whether the routing loop is eliminated.
Procedure
- Assign an IP address to each interface.
DeviceA is used as an example.
<DeviceA> system-view [~DeviceA] interface gigabitethernet 0/1/0 [*DeviceA-GigabitEthernet0/1/0] ip address 10.12.1.1 24 [*DeviceA-GigabitEthernet0/1/0] quit [*DeviceA] commit
The configurations of other devices are similar to those of DeviceA. For configuration details, see Configuration Files in this section.
In addition, configure a static route on DeviceA to simulate a looped route.
[~DeviceA] ip route-static 10.0.0.0 255.255.255.255 NULL0 [*DeviceA] commit
- Enable OSPF and BGP, and configure basic OSPF and BGP functions to implement intra-AS communication.
# Enable BGP on DeviceA, and establish an IBGP peer relationship between DeviceA and DeviceB.
[~DeviceA] bgp 100 [*DeviceA-bgp] router-id 1.11.1.1 [*DeviceA-bgp] peer 10.12.1.2 as-number 100 [*DeviceA-bgp] ipv4-family unicast [*DeviceA-bgp-af-ipv4] peer 10.12.1.2 enable [*DeviceA-bgp] quit [*DeviceA] commit
# Enable BGP on DeviceB and establish IBGP peer relationships between DeviceB and DeviceA, between DeviceB and DeviceC, and between DeviceB and DeviceD.
[~DeviceB] bgp 100 [*DeviceB-bgp] router-id 2.22.2.2 [*DeviceB-bgp] peer 10.12.1.1 as-number 100 [*DeviceB-bgp] peer 10.23.1.3 as-number 100 [*DeviceB-bgp] peer 10.24.1.4 as-number 100 [*DeviceB-bgp] ipv4-family unicast [*DeviceB-bgp-af-ipv4] peer 10.12.1.1 enable [*DeviceB-bgp-af-ipv4] peer 10.23.1.3 enable [*DeviceB-bgp-af-ipv4] peer 10.24.1.4 enable [*DeviceB-bgp-af-ipv4] peer 10.23.1.3 reflect-client [*DeviceB-bgp] quit [*DeviceB] commit
# Enable BGP on DeviceC, and establish an IBGP peer relationship between DeviceC and DeviceB.
[~DeviceC] bgp 100 [*DeviceC-bgp] router-id 3.33.3.3 [*DeviceC-bgp] peer 10.23.1.2 as-number 100 [*DeviceC-bgp] ipv4-family unicast [*DeviceC-bgp-af-ipv4] peer 10.23.1.2 enable [*DeviceC-bgp] quit [*DeviceC] commit
# Enable BGP on DeviceD, and establish an IBGP peer relationship between DeviceD and DeviceB.
[~DeviceD] bgp 100 [*DeviceD-bgp] router-id 4.44.4.4 [*DeviceD-bgp] peer 10.24.1.2 as-number 100 [*DeviceD-bgp] ipv4-family unicast [*DeviceD-bgp-af-ipv4] peer 10.24.1.2 enable [*DeviceD-bgp] quit [*DeviceD] commit
# Configure OSPF on DeviceC and DeviceD. DeviceC is used as an example.
[~DeviceC] ospf 1 router-id 3.33.3.3 [*DeviceC-ospf-1] area 0 [*DeviceC-ospf-1-area-0.0.0.0] network 10.34.1.0 0.0.0.255 [*DeviceC-ospf-1-area-0.0.0.0] quit [*DeviceC-ospf-1] quit [*DeviceC] commit
- Configure route import.
# Configure OSPF on DeviceC to import BGP routes.
[~DeviceC] ospf 1 router-id 3.33.3.3 [*DeviceC-ospf-1] import-route bgp permit-ibgp [*DeviceC-ospf-1] quit [*DeviceC] commit
# Configure BGP on DeviceD to import OSPF routes.
[~DeviceD] bgp 100 [*DeviceD-bgp] ipv4-family unicast [*DeviceD-bgp-af-ipv4] import-route ospf 1 [*DeviceD-bgp] quit [*DeviceD] commit
- View the routing table on each device to check whether a routing loop occurs.
# Check BGP peer information on DeviceB.
[~DeviceB] display bgp peer
BGP local router ID : 2.22.2.2 Local AS number : 100 Total number of peers : 3 Peers in established state : 3 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 10.12.1.1 4 100 453 458 0 06:30:47 Established 1 10.23.1.3 4 100 452 458 0 06:30:46 Established 0 10.24.1.4 4 100 451 457 0 06:29:39 Established 3
# Check OSPF neighbor information on DeviceC.
[~DeviceC] display ospf peer
(M) Indicates MADJ neighbor OSPF Process 1 with Router ID 3.33.3.3 Neighbors Area 0.0.0.0 interface 10.34.1.3 (GigabitEthernet0/1/0)'s neighbors Router ID: 4.44.4.4 Address: 10.34.1.4 State: Full Mode:Nbr is Master Priority: 1 DR: 10.34.1.4 BDR: 10.34.1.3 MTU: 0 Dead timer due in 31 sec Retrans timer interval: 5 Neighbor is up for 06h28m21s Neighbor Up Time : 2021-08-27 02:59:32 Authentication Sequence: [ 0 ]
# Check OSPF neighbor information on DeviceD.
[~DeviceD] display ospf peer
(M) Indicates MADJ neighbor OSPF Process 1 with Router ID 4.44.4.4 Neighbors Area 0.0.0.0 interface 10.34.1.4 (GigabitEthernet0/2/0)'s neighbors Router ID: 3.33.3.3 Address: 10.34.1.3 State: Full Mode:Nbr is Slave Priority: 1 DR: 10.34.1.4 BDR: 10.34.1.3 MTU: 0 Dead timer due in 32 sec Retrans timer interval: 5 Neighbor is up for 06h28m25s Neighbor Up Time : 2021-08-27 02:59:32 Authentication Sequence: [ 0 ]
The preceding command outputs show that BGP peer relationships and OSPF neighbor relationships have been established between the devices.
# Check the BGP routing table on DeviceB.
[~DeviceB] display bgp routing-table 10.0.0.0
BGP local router ID : 2.22.2.2 Local AS number : 100 Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.0.0.0/32: RR-client route. From: 10.24.1.4 (4.44.4.4) Route Duration: 0d00h00m52s Relay IP Nexthop: 10.24.1.4 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.24.1.4 Qos information : 0x0 AS-path Nil, origin incomplete, MED 1, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Advertised to such 3 peers: 10.23.1.3 10.24.1.4 10.12.1.1 BGP routing table entry information of 10.0.0.0/32: From: 10.12.1.1 (1.11.1.1) Route Duration: 0d22h53m22s Relay IP Nexthop: 10.12.1.1 Relay IP Out-Interface:GigabitEthernet0/2/0 Original nexthop: 10.12.1.1 Qos information : 0x0 AS-path 10, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for AS-Path Not advertised to any peer yet
The preceding command output shows that DeviceB has learned the BGP route distributed by DeviceD.
# Check the BGP routing table of DeviceC.
[~DeviceC] display bgp routing-table 10.0.0.0
BGP local router ID : 3.33.3.3 Local AS number : 100 Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.0.0.0/32: From: 10.23.1.2 (2.22.2.2) Route Duration: 0d07h12m30s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: NULL0 Original nexthop: 10.12.1.1 Qos information : 0x0 AS-path 10, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Originator: 1.11.1.1 Cluster list: 2.22.2.2 Not advertised to any peer yet
The preceding command output shows that DeviceC has learned the BGP route distributed by DeviceB.
# Check the routing table of DeviceD.
[~DeviceD] display ospf routing 10.0.0.0
OSPF Process 1 with Router ID 4.44.4.4 Destination : 10.0.0.0/32 AdverRouter : 3.33.3.3 Tag : 1 Cost : 1 Type : Type2 NextHop : 10.34.1.3 Interface : GigabitEthernet0/2/0 Priority : Medium Age : 01h31m18s
The preceding command output shows that DeviceD has learned the OSPF route distributed by DeviceC.
This means that a routing loop occurs among DeviceB, DeviceC, and DeviceD.
- Enable routing loop detection on each device.
# Enable routing loop detection for routes imported to OSPF and BGP. DeviceA is used as an example.
[~DeviceA] route loop-detect ospf enable [*DeviceA] route loop-detect bgp enable [*DeviceA] commit
In the case of inter-protocol route import, if a routing protocol with a higher preference detects a routing loop, although this protocol increases the cost of the corresponding route, the cost increase will not render the route inactive. As a result, the routing loop cannot be eliminated. If the routing protocol with a lower preference is used for such processing, this route competes with the originally imported route during route selection. In this case, the routing loop can be eliminated. OSPF has a higher preference than BGP. Therefore, to eliminate the routing loop, BGP needs to reduce the preference of the corresponding route.
- Check whether the routing loop is eliminated.
# Check the BGP routing table on DeviceB.
[~DeviceB] display bgp routing-table 10.0.0.0
BGP local router ID : 2.22.2.2 Local AS number : 100 Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.0.0.0/32: From: 10.12.1.1 (1.11.1.1) Route Duration: 1d00h10m02s Relay IP Nexthop: 10.12.1.1 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 10.12.1.1 Qos information : 0x0 AS-path 10, origin incomplete, MED 0, localpref 100, pref-val 0, valid, internal, best, select, pre 255 Advertised to such 2 peers: 10.23.1.3 10.24.1.4
The preceding command output shows that DeviceB has learned the route distributed by DeviceA and that DeviceB no longer prefers the route distributed by DeviceD. This means that the routing loop among DeviceB, DeviceC, and DeviceD is eliminated.
Configuration Files
DeviceA configuration file
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 10.12.1.1 255.255.255.0 # bgp 100 router-id 1.11.1.1 private-4-byte-as enable peer 10.12.1.2 as-number 100 # ipv4-family unicast undo synchronization import-route static peer 10.12.1.2 enable # ip route-static 10.0.0.0 255.255.255.255 NULL0 # return
DeviceB configuration file
# sysname DeviceB # interface GigabitEthernet0/2/0 undo shutdown ip address 10.12.1.2 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.24.1.2 255.255.255.0 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.23.1.2 255.255.255.0 # bgp 100 router-id 2.22.2.2 private-4-byte-as enable peer 10.12.1.1 as-number 100 peer 10.23.1.3 as-number 100 peer 10.24.1.4 as-number 100 # ipv4-family unicast undo synchronization peer 10.12.1.1 enable peer 10.23.1.3 enable peer 10.23.1.3 reflect-client peer 10.24.1.4 enable peer 10.24.1.4 reflect-client # return
DeviceC configuration file
# sysname DeviceC # interface GigabitEthernet0/1/0 undo shutdown ip address 10.34.1.3 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.23.1.3 255.255.255.0 # bgp 100 router-id 3.33.3.3 private-4-byte-as enable peer 10.23.1.2 as-number 100 # ipv4-family unicast undo synchronization peer 10.23.1.2 enable # ospf 1 router-id 3.33.3.3 import-route bgp permit-ibgp opaque-capability enable area 0.0.0.0 network 10.34.1.0 0.0.0.255 # route loop-detect ospf enable # return
DeviceD configuration file
# sysname DeviceD # interface GigabitEthernet0/2/0 undo shutdown ip address 10.34.1.4 255.255.255.0 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.24.1.4 255.255.255.0 # bgp 100 router-id 4.44.4.4 private-4-byte-as enable peer 10.24.1.2 as-number 100 # ipv4-family unicast undo synchronization import-route ospf 1 peer 10.24.1.2 enable # ospf 1 router-id 4.44.4.4 opaque-capability enable area 0.0.0.0 network 10.34.1.0 0.0.0.255 # route loop-detect ospf enable # return
Example for Configuring OSPF Multi-Area Adjacency
This section provides an example for configuring OSPF multi-area adjacency, which includes configuration of enabling OSPF on each device, physical interface, and OSPF multi-area adjacency interface.
Networking Requirements
In Figure 1-1534, all routers run OSPF, and the AS consists of two areas: area 1 and area 2. The link between DeviceA and DeviceB in area 1 is a high-speed link. Because intra-area links take precedence over inter-area links during OSPF route selection, traffic from DeviceA to DeviceB in area 2 is forwarded along the low-speed link of DeviceA->DeviceC->DeviceD->DeviceB, even though high-speed link between DeviceA and DeviceB exists. It is required that traffic from DeviceA to DeviceB in area 2 be forwarded along the high-speed link between DeviceA and DeviceB. In this case, configure OSPF multi-area adjacency on DeviceA and DeviceB and add their multi-area adjacency interfaces to area 2.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Enable OSPF on each router.
Enable OSPF on physical interfaces.
Enable OSPF on multi-area adjacency interfaces.
Data Preparation
- OSPF process ID: 1
- OSPF areas: area 1 and area 2
Procedure
- Configure an IP address for each interface. The configuration details are not provided here.
- Configure basic OSPF functions.
# Configure DeviceA.
[~DeviceA] ospf 1
[*DeviceA-ospf-1] area 1
[*DeviceA-ospf-1-area-0.0.0.1] quit
[*DeviceA-ospf-1] quit
[*DeviceA] interface gigabitethernet 0/1/0
[*DeviceA-GigabitEthernet0/1/0] ospf enable 1 area 1
[*DeviceA-GigabitEthernet0/1/0] quit
[*DeviceA] ospf 1
[*DeviceA-ospf-1] area 2
[*DeviceA-ospf-1-area-0.0.0.2] quit
[*DeviceA-ospf-1] quit
[*DeviceA] interface gigabitethernet 0/2/0
[*DeviceA-GigabitEthernet0/2/0] ospf enable 1 area 2
[*DeviceA-GigabitEthernet0/2/0] quit
[*DeviceA] commit
# Configure DeviceB.
[~DeviceB] ospf 1
[*DeviceB-ospf-1] area 1
[*DeviceB-ospf-1-area-0.0.0.1] quit
[*DeviceB-ospf-1] quit
[*DeviceB] interface gigabitethernet 0/1/0
[*DeviceB-GigabitEthernet0/1/0] ospf enable 1 area 1
[*DeviceB-GigabitEthernet0/1/0] quit
[*DeviceB] ospf 1
[*DeviceB-ospf-1] area 2
[*DeviceB-ospf-1-area-0.0.0.2] quit
[*DeviceB-ospf-1] quit
[*DeviceB] interface gigabitethernet 0/2/0
[*DeviceB-GigabitEthernet0/2/0] ospf enable 1 area 2
[*DeviceB-GigabitEthernet0/2/0] quit
[*DeviceB] commit
# Configure DeviceC.
[~DeviceC] ospf 1
[*DeviceC-ospf-1] area 2
[*DeviceC-ospf-1-area-0.0.0.2] quit
[*DeviceC-ospf-1] quit
[*DeviceC] interface gigabitethernet 0/1/0
[*DeviceC-GigabitEthernet0/1/0] ospf enable 1 area 2
[*DeviceC-GigabitEthernet0/1/0] quit
[*DeviceC] interface gigabitethernet 0/2/0
[*DeviceC-GigabitEthernet0/2/0] ospf enable 1 area 2
[*DeviceC-GigabitEthernet0/2/0] quit
[*DeviceC] commit
# Configure DeviceD.
[~DeviceD] ospf 1
[*DeviceD-ospf-1] area 2
[*DeviceD-ospf-1-area-0.0.0.2] quit
[*DeviceD-ospf-1] quit
[*DeviceD] interface gigabitethernet 0/1/0
[*DeviceD-GigabitEthernet0/1/0] ospf enable 1 area 2
[*DeviceD-GigabitEthernet0/1/0] quit
[*DeviceD] interface gigabitethernet 0/2/0
[*DeviceD-GigabitEthernet0/2/0] ospf enable 1 area 2
[*DeviceD-GigabitEthernet0/2/0] quit
[*DeviceD] commit
# Run the display ospf peer brief command to check brief information about OSPF neighbors. DeviceA is used as an example. The following command output shows that the OSPF neighbor relationships between DeviceA and DeviceB and between DeviceA and DeviceC are established.
[~DeviceA] display ospf peer brief
(M) Indicates MADJ neighbor OSPF Process 1 with Router ID 1.1.1.1 Peer Statistic Information Total number of peer(s): 2 Peer(s) in full state: 2 ----------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.1 GigabitEthernet0/1/0 10.1.1.2 Full 0.0.0.2 GigabitEthernet0/2/0 10.1.1.1 Full -----------------------------------------------------------------------------
# Run the display ip routing-table command to check information about the IP routing table. DeviceA is used as an example. The following command output shows that the outbound interface of the route destined for 1.1.1.1 is GigabitEthernet 0/2/0.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 13 Routes : 13 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.3.0/24 OSPF 10 3 D 10.1.2.2 GigabitEthernet0/2/0 10.1.4.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
The preceding command output shows that traffic from routerA to routerB in area 2 is forwarded along the low-speed link of routerA -> routerC -> routerD -> routerB.
- Enable OSPF on multi-area adjacency interfaces.
# Configure DeviceA.
[~DeviceA] interface gigabitethernet 0/1/0
[*DeviceA-GigabitEthernet0/1/0] ospf enable multi-area 2
[*DeviceA-GigabitEthernet0/1/0] quit
[*DeviceA] commit
# Configure DeviceB.
[~DeviceB] interface gigabitethernet 0/1/0
[*DeviceB-GigabitEthernet0/1/0] ospf enable multi-area 2
[*DeviceB-GigabitEthernet0/1/0] quit
[*DeviceB] commit
- Verify the configuration.
# Run the display ospf peer brief command to check brief information about OSPF neighbors. DeviceA is used as an example. The following command output shows that the OSPF neighbor relationships between DeviceA and DeviceB and between DeviceA and DeviceC are established and that an OSPF multi-area adjacency is established between DeviceA and DeviceB.
[~DeviceA] display ospf peer brief
(M) Indicates MADJ neighbor OSPF Process 1 with Router ID 1.1.1.1 Peer Statistic Information Total number of peer(s): 3 Peer(s) in full state: 3 ----------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.1 GigabitEthernet0/1/0 10.1.1.2 Full 0.0.0.2 GigabitEthernet0/1/0 10.1.1.2(M) Full 0.0.0.2 GigabitEthernet0/2/0 10.1.1.1 Full -----------------------------------------------------------------------------
# Run the display ip routing-table command to check information about the IP routing table. DeviceA is used as an example. The following command output shows that the outbound interface of the route destined for 1.1.1.1 is GigabitEthernet 0/1/0.
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 13 Routes : 13 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 OSPF 10 1 D 10.1.1.2 GigabitEthernet0/1/0 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/1/0 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/2/0 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0 10.1.3.0/24 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/1/0 10.1.4.0/24 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/2/0 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
The preceding command output shows that traffic from routerA to routerB in area 2 is forwarded along the high-speed link between routerA and routerB.
Configuration Files
Device A configuration file
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.0 ospf enable 1 area 0.0.0.1 ospf enable multi-area 0.0.0.2 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.1 255.255.255.0 ospf enable 1 area 0.0.0.2 # ospf 1 area 0.0.0.1 area 0.0.0.2 # return
DeviceB configuration file
# sysname DeviceB # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 ospf enable 1 area 0.0.0.1 ospf enable multi-area 0.0.0.2 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.3.1 255.255.255.0 ospf enable 1 area 0.0.0.2 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 ospf enable 1 area 0.0.0.2 # ospf 1 area 0.0.0.1 area 0.0.0.2 # return
DeviceC configuration file
# sysname DeviceC # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.1 255.255.255.0 ospf enable 1 area 0.0.0.2 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.2 255.255.255.0 ospf enable 1 area 0.0.0.2 # ospf 1 area 0.0.0.2 # return
DeviceD configuration file
# sysname DeviceD # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.2 255.255.255.0 ospf enable 1 area 0.0.0.2 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.3.2 255.255.255.0 ospf enable 1 area 0.0.0.2 # ospf 1 area 0.0.0.2 # return
Example for Configuring an OSPF Sham Link
This section provides an example for configuring an OSPF sham link so that traffic between sites of the same VPN in the same OSPF area is forwarded through the OSPF intra-area route over the BGP/MPLS IP VPN backbone network.
Networking Requirements
In Figure 1-1535, CE1 and CE2 reside in the same OSPF area, belong to VPN1, and are connected to PE1 and PE2, respectively. In this example, the cost of each link is 1.
It is required that OSPF run between each CE and its connected PE and the VPN traffic between CE1 and CE2 be forwarded over the MPLS backbone network.
Precautions
To improve security, OSPF area authentication or interface authentication is recommended. For details, see "Improving OSPF Network Security". OSPF area authentication is used as an example. For details, see Example for Configuring Basic OSPF Functions.
Configuration Roadmap
The configuration roadmap is as follows:
Configure an MP-IBGP peer relationship between PEs and configure OSPF between each CE and its connected PE.
Create a VPN instance on each PE and bind the VPN instance to the interface connected to the corresponding CE.
Create an OSPF sham link between PEs.
Adjust the cost of forwarding interfaces over the user network to ensure that the cost of the OSPF route used to forward the traffic over the user network is greater than that of the sham link.
Data Preparation
To complete the configuration, you need the following data:
MPLS LSR IDs of the PEs and P
VPN instance name, RD, and VPN target of each PE
Data used to configure OSPF (The OSPF process running on the backbone network, the OSPF process running on the user network, and the OSPF process connecting each PE to the corresponding CE are different.)
Cost of the sham link and the cost of the OSPF route used to forward the traffic over the user network
Procedure
- Configure OSPF on the user network.
Configure OSPF on CE1, RT0, and CE2 and advertise network segments of their interfaces.
# Configure CE1.
<HUAWEI> system-view
[~HUAWEI] sysname CE1
[*HUAWEI] commit
[~CE1] interface GigabitEthernet0/2/0
[~CE1-GigabitEthernet0/2/0] ip address 10.1.1.1 24
[*CE1-GigabitEthernet0/2/0] quit
[*CE1] interface GigabitEthernet0/1/0
[*CE1-GigabitEthernet0/1/0] ip address 172.16.1.1 24
[*CE1-GigabitEthernet0/1/0] quit
[*CE1] ospf
[*CE1-ospf-1] area 0
[*CE1-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*CE1-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[*CE1-ospf-1-area-0.0.0.0] quit
[*CE1-ospf-1] quit
[*CE1] commit
# Configure RT0.
<HUAWEI> system-view
[~HUAWEI] sysname RT0
[*HUAWEI] commit
[~RT0] interface GigabitEthernet0/1/0
[~RT0-GigabitEthernet0/1/0] ip address 10.1.1.2 24
[*RT0-GigabitEthernet0/1/0] quit
[*RT0] interface GigabitEthernet0/2/0
[*RT0-GigabitEthernet0/2/0] ip address 10.2.1.1 24
[*RT0-GigabitEthernet0/2/0] quit
[*RT0] ospf
[*RT0-ospf-1] area 0
[*RT0-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*RT0-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[*RT0-ospf-1-area-0.0.0.0] quit
[*RT0-ospf-1] quit
[*RT0] commit
# Configure CE2.
<HUAWEI> system-view
[~HUAWEI] sysname CE2
[*HUAWEI] commit
[~CE2] interface GigabitEthernet0/2/0
[~CE2-GigabitEthernet0/2/0] ip address 10.2.1.2 24
[*CE2-GigabitEthernet0/2/0] quit
[*CE2] interface GigabitEthernet0/1/0
[*CE2-GigabitEthernet0/1/0] ip address 172.16.2.1 24
[*CE2-GigabitEthernet0/1/0] quit
[*CE2] ospf
[*CE2-ospf-1] area 0
[*CE2-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[*CE2-ospf-1-area-0.0.0.0] network 172.16.2.0 0.0.0.255
[*CE2-ospf-1-area-0.0.0.0] quit
[*CE2-ospf-1] quit
[*CE2] commit
- Configure basic BGP/MPLS IP VPN functions on the backbone network, including an IGP (OSPF) on the backbone network, MPLS and LDP on the backbone network, and an MP-IBGP peer relationship between PEs.
# Configure PE1.
<HUAWEI> system-view
[~HUAWEI] sysname PE1
[~PE1] interface loopback 1
[~PE1-LoopBack1] ip address 1.1.1.9 32
[*PE1-LoopBack1] quit
[*PE1] mpls lsr-id 1.1.1.9
[*PE1] mpls
[*PE1-mpls] quit
[*PE1] mpls ldp
[*PE1-mpls-ldp] quit
[*PE1] interface GigabitEthernet0/2/0
[*PE1-GigabitEthernet0/2/0] ip address 10.10.1.1 24
[*PE1-GigabitEthernet0/2/0] mpls
[*PE1-GigabitEthernet0/2/0] mpls ldp
[*PE1-GigabitEthernet0/2/0] quit
[*PE1] ospf
[*PE1-ospf-1] area 0
[*PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[*PE1-ospf-1-area-0.0.0.0] network 10.10.1.0 0.0.0.255
[*PE1-ospf-1-area-0.0.0.0] quit
[*PE1-ospf-1] quit
[*PE1] bgp 100
[*PE1-bgp] peer 3.3.3.9 as-number 100
[*PE1-bgp] peer 3.3.3.9 connect-interface loopback 1
[*PE1-bgp] ipv4-family vpnv4
[*PE1-bgp-af-vpnv4] peer 3.3.3.9 enable
[*PE1-bgp-af-vpnv4] quit
[*PE1-bgp] quit
[*PE1] commit
# Configure the P.
<HUAWEI> system-view
[~HUAWEI] sysname P
[~P] interface loopback 1
[~P-LoopBack1] ip address 2.2.2.9 32
[*P-LoopBack1] quit
[*P] mpls lsr-id 2.2.2.9
[*P] mpls
[*P-mpls] quit
[*P] mpls ldp
[*P-mpls-ldp] quit
[*P] interface GigabitEthernet0/1/0
[*P-GigabitEthernet0/1/0] ip address 10.10.1.2 24
[*P-GigabitEthernet0/1/0] mpls
[*P-GigabitEthernet0/1/0] mpls ldp
[*P-GigabitEthernet0/1/0] quit
[*P] interface GigabitEthernet0/2/0
[*P-GigabitEthernet0/2/0] ip address 10.20.1.1 24
[*P-GigabitEthernet0/2/0] mpls
[*P-GigabitEthernet0/2/0] mpls ldp
[*P-GigabitEthernet0/2/0] quit
[*P] ospf
[*P-ospf-1] area 0
[*P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[*P-ospf-1-area-0.0.0.0] network 10.10.1.0 0.0.0.255
[*P-ospf-1-area-0.0.0.0] network 10.20.1.0 0.0.0.255
[*P-ospf-1-area-0.0.0.0] quit
[*P-ospf-1] quit
[*P] commit
# Configure PE2.
<HUAWEI> system-view
[~HUAWEI] sysname PE2
[~PE2] interface loopback 1
[~PE2-LoopBack1] ip address 3.3.3.9 32
[*PE2-LoopBack1] quit
[*PE2] mpls lsr-id 3.3.3.9
[*PE2] mpls
[*PE2-mpls] quit
[*PE2] mpls ldp
[*PE2-mpls-ldp] quit
[*PE2] interface GigabitEthernet0/2/0
[*PE2-GigabitEthernet0/2/0] ip address 10.20.1.2 24
[*PE2-GigabitEthernet0/2/0] mpls
[*PE2-GigabitEthernet0/2/0] mpls ldp
[*PE2-GigabitEthernet0/2/0] quit
[*PE2] ospf
[*PE2-ospf-1] area 0
[*PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[*PE2-ospf-1-area-0.0.0.0] network 10.20.1.0 0.0.0.255
[*PE2-ospf-1-area-0.0.0.0] quit
[*PE2-ospf-1] quit
[*PE2] bgp 100
[*PE2-bgp] peer 1.1.1.9 as-number 100
[*PE2-bgp] peer 1.1.1.9 connect-interface loopback 1
[*PE2-bgp] ipv4-family vpnv4
[*PE2-bgp-af-vpnv4] peer 1.1.1.9 enable
[*PE2-bgp-af-vpnv4] quit
[*PE2-bgp] quit
[*PE2] commit
After completing the configurations, PE1 and PE2 learn the route to each other's loopback interface and establish an MP-IBGP peer relationship.
- Configure the connection between each PE and the corresponding CE, with OSPF running between them.
# Configure PE1.
[~PE1] ip vpn-instance vpn1
[*PE1-vpn-instance-vpn1] ipv4-family
[*PE1-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:1
[*PE1-vpn-instance-vpn1-af-ipv4] vpn-target 1:1
[*PE1-vpn-instance-vpn1-af-ipv4] quit
[*PE1-vpn-instance-vpn1] quit
[*PE1] interface gigabitethernet 0/1/0
[*PE1-GigabitEthernet0/1/0] ip binding vpn-instance vpn1
[*PE1-GigabitEthernet0/1/0] ip address 172.16.1.2 24
[*PE1-GigabitEthernet0/1/0] quit
[*PE1] ospf 100 vpn-instance vpn1
[*PE1-ospf-100] domain-id 10
[*PE1-ospf-100] import-route bgp
[*PE1-ospf-100] area 0
[*PE1-ospf-100-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[*PE1-ospf-100-area-0.0.0.0] quit
[*PE1-ospf-100] quit
[*PE1] bgp 100
[*PE1-bgp] ipv4-family vpn-instance vpn1
[*PE1-bgp-vpn1] import-route direct
[*PE1-bgp-vpn1] import-route ospf 100
[*PE1-bgp-vpn1] quit
[*PE1-bgp] quit
[*PE1] commit
# Configure PE2.
[~PE2] ip vpn-instance vpn1
[*PE2-vpn-instance-vpn1] ipv4-family
[*PE2-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:2
[*PE2-vpn-instance-vpn1-af-ipv4] vpn-target 1:1
[*PE2-vpn-instance-vpn1-af-ipv4] quit
[*PE2-vpn-instance-vpn1] quit
[*PE2] interface GigabitEthernet0/1/0
[*PE2-GigabitEthernet0/1/0] ip binding vpn-instance vpn1
[*PE2-GigabitEthernet0/1/0] ip address 172.16.2.2 24
[*PE2-GigabitEthernet0/1/0] quit
[*PE2] ospf 100 vpn-instance vpn1
[*PE2-ospf-100] import-route bgp
[*PE2-ospf-100] domain-id 10
[*PE2-ospf-100] area 0
[*PE2-ospf-100-area-0.0.0.0] network 172.16.2.0 0.0.0.255
[*PE2-ospf-100-area-0.0.0.0] quit
[*PE2-ospf-100] quit
[*PE2] bgp 100
[*PE2-bgp] ipv4-family vpn-instance vpn1
[*PE2-bgp-vpn1] import-route direct
[*PE2-bgp-vpn1] import-route ospf 100
[*PE2-bgp-vpn1] quit
[*PE2-bgp] quit
[*PE2] commit
After completing the configurations, run the display ip routing-table vpn-instance command on a PE. You may find that the route to the remote CE is an OSPF route over the user network rather than the BGP route over the backbone network.
The following example uses the command output on PE1.
<PE1> display ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table: vpn1
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 OSPF 10 2 D 172.16.1.1 GigabitEthernet0/1/0
10.2.1.0/24 OSPF 10 3 D 172.16.1.1 GigabitEthernet0/1/0
172.16.1.0/24 Direct 0 0 D 172.16.1.2 GigabitEthernet0/1/0
172.16.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.2.0/24 OSPF 10 4 D 172.16.1.1 GigabitEthernet0/1/0
- Configure a sham link.
To ensure that VPN traffic is forwarded over the MPLS backbone network, ensure that the cost of the sham link is smaller than that of the OSPF route used to forward the traffic over the user network when configuring the sham link. In most cases, you need to change the cost of the interfaces on the user network to ensure that the cost of the OSPF route used to forward the traffic over the user network is greater than that of the sham link.
# Configure CE1.
[~CE1] interface GigabitEthernet0/2/0
[~CE1-GigabitEthernet0/2/0] ospf cost 10
[*CE1-GigabitEthernet0/2/0] quit
[*CE1] commit
# Configure CE2.
[~CE2] interface GigabitEthernet0/2/0
[~CE2-GigabitEthernet0/2/0] ospf cost 10
[*CE2-GigabitEthernet0/2/0] quit
[*CE2] interface loopback 1
[*CE2-LoopBack1] ip address 8.8.8.8 32
[*CE2-LoopBack1] ospf enable 1 area 0
[*CE2-LoopBack1] quit
[*CE2] commit
# Configure PE1.
[~PE1] interface loopback 10
[*PE1-LoopBack10] ip binding vpn-instance vpn1
[*PE1-LoopBack10] ip address 5.5.5.5 32
[*PE1-LoopBack10] quit
[*PE1] ospf 100 router-id 11.11.11.11
[*PE1-ospf-100] area 0
[*PE1-ospf-100-area-0.0.0.0] sham-link 5.5.5.5 6.6.6.6 cost 1
[*PE1-ospf-100-area-0.0.0.0] quit
[*PE1-ospf-100] quit
[*PE1] commit
# Configure PE2.
[~PE2] interface loopback 10
[*PE2-LoopBack10] ip binding vpn-instance vpn1
[*PE2-LoopBack10] ip address 6.6.6.6 32
[*PE2-LoopBack10] quit
[*PE2] ospf 100 router-id 22.22.22.22
[*PE2-ospf-100] area 0
[*PE2-ospf-100-area-0.0.0.0] sham-link 6.6.6.6 5.5.5.5 cost 1
[*PE2-ospf-100-area-0.0.0.0] quit
[*PE2-ospf-100] quit
[*PE2] commit
- Verify the configuration.
After completing the configurations, run the display ip routing-table vpn-instance command again on the PE. You may find that the route to the remote CE becomes the BGP route over the backbone network and a route to the destination IP address of the sham link also exist in the routing table.
The following example uses the command output on PE1.
<PE1> display ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table: vpn1
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
5.5.5.5/32 Direct 0 0 D 127.0.0.1 LoopBack10
6.6.6.6/32 IBGP 255 0 RD 3.3.3.9 GigabitEthernet0/2/0
8.8.8.8/32 IBGP 255 2 RD 3.3.3.9 GigabitEthernet0/2/0
10.1.1.0/24 OSPF 10 11 D 172.16.1.1 GigabitEthernet0/1/0
10.2.1.0/24 OSPF 10 12 D 172.16.1.1 GigabitEthernet0/1/0
172.16.1.0/24 Direct 0 0 D 172.16.1.2 GigabitEthernet0/1/0
172.16.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.2.0/24 IBGP 255 0 RD 3.3.3.9 GigabitEthernet0/2/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
Run the display ip routing-table command on a CE. You may find that the cost of the OSPF route to the remote CE becomes 3 and the next hop is the IP address of the connected PE interface. The next hop indicates that the VPN traffic to the remote end is forwarded over the backbone network.
The following example uses the command output on CE1.
<CE1> display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
5.5.5.5/32 O_ASE 150 1 D 172.16.1.2 GigabitEthernet0/1/0
6.6.6.6/32 O_ASE 150 1 D 172.16.1.2 GigabitEthernet0/1/0
8.8.8.8/32 OSPF 10 3 D 172.16.1.2 GigabitEthernet0/1/0
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/2/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0
10.2.1.0/24 OSPF 10 11 D 10.1.1.2 GigabitEthernet0/2/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
172.16.1.0/24 Direct 0 0 D 172.16.1.1 GigabitEthernet0/1/0
172.16.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.2.0/24 OSPF 10 3 D 172.16.1.2 GigabitEthernet0/1/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
Cost (3) of the OSPF route from CE1 to CE2 = Cost (1) of the link from CE1 to PE1 + Cost (1) of the sham link + Cost (1) of the link from PE2 to CE2
Run the tracert command and you may find that the next hop for CE1 to send data to CE2 is the IP address of PE1's GE 0/1/0. The next hop indicates that the VPN traffic to the remote end is forwarded over the backbone network.
<CE1> tracert 172.16.2.1
traceroute to 172.16.2.1(172.16.2.1), max hops: 30 ,packet length: 40,press CTRL_C to break
1 172.16.1.2 131 ms 2 ms 1 ms
2 10.10.1.2 475 ms 4 ms 4 ms
3 172.16.2.2 150 ms 3 ms 4 ms
4 172.16.2.1 76 ms 3 ms 5 ms
<CE1> tracert 10.2.1.2
traceroute to 10.2.1.2(10.2.1.2), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.1.1.2 60 ms 1 ms 1 ms
2 10.2.1.2 12 ms 2 ms 2 ms
Run the display ospf sham-link command on a PE to check whether the sham link is established.
The following example uses the command output on PE1.
<PE1> display ospf sham-link
OSPF Process 100 with Router ID 11.11.11.11
Area NeighborId Source-IP Destination-IP State Cost
0.0.0.0 22.22.22.22 5.5.5.5 6.6.6.6 P-2-P 1
Run the display ospf sham-link area command. The following command output shows that the OSPF neighbor relationship is in Full state.
<PE1> display ospf sham-link area 0
OSPF Process 100 with Router ID 11.11.11.11
Sham-Link: 5.5.5.5 --> 6.6.6.6
NeighborID: 22.22.22.22, State: Full, GR status: Normal
Area: 0.0.0.0
Cost: 1 , State: P-2-P , Type: Sham
Timers: Hello 10 , Dead 40 , Retransmit 5 , Transmit Delay 1
Run the display ospf routing command on a CE. The following command output shows that the route to the remote CE is an intra-area route.
<CE1> display ospf routing
OSPF Process 1 with Router ID 10.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
8.8.8.8/32 3 Stub 172.16.1.2 10.2.1.2 0.0.0.0
10.1.1.0/24 10 Direct 10.1.1.1 10.1.1.1 0.0.0.0
10.2.1.0/24 11 Transit 10.1.1.2 10.1.1.2 0.0.0.0
172.16.1.0/24 1 Direct 172.16.1.1 10.1.1.1 0.0.0.0
172.16.2.0/24 3 Transit 172.16.1.2 10.2.1.2 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
6.6.6.6/32 1 Type2 3489661028 172.16.1.2 11.11.11.11
5.5.5.5/32 1 Type2 3489661028 172.16.1.2 22.22.22.22
Total Nets: 7
Intra Area: 5 Inter Area: 0 ASE: 2 NSSA: 0
Configuration Files
PE1 configuration file
#
sysname PE1
#
ip vpn-instance vpn1
ipv4-family
route-distinguisher 100:1
apply-label per-instance
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 1.1.1.9
#
mpls
#
mpls ldp
#
interface GigabitEthernet0/1/0
undo shutdown
ip binding vpn-instance vpn1
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.10.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 1.1.1.9 255.255.255.255
#
interface LoopBack10
ip binding vpn-instance vpn1
ip address 5.5.5.5 255.255.255.255
#
bgp 100
peer 3.3.3.9 as-number 100
peer 3.3.3.9 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 3.3.3.9 enable
#
ipv4-family vpnv4
policy vpn-target
peer 3.3.3.9 enable
#
ipv4-family vpn-instance vpn1
import-route direct
import-route ospf 100
#
ospf 1
area 0.0.0.0
network 1.1.1.9 0.0.0.0
network 10.10.1.0 0.0.0.255
#
ospf 100 router-id 11.11.11.11 vpn-instance vpn1
import-route bgp
domain-id 0.0.0.10
area 0.0.0.0
network 172.16.1.0 0.0.0.255
sham-link 5.5.5.5 6.6.6.6 cost 1
#
return
P configuration file
#
sysname P
#
mpls lsr-id 2.2.2.9
#
mpls
#
mpls ldp
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.10.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 2.2.2.9 255.255.255.255
#
ospf 1
area 0.0.0.0
network 2.2.2.9 0.0.0.0
network 10.10.1.0 0.0.0.255
network 10.20.1.0 0.0.0.255
#
return
PE2 configuration file
#
sysname PE2
#
ip vpn-instance vpn1
ipv4-family
route-distinguisher 100:2
apply-label per-instance
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 3.3.3.9
#
mpls
#
mpls ldp
#
interface GigabitEthernet0/1/0
undo shutdown
ip binding vpn-instance vpn1
ip address 172.16.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.1.2 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 3.3.3.9 255.255.255.255
#
interface LoopBack10
ip binding vpn-instance vpn1
ip address 6.6.6.6 255.255.255.255
#
bgp 100
peer 1.1.1.9 as-number 100
peer 1.1.1.9 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 1.1.1.9 enable
#
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.9 enable
#
ipv4-family vpn-instance vpn1
import-route direct
import-route ospf 100
#
ospf 1
area 0.0.0.0
network 3.3.3.9 0.0.0.0
network 10.20.1.0 0.0.0.255
#
ospf 100 router-id 22.22.22.22 vpn-instance vpn1
import-route bgp
domain-id 0.0.0.10
area 0.0.0.0
network 172.16.2.0 0.0.0.255
sham-link 6.6.6.6 5.5.5.5 cost 1
#
return
CE1 configuration file
#
sysname CE1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
ospf cost 10
#
interface LoopBack0
ip address 8.8.8.8 255.255.255.255
ospf enable 1 area 0.0.0.0
#
ospf 1
area 0.0.0.0
network 172.16.1.0 0.0.0.255
network 10.1.1.0 0.0.0.255
#
return
CE2 configuration file
#
sysname CE2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.2.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.2.1.2 255.255.255.0
ospf cost 10
#
ospf 1
area 0.0.0.0
network 10.2.1.0 0.0.0.255
network 172.16.2.0 0.0.0.255
#
return
RT0 configuration file
#
sysname RT0
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.2.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.2.1.0 0.0.0.255
#
return
- OSPF Description
- Overview of OSPF
- Understanding OSPF
- Basic Concepts of OSPF
- OSPF Fundamentals
- OSPF Route Control
- OSPF Virtual Link
- OSPF TE
- OSPF VPN
- OSPF NSSA
- OSPF Local MT
- BFD for OSPF
- OSPF GTSM
- OSPF Smart-discover
- OSPF-BGP Synchronization
- LDP-IGP Synchronization
- OSPF Fast Convergence
- OSPF Neighbor Relationship Flapping Suppression
- OSPF Flush Source Tracing
- OSPF Multi-Area Adjacency
- OSPF NSR
- OSPF IP FRR
- OSPF Authentication
- OSPF Packet Format
- OSPF LSA Format
- Routing Loop Detection for Routes Imported to OSPF
- OSPF Configuration
- Overview of OSPF
- Configuration Precautions for OSPF
- Configuring Basic OSPF Functions
- Enabling OSPF
- Configuring an Interface to Fill in a DD Packet with the Interface MTU
- (Optional) Creating OSPF Virtual Links
- (Optional) Configuring the router to Comply with Route Selection Rules Defined in a Standard Protocol
- (Optional) Setting the OSPF Priority
- (Optional) Restricting the Flooding of OSPF Update LSAs
- (Optional) Configuring the Maximum Number of Packet Retransmission Attempts
- (Optional) Setting the Interval at Which LSAs Are Retransmitted Between Adjacent routers
- Verifying the Configuration
- Configuring OSPF on the NBMA or P2MP Network
- Adjusting OSPF Route Selection
- Setting the Interface Cost
- Configuring Equal-Cost Routes
- Setting the convergence priority for OSPF routes
- Configuring a Stub Router
- Suppressing an Interface from Receiving and Sending OSPF Packets
- Configuring an OSPF Interface to Automatically Adjust the Link Cost
- Configuring a Fallback Cost for an Eth-Trunk Interface
- Verifying the Configuration
- Controlling OSPF Routing Information
- Configuring OSPF to Import External Routes
- Configuring OSPF to Import a Default Route
- Configuring Route Summarization
- Configuring OSPF to Filter LSAs in an Area
- Configuring OSPF to Filter LSAs to Be Sent
- Configuring OSPF to Filter Received Routes
- Configuring OSPF to Filter the Routes to Be Advertised
- (Optional) Configuring OSPF to Discard Specified LSAs
- Configuring the Maximum Number of External Routes Supported by the OSPF LSDB
- Verifying the Configuration of OSPF Routing Information Control
- Adjusting the OSPF Network Convergence Speed
- Setting the Interval at Which Hello Packets Are Sent
- Setting the Delay for Transmitting LSAs on an Interface
- Setting the Dead Time of an OSPF Neighbor
- Configuring OSPF Sham Hello
- Configuring Smart-discover
- Setting the Interval at Which LSAs Are Updated
- Setting the Interval at Which LSAs Are Received
- Setting the Interval for the SPF Calculation
- Configuring the Function to Suppress the Advertisement of Interface Addresses
- Configuring the Route Calculation Delay Function to Suppress Frequent LSA Flapping
- Disabling Active/Standby Board Switching Triggered by Abnormal OSPF Aging
- Disabling OSPF LSA Aging Management
- Setting a Period During Which OSPF Keeps the Maximum Cost in Local LSAs
- Configuring Secure Synchronization
- Verifying the Configuration of the OSPF Network Convergence Speed
- Configuring OSPF Delay Advertisement
- Configuring OSPF Neighbor Relationship Flapping Suppression
- Disabling OSPF Interface Flapping Suppression
- Configuring Routing Loop Detection for Routes Imported into OSPF
- Configuring OSPF Flush LSA Source Tracing
- Configuring an OSPF Hostname
- Configuring an OSPF Stub Area
- Configuring an NSSA
- Configuring OSPF Local MT
- Configuring an OSPF Sham Link
- Configuring BFD for OSPF
- Configuring OSPF IP FRR
- Configuring OSPF GR Helper
- Improving OSPF Network Security
- Configuring the Network Management Function of OSPF
- Configuring Whitelist Session-CAR for OSPF
- Configuring Micro-Segment CAR for OSPF
- Configuring the Threshold Alarm Function for the Number of OSPF Neighbors
- Maintaining OSPF
- Configuring OSPF Multi-Area Adjacency
- Enabling OSPF on a Multi-Area Adjacency Interface
- Configuring a Cost for a Multi-Area Adjacency Interface
- Configuring an Authentication Mode for a Multi-Area Adjacency Interface
- Configuring Fast Convergence for a Multi-Area Adjacency Interface
- Configuring Neighbor Relationship Flapping Suppression on an OSPF Multi-Area Adjacency Interface
- Disabling an OSPF Multi-Area Adjacency Interface from Creating BFD Sessions
- Disabling OSPF IP FRR on an OSPF Multi-Area Adjacency Interface
- Configuring a Fallback Cost for an Eth-Trunk Multi-Area Adjacency Interface
- Maintaining OSPF on a Multi-Area Adjacency Interface
- Verifying the Configuration of OSPF Multi-Area Adjacency
- Configuration Examples for OSPF
- Example for Configuring Basic OSPF Functions
- Example for Configuring OSPF Virtual Links
- Example for Configuring an OSPF Stub Area
- Example for Configuring an OSPF NSSA
- Example for Configuring OSPF DR Election
- Example for Configuring OSPF Load Balancing
- Example for Configuring OSPF Fast Convergence
- Example for Configuring OSPF Local MT
- Example for Configuring OSPF IP FRR
- Example for Configuring BFD for OSPF
- Example for Configuring OSPF-BGP Synchronization
- Example for Configuring Routing Loop Detection for Routes Imported from BGP to OSPF
- Example for Configuring OSPF Multi-Area Adjacency
- Example for Configuring an OSPF Sham Link