- Table of Contents
-
- 03-IP Routing Volume
- 00-IP Routing Volume Organization
- 01-IP Routing Overview
- 02-Static Routing Configuration
- 03-RIP Configuration
- 04-OSPF Configuration
- 05-IS-IS Configuration
- 06-BGP Configuration
- 07-IPv6 Static Routing Configuration
- 08-IPv6 Ripng Configuration
- 09-IPv6 OSPFv3 Configuration
- 10-IPv6 IS-IS Configuration
- 11-IPv6 BGP Configuration
- 12-Routing Policy Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
04-OSPF Configuration | 914.2 KB |
Table of Contents
Classification of OSPF Networks
Configuring OSPF Network Types
Configuring the OSPF Network Type for an Interface as Broadcast
Configuring the OSPF Network Type for an Interface as NBMA
Configuring the OSPF Network Type for an Interface as P2MP
Configuring the OSPF Network Type for an Interface as P2P
Configuring OSPF Route Control
Configuring OSPF Route Summarization
Configuring OSPF Inbound Route Filtering
Configuring ABR Type-3 LSA Filtering
Configuring an OSPF Cost for an Interface
Configuring the Maximum Number of OSPF Routes
Configuring the Maximum Number of Load-balanced Routes
Configuring a Priority for OSPF
Configuring OSPF Route Redistribution
Configuring OSPF Network Optimization
Configuring OSPF Packet Timers
Specifying an LSA Transmission Delay
Specifying SPF Calculation Interval
Specifying the LSA Minimum Repeat Arrival Interval
Specifying the LSA Generation Interval
Disabling Interfaces from Sending OSPF Packets
Configuring OSPF Authentication
Adding the Interface MTU into DD Packets
Configuring the Maximum Number of External LSAs in LSDB
Making External Route Selection Rules Defined in RFC1583 Compatible
Logging Neighbor State Changes
Configuring OSPF Network Management
Enabling the Advertisement and Reception of Opaque LSAs
Configuring OSPF to Give Priority to Receiving and Processing Hello Packets
Configuring the LSU Transmit Rate
Configuring OSPF Graceful Restart
Configuring the OSPF GR Restarter
Configuring the OSPF GR Helper
Triggering OSPF Graceful Restart
Displaying and Maintaining OSPF
Configuring OSPF Basic Functions
Configuring OSPF Route Redistribution
Configuring OSPF to Advertise a Summary Route
Configuring OSPF Virtual Links
OSPF Graceful Restart Configuration Example
Troubleshooting OSPF Configuration
No OSPF Neighbor Relationship Established
Open Shortest Path First (OSPF) is a link state interior gateway protocol developed by the OSPF working group of the Internet Engineering Task Force (IETF). At present, OSPF version 2 (RFC2328) is used.
When configuring OSPF, go to these sections for information you are interested in:
l OSPF Configuration Task List
l Configuring OSPF Network Types
l Configuring OSPF Route Control
l Configuring OSPF Network Optimization
l Configuring OSPF Graceful Restart
l Displaying and Maintaining OSPF
l Troubleshooting OSPF Configuration
The term “router” in this document refers to a router in a generic sense or a Layer 3 switch.
Introduction to OSPF
Unless otherwise noted, OSPF refers to OSPFv2 throughout this document.
OSPF has the following features:
l Wide scope: Supports networks of various sizes and up to several hundred routers in an OSPF routing domain.
l Fast convergence: Transmits updates instantly after network topology changes for routing information synchronization in the AS.
l Loop-free: Computes routes with the shortest path first (SPF) algorithm according to collected link states, so no route loops are generated.
l Area partition: Allows an AS to be split into different areas for ease of management and routing information transmitted between areas is summarized to reduce network bandwidth consumption.
l Equal-cost multi-route: Supports multiple equal-cost routes to a destination.
l Routing hierarchy: Supports a four-level routing hierarchy that prioritizes routes into intra-area, inter-area, external Type-1, and external Type-2 routes.
l Authentication: Supports interface-based packet authentication to ensure the security of packet exchange.
l Multicast: Supports multicasting protocol packets on some types of links.
Basic Concepts
Autonomous System
A set of routers using the same routing protocol to exchange routing information constitute an Autonomous System (AS).
OSPF route computation
OSPF route computation in an area is described as follows:
l Based on the network topology around itself, each router generates Link State Advertisements (LSA) and sends them to other routers in update packets.
l Each OSPF router collects LSAs from other routers to compose a LSDB (Link State Database). An LSA describes the network topology around a router, so the LSDB describes the entire network topology of the AS.
l Each router transforms the LSDB to a weighted directed graph, which actually reflects the topology architecture of the entire network. All the routers have the same graph.
l Each router uses the SPF algorithm to compute a Shortest Path Tree that shows the routes to the nodes in the autonomous system. The router itself is the root of the tree.
Router ID
An OSPF process running on a router must have its own router ID,, which is a 32-bit unsigned integer, the unique identifier of the router in the AS.
OSPF packets
OSPF uses five types of packets:
l Hello packet: Periodically sent to find and maintain neighbors, containing the values of some timers, information about the DR, BDR and known neighbors.
l DD packet (database description packet): Describes the digest of each LSA in the LSDB, exchanged between two routers for data synchronization.
l LSR (link state request) packet: Requests needed LSAs from the neighbor. After exchanging the DD packets, the two routers know which LSAs of the neighbor are missing from the local LSDBs. Then, they send an LSR packet to each other, requesting the missing LSAs. The LSA packet contains the digest of the missing LSAs.
l LSU (link state update) packet: Transmits the needed LSAs to the neighbor.
l LSAck (link state acknowledgment) packet: Acknowledges received LSU packets. It contains the headers of received LSAs (a packet can acknowledge multiple LSAs).
LSA types
OSPF sends routing information in LSAs, which, as defined in RFC 2328, have the following types:
l Router LSA: Type-1 LSA, originated by all routers, flooded throughout a single area only. This LSA describes the collected states of the router's interfaces to an area.
l Network LSA: Type-2 LSA, originated for broadcast and NBMA networks by the designated router, flooded throughout a single area only. This LSA contains the list of routers connected to the network.
l Network Summary LSA: Type-3 LSA, originated by ABRs (Area Border Routers), and flooded throughout the LSA's associated area. Each summary-LSA describes a route to a destination outside the area, yet still inside the AS (an inter-area route).
l ASBR Summary LSA: Type-4 LSA, originated by ABRs and flooded throughout the LSA's associated area. Type 4 summary-LSAs describe routes to ASBR (Autonomous System Boundary Router).
l AS External LSA: Type-5 LSA, originated by ASBRs, and flooded throughout the AS (except stub and NSSA areas). Each AS-external-LSA describes a route to another AS.
l NSSA LSA: Type-7 LSA, as defined in RFC 1587, originated by ASBRs in NSSAs (Not-So-Stubby Areas) and flooded throughout a single NSSA. NSSA LSAs describe routes to other ASs.
l Opaque LSA: A proposed type of LSA, the format of which consists of a standard LSA header and application specific information. Opaque LSAs are used by the OSPF protocol or by some application to distribute information into the OSPF routing domain. The opaque LSA includes three types, Type 9, Type 10 and Type 11, which are used to flood into different areas. The Type 9 opaque LSA is flooded into the local subnet, the Type 10 is flooded into the local area, and the Type 11 is flooded throughout the whole AS.
Neighbor and Adjacency
In OSPF, the “Neighbor” and”Adjacency” are two different concepts.
Neighbor: Two routers that have interfaces to a common network. Neighbor relationships are maintained by, and usually dynamically discovered by, OSPF's hello packets. When a router starts, it sends a hello packet via the OSPF interface, and the router that receives the hello packet checks parameters carried in the packet. If parameters of the two routers match, they become neighbors.
Adjacency: A relationship formed between selected neighboring routers for the purpose of exchanging routing information. Not every pair of neighboring routers become adjacent, which depends on network types. Only by synchronizing the LSDB via exchanging DD packets and LSAs can two routers become adjacent.
OSPF Area Partition
Area partition
When a large number of OSPF routers are present on a network, LSDBs may become so large that a great amount of storage space is occupied and CPU resources are exhausted by performing SPF computation.
In addition, as the topology of a large network is prone to changes, enormous OSPF packets may be created, reducing bandwidth utilization. Each topology change makes all routers perform route calculation.
To solve this problem, OSPF splits an AS into multiple areas, which are identified by area ID. The boundaries between areas are routers rather than links. A network segment (or a link) can only reside in one area, in other words, an OSPF interface must be specified to belong to its attached area, as shown in the figure below.
Figure 1-1 OSPF area partition
After area partition, area border routers perform route summarization to reduce the number of LSAs advertised to other areas and minimize the effect of topology changes.
Classification of Routers
The OSPF routers fall into four types according to the position in the AS:
1) Internal Router
All interfaces on an internal router belong to one OSPF area.
2) Area Border Router (ABR)
An area border router belongs to more than two areas, one of which must be the backbone area. It connects the backbone area to a non-backbone area. The connection between an area border router and the backbone area can be physical or logical.
3) Backbone Router
At least one interface of a backbone router must be attached to the backbone area. Therefore, all ABRs and internal routers in area 0 are backbone routers.
4) Autonomous System Border Router (ASBR)
The router exchanging routing information with another AS is an ASBR, which may not reside on the boundary of the AS. It can be an internal router or area border router.
Figure 1-2 OSPF router types
Backbone area and virtual links
Each AS has a backbone area, which is responsible for distributing routing information between none-backbone areas. Routing information between non-backbone areas must be forwarded by the backbone area. Therefore, OSPF requires that:
l All non-backbone areas must maintain connectivity to the backbone area.
l The backbone area itself must maintain connectivity.
In practice, due to physical limitations, the requirements may not be satisfied. In this case, configuring OSPF virtual links is a solution.
A virtual link is established between two area border routers via a non-backbone area and is configured on both ABRs to take effect. The area that provides the non-backbone area internal route for the virtual link is a “transit area”.
In the following figure, Area 2 has no direct physical link to the backbone area 0. Configuring a virtual link between ABRs can connect Area 2 to the backbone area.
Figure 1-3 Virtual link application 1
Another application of virtual links is to provide redundant links. If the backbone area cannot maintain internal connectivity due to a physical link failure, configuring a virtual link can guarantee logical connectivity in the backbone area, as shown below.
Figure 1-4 Virtual link application 2
The virtual link between the two ABRs acts as a point-to-point connection. Therefore, you can configure interface parameters such as hello packet interval on the virtual link as they are configured on physical interfaces.
The two ABRs on the virtual link exchange OSPF packets with each other directly, and the OSPF routers in between simply convey these OSPF packets as normal IP packets.
(Totally) Stub area
The ABR in a stub area does not distribute Type-5 LSAs into the area, so the routing table size and amount of routing information in this area are reduced significantly.
You can configure the stub area as a totally stub area, where the ABR advertises neither the destinations to other areas nor external routes.
Stub area configuration is optional, and not every area is eligible to be a stub area. In general, a stub area resides on the border of the AS.
The ABR in a stub area generates a default route into the area.
Note the following when configuring a (totally) stub area:
l The backbone area cannot be a (totally) stub area.
l To configure an area as a stub area, the stub command must be configured on routers in the area.
l To configure an area as a totally stub area, the stub command must be configured on routers in the area, and the ABR of the area must be configured with the stub [ no-summary ] command.
l A (totally) stub area cannot have an ASBR because AS external routes cannot be distributed into the stub area.
l Virtual links cannot transit (totally) stub areas.
NSSA area
Similar to a stub area, an NSSA area imports no AS external LSA (Type-5 LSA) but can import Type-7 LSAs that are generated by the ASBR and distributed throughout the NSSA area. When traveling to the NSSA ABR, Type-7 LSAs are translated into Type-5 LSAs by the ABR for advertisement to other areas.
In the following figure, the OSPF AS contains three areas: Area 1, Area 2 and Area 0. The other two ASs employ the RIP protocol. Area 1 is an NSSA area, and the ASBR in it translates RIP routes into Type-7 LSAs and advertises them throughout Area 1. When these LSAs travel to the NSSA ABR, the ABR translates Type-7 LSAs to Type-5 LSAs for advertisement to Area 0 and Area 2.
On the left of the figure, RIP routes are translated into Type-5 LSAs by the ASBR of Area 2 and distributed into the OSPF AS. However, Area 1 is an NSSA area, so these Type-5 LSAs cannot travel to Area 1.
Like stub areas, virtual links cannot transit NSSA areas.
Figure 1-5 NSSA area
Route types
OSPF prioritize routes into four levels:
l Intra-area route
l Inter-area route
l Type-1 external route
l Type-2 external route
The intra-area and inter-area routes describe the network topology of the AS, while external routes describe routes to destinations outside the AS.
OSPF classifies external routes into two types: Type-1 and Type-2. A Type-1 external route is an IGP route, such as a RIP or static route, which has high credibility and whose cost is comparable with the cost of an OSPF internal route. The cost from a router to the destination of the Type-1 external route= the cost from the router to the corresponding ASBR+ the cost from the ASBR to the destination of the external route.
A Type-2 external route is an EGP route, which has low credibility, so OSPF considers the cost from the ASBR to the destination of the Type-2 external route is much greater than the cost from the ASBR to an OSPF internal router. Therefore, the cost from the internal router to the destination of the Type-2 external route= the cost from the ASBR to the destination of the Type-2 external route. If two routes to the same destination have the same cost, then take the cost from the router to the ASBR into consideration.
Classification of OSPF Networks
OSPF network types
OSPF classifies networks into four types upon the link layer protocol:
l Broadcast: When the link layer protocol is Ethernet or FDDI, OSPF considers the network type broadcast by default. On Broadcast networks, hello packets, LSU packets, and LSAck packets are generally sent to multicast addresses 224.0.0.5 (reserved for OSPF routers) and 224.0.0.6 (reserved for OSPF DRs), while DD packets and LSR packets are unicast.
l NBMA (Non-Broadcast Multi-Access): When the link layer protocol is Frame Relay, ATM or X.25, OSPF considers the network type as NBMA by default. Packets on these networks are sent to unicast addresses.
l P2MP (point-to-multipoint): By default, OSPF considers no link layer protocol as P2MP, which is a conversion from other network types such as NBMA in general. On P2MP networks, packets are sent to multicast addresses (224.0.0.5).
l P2P (point-to-point): When the link layer protocol is PPP or HDLC, OSPF considers the network type as P2P. On P2P networks, packets are sent to multicast addresses (224.0.0.5).
NBMA network configuration principle
Typical NBMA networks are ATM and Frame Relay networks.
You need to perform some special configuration on NBMA interfaces. Since these interfaces cannot broadcast hello packets for neighbor location, you need to specify neighbors manually and configure whether the neighbors have the DR election right.
An NBMA network is fully meshed, which means any two routers in the NBMA network have a direct virtual link for communication. If direct connections are not available between some routers, the type of interfaces associated should be configured as P2MP, or as P2P for interfaces with only one neighbor.
Differences between NBMA and P2MP networks:
l NBMA networks are fully meshed, non-broadcast and multi access. P2MP networks are not required to be fully meshed.
l It is required to elect the DR and BDR on NBMA networks, while DR and BDR are not available on P2MP networks.
l NBMA is the default network type, while P2MP is a conversion from other network types, such as NBMA in general.
l On NBMA networks, packets are unicast, and neighbors are configured manually on routers. On P2MP networks, packets are multicast.
DR and BDR
DR/BDR introduction
On broadcast or NBMA networks, any two routers exchange routing information with each other. If n routers are present on a network, n(n-1)/2 adjacencies are required. Any change on a router in the network generates traffic for routing information synchronization, consuming network resources. The Designated Router is defined to solve the problem. All other routers on the network send routing information to the DR, which is responsible for advertising link state information.
If the DR fails to work, routers on the network have to elect another DR and synchronize information with the new DR. It is time-consuming and prone to routing calculation errors. The Backup Designated Router (BDR) is introduced to reduce the synchronization period.
The BDR is elected along with the DR and establishes adjacencies for routing information exchange with all other routers. When the DR fails, the BDR will become the new DR in a very short period by avoiding adjacency establishment and DR reelection. Meanwhile, other routers elect another BDR, which requires a relatively long period but has no influence on routing calculation.
Other routers, also known as DRothers, establish no adjacency and exchange no routing information with each other, thus reducing the number of adjacencies on broadcast and NBMA networks.
In the following figure, real lines are Ethernet physical links, and dashed lines represent adjacencies. With the DR and BDR in the network, only seven adjacencies are enough.
Figure 1-6 DR and BDR in a network
DR/BDR election
The DR and BDR in a network are elected by all routers rather than configured manually. The DR priority of an interface determines its qualification for DR/BDR election. Interfaces attached to the network and having priorities higher than ‘0” are election candidates.
The election votes are hello packets. Each router sends the DR elected by itself in a hello packet to all the other routers. If two routers on the network declare themselves as the DR, the router with the higher DR priority wins. If DR priorities are the same, the router with the higher router ID wins. In addition, a router with the priority 0 cannot become the DR/BDR.
Note that:
l The DR election is available on broadcast, NBMA interfaces rather than P2P, or P2MP interfaces.
l A DR is an interface of a router and belongs to a single network segment. The router’s other interfaces may be a BDR or DRother.
l After DR/BDR election and then a new router joins, it cannot become the DR immediately even if it has the highest priority on the network.
l The DR may not be the router with the highest priority in a network, and the BDR may not be the router with the second highest priority.
OSPF Packet Formats
OSPF packets are directly encapsulated into IP packets. OSPF has the IP protocol number 89. The OSPF packet format is shown below (taking a LSU packet as an example).
Figure 1-7 OSPF packet format
OSPF packet header
OSPF packets are classified into five types that have the same packet header, as shown below.
Figure 1-8 OSPF packet header
l Version: OSPF version number, which is 2 for OSPFv2.
l Type: OSPF packet type from 1 to 5, corresponding with hello, DD, LSR, LSU and LSAck respectively.
l Packet length: Total length of the OSPF packet in bytes, including the header.
l Router ID: ID of the advertising router.
l Area ID: ID of the area where the advertising router resides.
l Checksum: Checksum of the message.
l Autype: Authentication type from 0 to 2, corresponding with non-authentication, simple (plaintext) authentication and MD5 authentication respectively.
l Authentication: Information determined by authentication type. It is not defined for authentication type 0. It is difined as password information for authentication type 1, and defined as Key ID, MD5 authentication data length and sequence number for authentication type 2.
MD5 authentication data is added following an OSPF packet rather than contained in the Authentication field.
Hello packet
A router sends hello packets periodically to neighbors to find and maintain neighbor relationships and to elect the DR/BDR, including information about values of timers, DR, BDR and neighbors already known. The format is shown below:
Figure 1-9 Hello packet format
Major fields:
l Network mask: Network mask associated with the router’s sending interface. If two routers have different network masks, they cannot become neighbors.
l HelloInterval: Interval for sending hello packets. If two routers have different intervals, they cannot become neighbors.
l Rtr Pri: Router priority. A value of 0 means the router cannot become the DR/BDR.
l RouterDeadInterval: Time before declaring a silent router down. If two routers have different time values, they cannot become neighbors.
l Designated router: IP address of the DR interface.
l Backup designated router: IP address of the BDR interface
l Neighbor: Router ID of the neighbor router.
DD packet
Two routers exchange database description (DD) packets describing their LSDBs for database synchronization, contents in DD packets including the header of each LSA (uniquely representing a LSA). The LSA header occupies small part of an LSA to reduce traffic between routers. The recipient checks whether the LSA is available using the LSA header.
The DD packet format:
Figure 1-10 DD packet format
Major fields:
l Interface MTU: Size in bytes of the largest IP datagram that can be sent out the associated interface, without fragmentation.
l I (Initial) The Init bit, which is set to 1 if the packet is the first packet of database description packets, and set to 0 if not.
l M (More): The More bit, which is set to 0 if the packet is the last packet of DD packets, and set to 1 if more DD Packets are to follow.
l MS (Master/Slave): The Master/Slave bit. When set to 1, it indicates that the router is the master during the database exchange process. Otherwise, the router is the slave.
l DD Sequence Number: Used to sequence the collection of database description packets for ensuring reliability and intactness of DD packets between the master and slave. The initial value is set by the master. The DD sequence number then increments until the complete database description has been sent.
LSR packet
After exchanging DD packets, any two routers know which LSAs of the peer routers are missing from the local LSDBs. In this case, they send LSR (link state request) packets, requesting the missing LSAs. The packets contain the digests of the missing LSAs. The following figure shows the LSR packet format.
Figure 1-11 LSR packet format
Major fields:
l LS type: Type number of the LSA to be requested. Type 1 for example indicates the Router LSA.
l Link State ID: Determined by LSA type.
l Advertising Router: ID of the router that sent the LSA.
LSU packet
LSU (Link State Update) packets are used to send the requested LSAs to peers, and each packet carries a collection of LSAs. The LSU packet format is shown below.
Figure 1-12 LSU packet format
LSAck packet
LSAack (Link State Acknowledgment) packets are used to acknowledge received LSU packets, contents including LSA headers to describe the corresponding LSAs. Multiple LSAs can be acknowledged in a single Link State Acknowledgment packet. The following figure gives its format.
Figure 1-13 LSAck packet format
LSA header format
All LSAs have the same header, as shown in the following figure.
Figure 1-14 LSA header format
Major fields:
l LS age: Time in seconds elapsed since the LSA was originated. A LSA ages in the LSDB (added by 1 per second), but does not in transmission.
l LS type: Type of the LSA.
l Link State ID: The contents of this field depend on the LSA's type
l LS sequence number: Used by other routers to judge new and old LSAs.
l LS checksum: Checksum of the LSA except the LS age field.
l Length: Length in bytes of the LSA, including the LSA header.
Formats of LSAs
1) Router LSA
Figure 1-15 Router LSA format
Major fields:
l Link State ID: ID of the router that originated the LSA.
l V (Virtual Link): Set to 1 if the router that originated the LSA is a virtual link endpoint.
l E (External): Set to 1 if the router that originated the LSA is an ASBR.
l B (Border): Set to 1 if the router that originated the LSA is an ABR.
l # Links: Number of router links (interfaces) to the area, described in the LSA.
l Link ID: Determined by Link type.
l Link data: Determined by Link type.
l Type: Link type. A value of 1 indicates a point-to-point link to a remote router; a value of 2 indicates a link to a transit network; a value of 3 indicates a link to a stub network; a value of 4 indicates a virtual link.
l #TOS: Number of different TOS metrics given for this link.
l Metric: Cost of using this router link.
l TOS: IP Type of Service that this metric refers to.
l TOS metric: TOS-specific metric information.
2) Network LSA
A Network LSA is originated by the DR on a broadcast or NBMA network. The LSA describes all routers attached to the network.
Figure 1-16 Network LSA format
Major fields:
l Link State ID: The interface address of the DR
l Network mask: The mask of the network (a broadcast or NBMA network)
l Attached router: The IDs of the routers, which are adjacent to the DR, including the DR itself
3) Summary LSA
Network summary LSAs (Type-3 LSAs) and ASBR summary LSAs (Type-4 LSAs) are originated by ABRs. Other than the difference in the Link State ID field, the format of type 3 and 4 summary-LSAs is identical.
Figure 1-17 Summary LSA format
Major fields:
l Link State ID: For a Type-3 LSA, it is an IP address outside the area; for a type 4 LSA, it is the router ID of an ASBR outside the area.
l Network mask: The network mask for the type 3 LSA; set to 0.0.0.0 for the Type-4 LSA
l Metric: The metric to the destination
A Type-3 LSA can be used to advertise a default route, having the Link State ID and Network Mask set to 0.0.0.0.
4) AS external LSA
An AS external LSA originates from an ASBR, describing routing information to a destination outside the AS.
Figure 1-18 AS external LSA format
Major fields:
l Link State ID: The IP address of another AS to be advertised. When describing a default route, the Link State ID is always set to Default Destination (0.0.0.0) and the Network Mask is set to 0.0.0.0
l Network mask: The IP address mask for the advertised destination
l E (External Metric): The type of the external metric value, which is set to 1 for type 2 external routes, and set to 0 for type 1 external routes. Refer to Route types for description about external route types
l Metric: The metric to the destination
l Forwarding Address: Data traffic for the advertised destination will be forwarded to this address
l External Route Tag: A tag attached to each external route. This is not used by the OSPF protocol itself. It may be used to manage external routes.
5) NSSA external LSA
An NSSA external LSA originates from the ASBR in a NSSA and is flooded in the NSSA area only. It has the same format as the AS external LSA.
Figure 1-19 NSSA external LSA format
Supported OSPF Features
Multi-process
With multi-process support, multiple OSPF processes can run on a router simultaneously and independently. Routing information interactions between different processes seem like interactions between different routing protocols. Multiple OSPF processes can use the same RID.
An interface of a router can only belong to a single OSPF process.
Authentication
OSPF supports authentication on packets. Only packets that pass the authentication are received. If hello packets cannot pass authentication, no neighbor relationship can be established.
The authentication type for interfaces attached to a single area must be identical. Authentication types include non-authentication, plaintext authentication and MD5 ciphertext authentication. The authentication password for interfaces attached to a network segment must be identical.
Hot Standby
For hot standby configuration, refer to HA Configuration in the System Volume.
Distributed routers support OSPF Hot Standby (HSB). OSPF backups necessary information of the Active Main Board (AMB) into the Standby Main Board (SMB). Once the AMB fails, the SMB begins to work to ensure the normal operation of OSPF.
OSPF backups:
l All OSPF data to the SMB to make sure OSPF recovers normal operation immediately upon the AMB failure.
l Only the OSPF configuration information to the SMB. Once the AMB fails, OSPF will perform Graceful Restart (GR), obtaining adjacencies from and synchronizing the Link State Database with neighbors.
The Graceful Restart feature is mainly used for High Availability (HA) and does not interfere with any other routers.
When a router shuts down, its neighbors will delete it from their neighbor tables and inform other routers, resulting in SPF recalculation. If the router restarts in several seconds, it is unnecessary to perform SPF recalculation, and reestablish adjacencies.
To avoid unnecessary SPF calculation, when a router restarts, it will inform neighboring routers the shutdown is temporary. Then these routers will not delete the router from their neighbor tables, and other routers have no idea about this restart.
After recovering to normal, the router obtains the Link State Database from neighboring routers via the GR related synchronization mechanism.
OSPF Graceful Restart
For GR information, refer to GR Overview in the System Volume.
After an OSPF GR Restarter restarts, it needs to perform the following two tasks in order to re-synchronize its LSDB with its neighbors.
l To obtain once again effective OSPF neighbor information (assume the adjacencies are not changed).
l To obtain once again the LSDB.
After restart, the GR Restarter negotiates GR capability with its neighbors and sends an OSPF GR signal to its GR-capable neighbors so that they will not remove their adjacencies with it and advertise the adjacencies. The GR Restarter re-establishes neighborships and updates its own routing table and forwarding table based on the new routing information received from neighbors and removes the stale routes.
VPN
OSPF supports multi-instance, which can run on PEs in VPN networks.
In BGP MPLS VPN networks, multiple sites in the same VPN can use OSPF as the internal routing protocol, but they are treated as different ASs. An OSPF route learned by a site will be forwarded to another site as an external route, which leads to heavy OSPF routing traffic and management issues.
Configuring area IDs on PEs can differentiate VPNs. Sites in the same VPN are considered as directly connected. PE routers then exchange OSPF routing information like on a dedicated line; thus network management and OSPF operation efficiency are improved.
For configuration of this feature, refer to MPLS L3VPN Configuration in the MPLS Volume.
OSPF sham link
An OSPF sham link is a point-to-point link between two PE routers on the MPLS VPN backbone.
In general, BGP peers exchange routing information on the MPLS VPN backbone using the BGP extended community attribute. OSPF running on a PE at the other end utilizes this information to originate a Type-3 summary LSA as an inter-area route between the PE and CE.
If a router connects to a PE router in the same area and establishes an internal route (backdoor route) to a destination, in this case, since an OSPF intraarea route has a higher priority than a backbone route, VPN traffic will always travel on the backdoor route rather than the backbone route. To avoid this, an unnumbered sham link can be configured between PE routers, connecting the router to another PE router via an intraarea route with a lower cost.
For sham link configuration, refer to MPLS L3VPN Configuration in the MPLS Volume.
Protocols and Standards
l RFC 1765:OSPF Database Overflow
l RFC 2328: OSPF Version 2
l RFC 3101: OSPF Not-So-Stubby Area (NSSA) Option
l RFC 3137: OSPF Stub Router Advertisement
OSPF Configuration Task List
An OSPF routing domain has different types of routers, such as intra-area routers, ABR, and ASBR.
OSPF can work normally only after being enabled on a router, regardless of the router’s type. On an OSPF-enabled router, you can use the default values of parameters, such as the transmit interval of OSPF packets, LSA delay timer, and SPF caculation interval, or configure them as required.
Network planning is needed before OSPF configuration on routers. The configurations for routers in an area are performed on the area basis. Wrong configurations may cause communication failures, even routing information block or routing loops between neighboring routers..
Complete the following tasks to configure OSPF:
Task |
Remarks |
|
Required |
||
Optional |
||
Configuring the OSPF Network Type for an Interface as Broadcast |
Optional |
|
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Making External Route Selection Rules Defined in RFC1583 Compatible |
Optional |
|
Optional |
||
Optional |
||
Optional |
||
Optional |
||
Configuring OSPF to Give Priority to Receiving and Processing Hello Packets |
Optional |
|
Optional |
||
Optional |
||
Optional |
||
Optional |
Enabling OSPF
You need to enable OSPF before you can perform other OSPF configuration tasks.
Prerequisites
Before configuring OSPF, you have configured IP addresses for interfaces, making neighboring nodes accessible with each other at the network layer.
Configuration Procedure
To enable OSPF on a router, you need to create an OSPF process and specify areas with which the process is associated, and the network segments contained in each area. If an interface’s IP address resides on a network segment of an area, the interface belongs to the area and is enabled with OSPF, and OSPF advertises the direct route of the interface.
To run OSPF, a router must have a Router ID, which is the unique identifier of the router in the AS.
l You can specify a Router ID when creating the OSPF process. Any two routers in an AS must have different Router IDs. In practice, the ID of a router is the IP address of one of its interfaces.
l If you specify no Router ID when creating the OSPF process, the global Router ID will be used. For details about global Router ID, refer to IP Routing Overview in the IP Routing Volume. You are recommended to specify a Router ID when creating the OSPF process.
The system supports OSPF multi-process and OSPF multi-instance:
l When a router runs multiple OSPF processes, you need to specify a Router ID for each process, which takes effect locally and has no influence on packet exchange between routers. Therefore, two routers having different process IDs can exchange packets.
l You can configure an OSPF process to run in a specified VPN instance.
Follow these steps to enable OSPF:
To do… |
Use the command… |
Remarks |
Enter system view |
System-view |
— |
Enable an OSPF process and enter its view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required Not enabled by default. |
Configure a description for the OSPF process |
description description |
Optional Not configured by default. |
Configure an OSPF area and enter OSPF area view |
area area-id |
Required Not configured by default. |
Configure a description for the area |
description description |
Optional Not configured by default. |
Specify a network to enable OSPF on the interface attached to the network |
network ip-address wildcard-mask |
Required Not configured by default. |
l A network segment can only belong to one area.
l It is recommended to configure a description for each OSPF process to help identify purposes of processes and for ease of management and memorization.
l It is recommended to configure a description for each area to help identify purposes of areas and for ease of management and memorization.
Configuring OSPF Areas
After splitting an OSPF AS into multiple areas, you can further configure some areas as stub areas or NSSA areas as needed.
If the backbone and non-backbone areas, including the backbone itself, cannot maintain connectivity, you can configure virtual links to solve it.
Prerequisites
Before configuring an OSPF area, you have configured:
l IP addresses for interfaces, making neighboring nodes accessible with each other at the network layer.
l OSPF basic functions.
Configuring a Stub Area
You can configure a non-backbone area at the AS edge as a stub area by configuring the stub command on all the routers attached to the area. In this way, Type-5 LSAs, which describe AS external routes, will not be flooded within the stub area, reducing the routing table size. The ABR generates a default route into the stub area so that all packets destined outside of the AS are sent through the default route.
To further reduce the routing table size and routing information exchanged in the stub area, you can configure it as a totally stub area by using the stub [ no-summary ] command on the ABR. In this way, neither AS external routes nor inter-area routing information will be distributed into the area. All the packets destined outside of the AS or area will be sent to the ABR for forwarding.
Follow these steps to configure OSPF areas:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter area view |
area area-id |
Required |
Configure the area as a stub area |
stub [ no-summary ] |
Required Not configured by default. |
Specify a cost for the default route advertised to the stub area |
default-cost cost |
Optional Defaults to 1. |
l It is required to use the stub command on routers attached to a stub area.
l Using the default-cost command only takes effect on the ABR of a stub area.
l The backbone area cannot be a (totally) stub area.
l A (totally) stub area cannot have an ASBR because AS external routes cannot be distributed into the stub area.
l Virtual links cannot transit (totally) stub areas.
Configuring an NSSA Area
A stub area cannot redistribute routes. You can configure the area as an NSSA area to allow for route redistribution while keeping other characteristics of a stub area.
Follow these steps to configure an NSSA area:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter area view |
area area-id |
Required |
Configure the area as an NSSA area |
nssa [ default-route-advertise | no-import-route | no-summary ] * |
Required Not configured by default. |
Specify a cost for the default route advertised to the NSSA area |
default-cost cost |
Optional Defaults to 1. |
l It is required to use the nssa command on all the routers attached to an NSSA area.
l Using the default-cost command only takes effect on the ABR/ASBR of an NSSA area.
Configuring a Virtual Link
Non-backbone areas exchange routing information via the backbone area. Therefore, connectivity between the backbone and non-backbone areas and within the backbone itself must be maintained.
If necessary physical links are not available for this connectivity maintenance, you can configure virtual links to solve it.
Follow these steps to configure a virtual link:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter area view |
area area-id |
Required |
Configure a virtual link |
vlink-peer router-id [ hello seconds | retransmit seconds | trans-delay seconds | dead seconds | simple [ plain | cipher ] password | { md5 | hmac-md5 } key-id [ plain | cipher ] password ] * |
Required You need to configure this command on both ends of a virtual link. Note that hello and dead intervals must be identical on both ends of the virtual link. |
Configuring OSPF Network Types
OSPF classifies networks into four types: broadcast, NBMA, P2MP, and P2P, upon the link layer protocol.
l Broadcast: When the link layer protocol is Ethernet or FDDI, OSPF considers the network type as broadcast by default.
l NBMA: When the link layer protocol is Frame Relay, ATM or X.25, OSPF considers the network type as NBMA by default.
l P2P: When the link layer protocol is PPP, LAPB, HDLC, or POS, OSPF considers the network type as P2P by default.
You can change the network type of an interface as needed. For example:
l When an NBMA network becomes fully meshed through address mapping, namely, when any two routers in the network have a direct virtual link in between, you can change the network type to broadcast, without manually configuring the neighbors.
l When some routers in the broadcast network do not support multicast, you can change the network type to NBMA.
l An NBMA network is fully meshed, which means any two routers in the NBMA network have a direct virtual link for communication. If direct connections are not available between some routers, the type of interfaces associated should be configured as P2MP, or as P2P for interfaces with only one neighbor.
If two interfaces on a link are both configured as the broadcast, NBMA or P2MP type, they cannot establish a neighbor relationship unless they are on the same network segment.
Prerequisites
Before configuring OSPF network types, you have configured:
l IP addresses for interfaces, making neighboring nodes accessible with each other at network layer.
l OSPF basic functions.
Configuring the OSPF Network Type for an Interface as Broadcast
Follow these steps to configure the OSPF network type for an interface as broadcast:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure the OSPF network type for the interface as broadcast |
ospf network-type broadcast |
Required By default, the network type of an interface depends on the link layer protocol. |
Configure a DR priority for the interface |
ospf dr-priority priority |
Optional The default DR priority is 1. |
Configuring the OSPF Network Type for an Interface as NBMA
After configuring the network type of an interface as NBMA, you need to make some special configurations.
Because NBMA interfaces cannot find neighbors via broadcasting Hello packets, you need to specify neighbors and neighbor DR priorities. (A DR priority of 0 means the router does not have the DR election right; a DR priority greater than 0 means the router has the DR election right).
Follow these steps to configure the OSPF network type for an Interface as NBMA:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure the OSPF network type for the interface as NBMA |
ospf network-type nbma |
Required By default, the network type of an interface depends on the link layer protocol. |
Configure a DR priority for the interface |
ospf dr-priority priority |
Optional The default DR priority is 1 |
Exit to system view |
quit |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Specify a neighbor and its DR priority |
peer ip-address [ dr-priority dr-priority ] |
Required |
The DR priority configured with the ospf dr-priority command and the one with the peer command have the following differences:
l The former is for actual DR election.
l The latter is to indicate whether a neighbor has the election right or not. If you configure the DR priority for a neighbor as 0, the local router will consider the neighbor has no election right, and thus no hello packet is sent to this neighbor, reducing the number of hello packets for DR/BDR election on networks. However, if the local router is the DR or BDR, it sends hello packets to the neighbor with priority 0 for adjacency establishment.
Configuring the OSPF Network Type for an Interface as P2MP
Follow these steps to configure the OSPF network type for an interface as P2MP:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure the OSPF network type for the interface as P2MP |
ospf network-type p2mp |
Required By default, the network type of an interface depends on the link layer protocol. |
Configuring the OSPF Network Type for an Interface as P2P
Follow these steps to configure the OSPF network type for an interface as P2P:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure the OSPF network type for the interface as P2P. |
ospf network-type p2p |
Required By default, the network type of an interface depends on the link layer protocol. |
Configuring OSPF Route Control
This section covers how to control OSPF routing information advertisement and reception, and route redistribution from other protocols.
Prerequisites
Before configuring this task, you have configured:
l IP addresses for interfaces
l OSPF basic functions
l Corresponding filters if routing information filtering is needed.
Configuring OSPF Route Summarization
Route summarization: An ABR or ASBR summarizes routes with the same prefix into a single route and distribute it to other areas.
Through route summarization, routing information across areas and the size of routing tables on routers will be reduced, improving calculation speed of routers.
Assume in an area are three internal routes 19.1.1.0/24, 19.1.2.0/24, and 19.1.3.0/24. By configuring route summarization on the ABR, the three routes are summarized into the route 19.1.0.0/16 that is advertised into other areas.
Configuring route summarization on an ABR
If contiguous network segments are available in the area, you can summarize them into a single network segment. An ABR generates Type-3 LSAs on a per network segment basis for an attached non-backbone area.
In this way, the ABR in the area distributes only the summary LSA to reduce the scale of LSDBs on routers in other areas and the influence of topological changes.
Follow these steps to configure route summarization on an ABR:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter OSPF area view |
area area-id |
— |
Configure ABR route summarization |
abr-summary ip-address { mask | mask-length } [ advertise | not-advertise ] [ cost cost ] |
Required The command is available on an ABR only. Not configured by default. |
Configuring route summarization when redistributing routes into OSPF on an ASBR
If summarization for redistributed routes is not configured on an ASBR, it will advertise each redistributed route in a separate ASE LSA. After a summary is configured on the ASBR, it advertises only the summary route in an ASE LSA instead of more specific routes, thus reducing the number of LSAs in the LSDBs.
If summarization for redistributed routes is configured on an ASBR, it will summarize redistributed Type-5 LSAs that fall into the specified address range.
If in an NSSA area, it also summarizes Type-7 LSAs that fall into the specified address range. If this feature is configured on a router working as an ABR and ASBR at the same time, the router will summarize Type-5 LSAs translated from Type-7 LSAs.
Follow these steps to configure route summarization when redistributing routes into OSPF on an ASBR:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ]* |
— |
Configure ASBR route summarization |
asbr-summary ip-address { mask | mask-length } [ tag tag | not-advertise | cost cost ] * |
Required The command is available on an ASBR only. Not configured by default. |
Configuring OSPF Inbound Route Filtering
Since OSPF is a link state-based interior gateway protocol, routing information is contained in LSAs. Routes computed by OSPF can be filtered and only permitted routes are installed into the routing table.
There are two filtering methods:
l Filtering routing information by destination address through ACLs and IP address prefixes.
l Filtering routing information by next hop through the filtering criteria configured with the gateway keyword.
Follow these steps to configure inbound route filtering:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure inbound route filtering |
filter-policy { acl-number | ip-prefix ip-prefix-name | gateway ip-prefix-name } import |
Required Not configured by default. |
Configuring ABR Type-3 LSA Filtering
Configure Type-3 LSA filtering on an ABR to filter Type-3 LSAs to be advertised in the area to which the ABR is attached or the Type-3 LSAs that the ABR advertises to other areas.
Follow these steps to configure Type-3 LSA filtering on an ABR:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter area view |
area area-id |
— |
Configure ABR Type-3 LSA filtering |
filter { acl-number | ip-prefix ip-prefix-name } { import | export } |
Required Not configured by default. |
Configuring an OSPF Cost for an Interface
You can configure an OSPF cost for an interface with one of the following two methods:
l Configure the cost value in interface view.
l Configure a bandwidth reference value for the interface, and OSPF computes the cost automatically based on the bandwidth reference value: Interface OSPF cost= Bandwidth reference value/Interface bandwidth. If the calculated cost is greater than 65535, the value of 65535 is used; if the calculated cost is less than 1, the value of 1 is used.
If the cost value is not configured for an interface, OSPF computes the interface cost automatically:
Follow these steps to configure an OSPF cost for an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure an OSPF cost for the interface |
ospf cost value |
Optional By default, an interface computes its cost according to the bandwidth. The cost value defaults to 1 for VLAN interfaces. |
Follow these steps to configure a bandwidth reference value:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure a bandwidth reference value |
bandwidth-reference value |
Optional The value defaults to 100 Mbps. |
Configuring the Maximum Number of OSPF Routes
Follow these steps to configure the maximum number of routes:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure the maximum number of OSPF routes |
maximum-routes { external | inter | intra } number |
Optional The default number is 128000. |
Configuring the Maximum Number of Load-balanced Routes
If several routes with the same cost to the same destination are available, configuring them as load-balanced routes can improve link utilization.
Follow these steps to configure the maximum number of load-balanced routes:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure the maximum number of equivalent load-balanced routes |
maximum load-balancing maximum |
Optional The default number is 4. |
Configuring a Priority for OSPF
A router may run multiple routing protocols, and it sets a priority for each protocol. When a route found by several routing protocols, the route found by the protocol with the highest priority will be selected.
Follow these steps to configure a priority for OSPF:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure a priority for OSPF |
preference [ ase ] [ route-policy route-policy-name ] value |
Optional The priority of OSPF internal routes defaults to 10. The priority of OSPF external routes defaults to 150. |
Configuring OSPF Route Redistribution
Configure route redistribution into OSPF
If the router runs OSPF and other routing protocols, you can configure OSPF to redistribute RIP, IS-IS, BGP, static, or direct routes and advertise these routes in Type-5 LSAs or Type-7 LSAs.
By filtering redistributed routes, OSPF translates only routes not filtered out into Type-5 LSAs or Type-7 LSAs for advertisement.
Follow these steps to configure OSPF route redistribution:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure OSPF to redistribute routes from another protocol |
import-route protocol [ process-id | all-processes | allow-ibgp ] [ cost cost | type type | tag tag | route-policy route-policy-name ] * |
Required Not configured by default. |
Configure OSPF to filter redistributed routes before advertisement |
filter-policy { acl-number | ip-prefix ip-prefix-name } export [ protocol [ process-id ] ] |
Optional Not configured by default. |
Only active routes can be redistributed. You can use the display ip routing-table protocol command to display route state information.
Configure OSPF to redistribute a default route
Using the import-route command cannot redistribute a default external route. To do so, you need to use the default-route-advertise command.
Follow these steps to configure OSPF to redistribute a default external route:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Redistribute a default route |
default-route-advertise [ always | cost cost | type type | route-policy route-policy-name ] * |
Optional Not redistributed by default. |
default-route-advertise summary cost cost |
The default-route-advertise summary cost command is applicable only to VPN, and the default route is redistributed in a Type-3 LSA. The PE router will advertise the default route to the CE router.
Configure the default parameters for redistributed routes
You can configure default parameters such as the cost, upper limit, tag and type for redistributed routes. Tags are used to indicate information related to protocols. For example, when redistributing BGP routes, OSPF uses tags to identify AS IDs.
Follow these steps to configure the default parameters for redistributed routes:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure the default parameters for redistributed routes (cost, route number, tag and type) |
default { cost cost | limit limit | tag tag | type type } * |
Optional By default, the default cost is 1, default upper limit of routes redistributed per time is 1000, default tag is 1 and default type of redistributed routes is Type-2. |
Advertising a Host Route
Follow these steps to advertise a host route:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter area view |
area area-id |
— |
Advertise a host route |
host-advertise ip-address cost |
Required Not advertised by default. |
Configuring OSPF Network Optimization
You can optimize your OSPF network in the following ways:
l Change OSPF packet timers to adjust the OSPF network convergence speed and network load. On low speed links, you need to consider the delay time for sending LSAs on interfaces.
l Change the interval for SPF calculation to reduce resource consumption caused by frequent network changes.
l Configure OSPF authentication to meet high security requirements of some mission-critical networks.
l Configure OSPF network management functions, such as binding OSPF MIB with a process, sending trap information and collecting log information.
Prerequisites
Before configuring OSPF network optimization, you have configured:
l IP addresses for interfaces;
l OSPF basic functions.
Configuring OSPF Packet Timers
You can configure the following timers on OSPF interfaces as needed:
l Hello timer: Interval for sending hello packets. It must be identical on OSPF neighbors. The longer the interval, the lower convergence speed and smaller network load.
l Poll timer: Interval for sending hello packets to the neighbor that is down on the NBMA network.
l Dead timer: Interval within which if the interface receives no hello packet from the neighbor, it declares the neighbor is down.
l LSA retransmission timer: Interval within which if the interface receives no acknowledgement packets after sending a LSA to the neighbor, it will retransmit the LSA.
Follow these steps to configure timers for OSPF packets:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Specify the hello interval |
ospf timer hello seconds |
Optional The hello interval on P2P, Broadcast interfaces defaults to 10 seconds and defaults to 30 seconds on P2MP and NBMA interfaces. |
Specify the poll interval |
ospf timer poll seconds |
Optional The poll interval defaults to 120 seconds. |
Specify the dead interval |
ospf timer dead seconds |
Optional The default dead interval is 40 seconds on P2P, Broadcast interfaces and 120 seconds on P2MP and NBMA interfaces. |
Specify the retransmission interval |
ospf timer retransmit interval |
Optional The retransmission interval defaults to 5 seconds. |
l The hello and dead intervals restore to default values after you change the network type for an interface.
l The dead interval should be at least four times the hello interval on an interface.
l The poll interval is at least four times the hello interval.
l The retransmission interval should not be so small for avoidance of unnecessary LSA retransmissions. In general, this value is bigger than the round-trip time of a packet between two adjacencies.
Specifying an LSA Transmission Delay
Since OSPF packets need time for travelling on links, extending LSA age time with a delay is necessery, especially for low speed links.
Follow these steps to specify an LSA transmission delay on an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Specify an LSA transmission delay |
ospf trans-delay seconds |
Optional 1 second by default |
Specifying SPF Calculation Interval
The LSDB changes lead to SPF calculations. When an OSPF network changes frequently, a large amount of network resources will be occupied, reducing the working efficiency of routers. You can adjust the SPF calculation interval for the network to reduce negative influence.
Follow these steps to configure SPF calculation interval:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Specify SPF calculation interval(s) |
spf-schedule-interval maximum-interval [ minimum-interval [ incremental-interval ] ] |
Optional By default, the interval is 5 seconds. |
With this task configured, when network changes are not frequent, SPF calculation applies at the minimum-interval. If network changes become frequent, SPF calculation interval is incremented by incremental-interval•2n-2 (n is the number of calculation times) each time a calculation occurs, up to the maximum-interval.
Specifying the LSA Minimum Repeat Arrival Interval
After receiving the same LSA as the previously received LSA within the LSA minimum repeat arrival interval, an interface discards the LSA.
Follow these steps to configure the LSA minimum repeat arrival interval:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure the LSA minimum repeat arrival interval |
lsa-arrival-interval interval |
Optional Defaults to 1000 milliseconds. |
The interval set with the lsa-arrival-interval command should be smaller or equal to the interval set with the lsa-generation-interval command.
Specifying the LSA Generation Interval
With this feature configured, you can protect network resources and routers from being over consumed due to frequent network changes.
Follow these steps to configure the LSA generation interval:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required |
Configure the LSA generation interval |
lsa-generation-interval maximum-interval [ initial-interval [ incremental-interval ] ] |
Optional By default, the maximum interval is 5 seconds, the minimum interval is 0 milliseconds and the incremental interval is 5000 milliseconds. |
With this command configured, when network changes are not frequent, LSAs are generated at the minimum-interval. If network changes become frequent, LSA generation interval is incremented by incremental-interval•2n-2 (n is the number of generation times) each time a generation occurs, up to the maximum-interval.
Disabling Interfaces from Sending OSPF Packets
Follow these steps to disable interfaces from sending routing information:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Disable interfaces from sending OSPF packets |
silent-interface { all | interface-type interface-number } |
Optional Not disabled by default |
l Different OSPF processes can disable the same interface from sending OSPF packets. Use of the silent-interface command disables only the interfaces associated with the current process rather than interfaces associated with other processes.
l After an OSPF interface is set to silent, other interfaces on the router can still advertise direct routes of the interface in Router LSAs, but no OSPF packet can be advertised for the interface to find a neighbor. This configuration can enhance adaptability of OSPF networking and reduce resource consumption.
Configuring Stub Routers
A stub router is used for traffic control. It tells other OSPF routers not to use it to forward data, but they can have a route to it.
The Router LSAs from the stub router may contain different link type values. A value of 3 means a link to the stub network, so the cost of the link remains unchanged. A value of 1, 2 or 4 means a point-to-point link, a link to a transit network or a virtual link. In such cases, a maximum cost value of 65535 is used. Thus, other neighbors find the links to the stub router have such big costs, they will not send packets to the stub router for forwarding as long as there is a route with a smaller cost.
Follow these steps to configure a router as a stub router:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure the router as a stub router |
stub-router |
Required Not configured by default. |
A stub router has nothing to do with a stub area.
Configuring OSPF Authentication
OSPF supports packet authentication to ensure the security of packet exchange.
By supporting packet authentication, OSPF receives packets that pass the authentication only, so failed packets cannot establish neighboring relationships.
To configure OSPF packet authentication, you need to configure the same area authentication mode on all the routers in the area. In addition, the authentication mode and password for all interfaces attached to the same area must be identical.
Follow these steps to configure OSPF authentication:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enter area view |
area area-id |
— |
Configure the authentication mode |
authentication-mode { simple | md5 } |
Required Not configured by default. |
Exit to OSPF view |
quit |
— |
Exit to system view |
quit |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure the authentication mode (simple authentication) for the interface |
ospf authentication-mode simple [ plain | cipher ] password |
Either is required. Not configured by default. |
Configure the authentication mode (MD5 authentication) for the interface |
ospf authentication-mode { md5 | hmac-md5 } key-id [ plain | cipher ] password |
Adding the Interface MTU into DD Packets
Generally, when an interface sends a DD packet, it adds 0 into the Interface MTU field of the DD packet rather than the interface MTU.
Follow these steps to add the interface MTU into DD packets:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable OSPF to add the interface MTU into DD packets |
ospf mtu-enable |
Optional Not enabled by default.; that is, the interface fills in a value of 0. |
Configuring the Maximum Number of External LSAs in LSDB
Follow these steps to configure the maximum number of external LSAs in the Link State Database:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Specify the maximum number of external LSAs in the LSDB |
lsdb-overflow-limit number |
Optional No specified by default |
Making External Route Selection Rules Defined in RFC1583 Compatible
The selection of an external route from multiple LSAs defined in RFC2328 is different from the one defined in RFC1583. If RFC 1583 is made compatible with RFC 2328, the routes in the backbone area are preferred; if not, the routes in the non-backbone area are preferred to reduce the burden of the backbone area.
Follow these steps to make them compatible:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required |
Make RFC1583 compatible |
rfc1583 compatible |
Optional Compatible by default |
To avoid routing loops, it is recommended to configure all the routers to be either compatible or incompatible with the external route selection rules defined in RFC 1583.
Logging Neighbor State Changes
Follow these steps to enable the logging of neighbor state changes:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enable the logging of neighbor state changes |
log-peer-change |
Optional Enabled by default |
Configuring OSPF Network Management
After trap generation is enabled for OSPF, OSPF generates traps to report important events. Traps fall into the following levels:
l Level-3, for fault traps
l Level-4, for alarm traps
l Level-5, for normal but important traps
l Level-6, for notification traps
The generated traps are sent to the Infomraiton Center of the device. The output rules of the traps, namely, whether to output the traps and the ouput direction, are determined according to the Information Center configuration. (For Information Center configuration, refer to "Information Center Configuration" in the System Volume.)
Follow these steps to configure OSPF network management:
Use the command… |
Remarks |
|
Enter system view |
system-view |
— |
Bind OSPF MIB to an OSPF process |
ospf mib-binding process-id |
Optional The first OSPF process is bound with OSPF MIB by default. |
Enable OSPF trap generation |
snmp-agent trap enable ospf [ process-id ] [ ifauthfail | ifcfgerror | ifrxbadpkt | ifstatechange | iftxretransmit | lsdbapproachoverflow | lsdboverflow | maxagelsa | nbrstatechange | originatelsa | vifcfgerror | virifauthfail | virifrxbadpkt | virifstatechange | viriftxretransmit | virnbrstatechange ] * |
Optional Enabled by default |
Enabling Message Logging
Follow these steps to enable message logging:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enable message logging |
enable log [ config | error | state ] |
Required Not enabled by default. |
Enabling the Advertisement and Reception of Opaque LSAs
With this feature enabled, the OSPF router can receive and advertise Type 9, Type 10 and Type 11 opaque LSAs.
Follow these steps to enable the advertisement and reception of opaque LSAs:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Enable the advertisement and reception of opaque LSAs |
opaque-capability enable |
Optional Disabled by default |
Configuring OSPF to Give Priority to Receiving and Processing Hello Packets
To ensure OSPF runs normally, a router receives and processes Hello packets and other protocol packets at the same time. When the router has established neighbor relationships with multiple neighboring routers and the routing table size is big, the router will need to receive and process large numbers of packets. Configuring OSPF to give priority to receiving and processing Hello packets helps ensure stable neighbor relationships.
Follow these steps to configure OSPF to give priority to receiving and processing Hello packets:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Configure OSPF to give priority to receiving and processing Hello packets |
ospf packet-process prioritized-treatment |
Required Not configured by default. |
Configuring the LSU Transmit Rate
Sending large numbers of LSU packets for LSDB synchronization with neighbors may affect router performance and consume large network bandwidths. Therefore, you can configure the router to send LSU packets at intervals and limit the maximum number of LSU packets sent out an OSPF interface each time.
You can configure the interval at which an OSPF interface sends LSU packets and the maximum number of LSU packets the interface sends at each interval.
Follow these steps to configure the LSU transmit rate:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter OSPF view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
— |
Configure the LSU transmit rate |
transmit-pacing interval interval count count |
Optional By default, an OSPF interface sends up to three LSU packets every 20 milliseconds. |
Configuring OSPF Graceful Restart
One device can act as both a GR Restarter and GR Helper at the same time.
Configuring the OSPF GR Restarter
You can configure the IETF standard or non IETF standard OSPF GR Restarter.
Configure the IETF standard OSPF GR Restarter
Follow these steps to configure the standard IETF OSPF GR Restarter:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable OSPF and enter its view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required Disabled by default |
Enable opaque LSA advertisement capability |
opaque-capability enable |
Required Disabled by default |
Enable the IETF standard Graceful Restart capability for OSPF |
graceful-restart ietf |
Required Disabled by default |
Configure the Graceful Restart interval for OSPF |
graceful-restart interval timer |
Optional 120 seconds by default |
Configure the non-IETF standard OSPF GR Restarter
Follow these steps to configure non-IETF standard OSPF GR Restarter:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable OSPF and enter its view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required Disabled by default |
Enable the link-local signaling capability |
enable link-local-signaling |
Required Disabled by default |
Enable the out-of-band re-synchronization capability |
enable out-of-band-resynchronization |
Required Disabled by default |
Enable non IETF standard Graceful Restart capability for OSPF |
graceful-restart [ nonstandard ] |
Required Disabled by default |
Configure Graceful Restart interval for OSPF |
graceful-restart interval timer |
Optional 120 seconds by default |
Configuring the OSPF GR Helper
You can configure the IETF standard or non IETF standard OSPF GR Helper.
Configuring the IETF standard OSPF GR Helper
Follow these steps to configure the IETF standard OSPF GR Helper:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable OSPF and enter its view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required Disabled by default |
Enable opaque LSA reception and advertisement |
opaque-capability enable |
Required Not enabled by default. |
Configure the neighbors for which the router can serve as a GR Helper |
graceful-restart help { acl-number | prefix prefix-list } |
Optional The router can server as a GR Helper for any OSPF neighbor by default. |
Configuring the non IETF standard OSPF GR Helper
Follow these steps to configure the non IETF standard OSPF GR Helper:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable OSPF and enter its view |
ospf [ process-id | router-id router-id | vpn-instance instance-name ] * |
Required Disabled by default |
Enable the link-local signaling capability |
enable link-local-signaling |
Required Disabled by default |
Enable the out-of-band re-synchronization capability |
enable out-of-band-resynchronization |
Required Disabled by default |
Configure the neighbors for which the router can serve as a GR Helper |
graceful-restart help { acl-number | prefix prefix-list } |
Optional The router can server as a GR Helper for any OSPF neighbor by default. |
Triggering OSPF Graceful Restart
Performing active/standby switchover on a distributed device, or performing the following configuration on an OSPF router will trigger OSPF Graceful Restart.
For the IETF standard GR capable routers, ensure they have the following capabilities enabled:
l Opaque LSA advertisement
l IETF standard GR
For the non IETF standard GR capable routers, ensure they have the following capabilities enabled:
l link local signaling
l out of band re-synchronization
l Non IETF standard GR
Follow these steps to trigger OSPF Graceful Restart:
To do… |
Use the command… |
Remarks |
Trigger OSPF Graceful Restart |
reset ospf [ process-id ] process graceful-restart |
Required Available in user view |
Displaying and Maintaining OSPF
To do… |
Use the command… |
Remarks |
Display OSPF brief information |
display ospf [ process-id ] brief |
Available in any view |
Display OSPF statistics |
display ospf [ process-id ] cumulative |
|
Display Link State Database information |
display ospf [ process-id ] lsdb [ brief | [ { ase | router | network | summary | asbr | nssa | opaque-link | opaque-area | opaque-as } [ link-state-id ] ] [ originate-router advertising-router-id | self-originate ] ] |
|
Display OSPF neighbor information |
display ospf [ process-id ] peer [ verbose | [ interface-type interface-number ] [ neighbor-id ] ] |
|
Display neighbor statistics of OSPF areas |
display ospf [ process-id ] peer statistics |
|
Display next hop information |
display ospf [ process-id ] nexthop |
|
Display routing table information |
display ospf [ process-id ] routing [ interface interface-type interface-number ] [ nexthop nexthop-address ] |
|
Display virtual link information |
display ospf [ process-id ] vlink |
|
Display OSPF request queue information |
display ospf [ process-id ] request-queue [ interface-type interface-number ] [ neighbor-id ] |
|
Display OSPF retransmission queue information |
display ospf [ process-id ] retrans-queue [ interface-type interface-number ] [ neighbor-id ] |
|
Display OSPF ABR and ASBR information |
display ospf [ process-id ] abr-asbr |
|
Display OSPF interface information |
display ospf [ process-id ] interface [ all | interface-type interface-number ] |
|
Display OSPF error information |
display ospf [ process-id ] error |
|
Display OSPF ASBR summarization information |
display ospf [ process-id ] asbr-summary [ ip-address { mask | mask-length } ] |
|
Reset OSPF counters |
reset ospf [ process-id ] counters [ neighbor [ interface-type interface-number ] [ router-id ] ] |
Available in user view |
Reset an OSPF process |
reset ospf [ process-id ] process [ graceful-restart ] |
|
Re-enable OSPF route redistribution |
reset ospf [ process-id ] redistribution |
OSPF Configuration Examples
These examples only cover commands for OSPF configuration.
Configuring OSPF Basic Functions
Network requirements
l As shown in the following figure, all switches run OSPF. The AS is split into three areas, in which, Switch A and Switch B act as ABRs to forward routing information between areas.
l After configuration, all switches can learn routes to every network segment in the AS.
Network diagram
Figure 1-20 Network diagram for OSPF basic configuration
Configuration procedure
1) Configure IP addresses for interfaces (omitted)
2) Configure OSPF basic functions
# Configure Switch A.
<SwitchA> system-view
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit
# Configure Switch B.
<SwitchB> system-view
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] area 2
[SwitchB-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.2] quit
[SwitchB-ospf-1] quit
# Configure Switch C
<SwitchC> system-view
[SwitchC] ospf
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] quit
# Configure Switch D
<SwitchD> system-view
[SwitchD] ospf
[SwitchD-ospf-1] area 2
[SwitchD-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.2] network 10.5.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.2] quit
[SwitchD-ospf-1] quit
3) Verify the configuration
# Display information about neighbors on Switch A.
[SwitchA] display ospf peer verbose
OSPF Process 1 with Router ID 10.2.1.1
Neighbors
Area 0.0.0.0 interface 10.1.1.1(Vlan-interface100)'s neighbors
Router ID: 10.3.1.1 Address: 10.1.1.2 GR State: Normal
State: Full Mode: Nbr is Master Priority: 1
DR: 10.1.1.1 BDR: 10.1.1.2 MTU: 0
Dead timer due in 37 sec
Neighbor is up for 06:03:59
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
Neighbors
Area 0.0.0.1 interface 10.2.1.1(Vlan-interface200)'s neighbors
Router ID: 10.4.1.1 Address: 10.2.1.2 GR State: Normal
State: Full Mode: Nbr is Master Priority: 1
DR: 10.2.1.1 BDR: 10.2.1.2 MTU: 0
Dead timer due in 32 sec
Neighbor is up for 06:03:12
Authentication Sequence: [ 0 ]
Neighbor state change count: 5
# Display OSPF routing information on Switch A.
[SwitchA] display ospf routing
OSPF Process 1 with Router ID 10.2.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 10 Transit 10.2.1.1 10.2.1.1 0.0.0.1
10.3.1.0/24 4 Inter 10.1.1.2 10.3.1.1 0.0.0.0
10.4.1.0/24 13 Stub 10.2.1.2 10.4.1.1 0.0.0.1
10.5.1.0/24 14 Inter 10.1.1.2 10.3.1.1 0.0.0.0
10.1.1.0/24 2 Transit 10.1.1.1 10.2.1.1 0.0.0.0
Total Nets: 5
Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0
# Display the Link State Database on Switch A.
[SwitchA] display ospf lsdb
OSPF Process 1 with Router ID 10.2.1.1
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.2.1.1 10.2.1.1 1069 36 80000012 0
Router 10.3.1.1 10.3.1.1 780 36 80000011 0
Network 10.1.1.1 10.2.1.1 1069 32 80000010 0
Sum-Net 10.5.1.0 10.3.1.1 780 28 80000003 12
Sum-Net 10.2.1.0 10.2.1.1 1069 28 8000000F 10
Sum-Net 10.3.1.0 10.3.1.1 780 28 80000014 2
Sum-Net 10.4.1.0 10.2.1.1 769 28 8000000F 13
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.2.1.1 10.2.1.1 769 36 80000012 0
Router 10.4.1.1 10.4.1.1 1663 48 80000012 0
Network 10.2.1.1 10.2.1.1 769 32 80000010 0
Sum-Net 10.5.1.0 10.2.1.1 769 28 80000003 14
Sum-Net 10.3.1.0 10.2.1.1 1069 28 8000000F 4
Sum-Net 10.1.1.0 10.2.1.1 1069 28 8000000F 2
Sum-Asbr 10.3.1.1 10.2.1.1 1069 28 8000000F 2
# Display OSPF routing information on Switch D.
[SwitchD] display ospf routing
OSPF Process 1 with Router ID 10.5.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 22 Inter 10.3.1.1 10.3.1.1 0.0.0.2
10.3.1.0/24 10 Transit 10.3.1.2 10.3.1.1 0.0.0.2
10.4.1.0/24 25 Inter 10.3.1.1 10.3.1.1 0.0.0.2
10.5.1.0/24 10 Stub 10.5.1.1 10.5.1.1 0.0.0.2
10.1.1.0/24 12 Inter 10.3.1.1 10.3.1.1 0.0.0.2
Total Nets: 5
Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
# On Switch D, ping the IP address 10.4.1.1 to check connectivity.
[SwitchD] ping 10.4.1.1
PING 10.4.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.4.1.1: bytes=56 Sequence=2 ttl=253 time=2 ms
Reply from 10.4.1.1: bytes=56 Sequence=2 ttl=253 time=1 ms
Reply from 10.4.1.1: bytes=56 Sequence=3 ttl=253 time=1 ms
Reply from 10.4.1.1: bytes=56 Sequence=4 ttl=253 time=1 ms
Reply from 10.4.1.1: bytes=56 Sequence=5 ttl=253 time=1 ms
--- 10.4.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/2 ms
Configuring OSPF Route Redistribution
Network requirements
l All the switches run OSPF, and the AS is divided into three areas.
l Switch A and Switch B act as ABRs to forward routes between areas.
l Switch C is configured as an ASBR to redistribute external routes (static routes). Routing information is propagated properly in the AS.
Network diagram
Figure 1-21 Network diagram for OSPF redistributing routes from outside of an AS (on switches)
Configuration procedure
1) Configure IP addresses for interfaces (omitted).
2) Configure OSPF basic functions (Refer to Configuring OSPF Basic Functions).
3) Configure OSPF to redistribute routes.
# On Switch C, configure a static route destined for network 3.1.2.0/24.
<SwitchC> system-view
[SwitchC] ip route-static 3.1.2.1 24 10.4.1.2
# On Switch C, configure OSPF to redistribute static routes.
[SwitchC] ospf 1
[SwitchC-ospf-1] import-route static
4) Verify the configuration.
# Display the ABR/ASBR information of Switch D.
<SwitchD> display ospf abr-asbr
OSPF Process 1 with Router ID 10.5.1.1
Routing Table to ABR and ASBR
Type Destination Area Cost Nexthop RtType
Intra 10.3.1.1 0.0.0.2 10 10.3.1.1 ABR
Inter 10.4.1.1 0.0.0.2 22 10.3.1.1 ASBR
# Display the OSPF routing table of Switch D.
<SwitchD> display ospf routing
OSPF Process 1 with Router ID 10.5.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 22 Inter 10.3.1.1 10.3.1.1 0.0.0.2
10.3.1.0/24 10 Transit 10.3.1.2 10.3.1.1 0.0.0.2
10.4.1.0/24 25 Inter 10.3.1.1 10.3.1.1 0.0.0.2
10.5.1.0/24 10 Stub 10.5.1.1 10.5.1.1 0.0.0.2
10.1.1.0/24 12 Inter 10.3.1.1 10.3.1.1 0.0.0.2
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
3.1.2.0/24 1 Type2 1 10.3.1.1 10.4.1.1
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
Configuring OSPF to Advertise a Summary Route
Network requirements
l Switch A and Switch B are in AS 200, which runs OSPF.
l Switch C, Switch D, and Switch E are in AS 100, which runs OSPF.
l An eBGP connection is established between Switch B and Switch C. Switch C is configured to redistribute OSPF routes into BGP.
l Switch B is configured to redistribute BGP routes into OSPF. Switch B is configured with route summarization and advertises only the summary route 10.0.0.0/8 to reduce Switch A's routing table size.
Network diagram
Figure 1-22 Network diagram for OSPF summary route advertisement (on switches)
Configuration procedure
1) Configure IP addresses for interfaces (omitted)
2) Configure OSPF basic functions
# Configure Switch A.
<SwitchA> system-view
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# Configure Switch B.
<SwitchB> system-view
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
# Configure Switch C.
<SwitchC> system-view
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# Configure Switch D.
<SwitchD> system-view
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
# Configure Switch E.
<SwitchE> system-view
[SwitchE] ospf
[SwitchE-ospf-1] area 0
[SwitchE-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] network 10.4.1.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] quit
[SwitchE-ospf-1] quit
3) Configure BGP
# Configure Switch B.
<SwitchB> system-view
[SwitchB] bgp 200
[SwitchB-bgp] peer 11.1.1.2 as 100
[SwitchB-bgp] quit
# Configure Switch C.
<SwitchC> system-view
[SwitchC] bgp 100
[SwitchC-bgp] peer 11.1.1.1 as 200
[SwitchC-bgp] import-route ospf
4) Configure route redistribution on Switch B.
# Configure OSPF to redistribute routes from BGP on Switch B.
[SwitchB] ospf
[SwitchB-ospf-1] import-route bgp
# Display the OSPF routing table of Switch A.
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
10.2.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
10.3.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
10.4.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100
11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
5) # Configure summary route 10.0.0.0/8 on Switch B and advertise it.
[SwitchB-ospf-1] asbr-summary 10.0.0.0 8
# Display the OSPF routing table of Switch A.
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
10.0.0.0/8 O_ASE 150 2 11.2.1.1 Vlan100
11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100
11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
Configuring an OSPF Stub Area
Network requirements
The following figure shows an AS is split into three areas, where all switches run OSPF. Switch A and Switch B act as ABRs to forward routing information between areas. Switch D acts as the ASBR to redistribute routes (static routes).
It is required to configure Area 1 as a Stub area, reducing LSAs to this area without affecting route reachability.
Network diagram
Figure 1-23 Network diagram for OSPF Stub area configuration (on switches)
Configuration procedure
1) Configure IP addresses for interfaces (omitted).
2) Configure OSPF basic functions (refer to Configuring OSPF Basic Functions).
3) Configure Switch D to redistribute static routes.
[SwitchD] ip route-static 3.1.2.1 24 10.5.1.2
[SwitchD] ospf
[SwitchD-ospf-1] import-route static
[SwitchD-ospf-1] quit
# Display ABR/ASBR information on Switch C.
[SwitchC] display ospf abr-asbr
OSPF Process 1 with Router ID 10.4.1.1
Routing Table to ABR and ASBR
Type Destination Area Cost Nexthop RtType
Intra 10.2.1.1 0.0.0.1 3 10.2.1.1 ABR
Inter 10.3.1.1 0.0.0.1 5 10.2.1.1 ABR
Inter 10.5.1.1 0.0.0.1 7 10.2.1.1 ASBR
# Display OSPF routing table information on Switch C.
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 10.4.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 3 Transit 10.2.1.2 10.2.1.1 0.0.0.1
10.3.1.0/24 7 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.4.1.0/24 3 Stub 10.4.1.1 10.4.1.1 0.0.0.1
10.5.1.0/24 17 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.1.1.0/24 5 Inter 10.2.1.1 10.2.1.1 0.0.0.1
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
3.1.2.0/24 1 Type2 1 10.2.1.1 10.5.1.1
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
In the above output, since Switch C resides in a normal OSPF area, its routing table contains an external route.
4) Configure Area 1 as a Stub area.
# Configure Switch A.
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] stub
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit
# Configure Switch C.
[SwitchC] ospf
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] stub
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] quit
# Display OSPF routing information on Switch C
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 10.4.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 4 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.2.1.0/24 3 Transit 10.2.1.2 10.2.1.1 0.0.0.1
10.3.1.0/24 7 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.4.1.0/24 3 Stub 10.4.1.1 10.4.1.1 0.0.0.1
10.5.1.0/24 17 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.1.1.0/24 5 Inter 10.2.1.1 10.2.1.1 0.0.0.1
Total Nets: 6
Intra Area: 2 Inter Area: 4 ASE: 0 NSSA: 0
When Switch C resides in the Stub area, a default route takes the place of the external route.
# Filter Type-3 LSAs out the stub area
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] stub no-summary
[SwitchA-ospf-1-area-0.0.0.1] quit
# Display OSPF routing information on Switch C.
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 10.4.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 4 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.2.1.0/24 3 Transit 10.2.1.2 10.4.1.1 0.0.0.1
10.4.1.0/24 3 Stub 10.4.1.1 10.4.1.1 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
After this configuration, routing entries on the stub router are further reduced, containing only one default external route.
Configuring an OSPF NSSA Area
Network requirements
The following figure shows an AS is split into three areas, where all switches run OSPF. Switch A and Switch B act as ABRs to forward routing information between areas.
It is required to configure Area 1 as an NSSA area, and configure Router C as the ASBR to redistribute static routes into the AS.
Network diagram
Figure 1-24 Network diagram for OSPF NSSA area configuration
Configuration procedure
1) Configure IP addresses for interfaces.
2) Configure OSPF basic functions (refer to Configuring OSPF Basic Functions )
3) Configure Area 1 as an NSSA area.
# Configure Switch A.
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] nssa default-route-advertise no-summary
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# Configure Switch C.
[SwitchC] ospf
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] nssa
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] quit
It is recommended to configure the nssa command with the keyword default-route-advertise no-summary on Switch A (an ABR) to reduce the routing table size on NSSA routers. On other NSSA routers, use the nssa command.
# Display OSPF routing information on Switch C.
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 10.4.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 65536 Inter 10.2.1.1 10.2.1.1 0.0.0.1
10.2.1.0/24 65535 Transit 10.2.1.2 10.4.1.1 0.0.0.1
10.4.1.0/24 3 Stub 10.4.1.1 10.4.1.1 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
4) Configure Switch C to redistribute static routes.
[SwitchC] ip route-static 3.1.3.1 24 11.1.1.1
[SwitchC] ospf
[SwitchC-ospf-1] import-route static
[SwitchC-ospf-1] quit
# Display OSPF routing information on Switch D.
[SwitchD-ospf-1] display ospf routing
OSPF Process 1 with Router ID 10.5.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 22 Inter 10.3.1.1 10.3.1.1 0.0.0.2
10.3.1.0/24 10 Transit 10.3.1.2 10.3.1.1 0.0.0.2
10.4.1.0/24 25 Inter 10.3.1.1 10.3.1.1 0.0.0.2
10.5.1.0/24 10 Stub 10.5.1.1 10.5.1.1 0.0.0.2
10.1.1.0/24 12 Inter 10.3.1.1 10.3.1.1 0.0.0.2
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
3.1.3.0/24 1 Type2 1 10.3.1.1 10.2.1.1
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
You can see on Switch D an external route imported from the NSSA area.
Configuring OSPF DR Election
Network requirements
l In the following figure, OSPF Switches A, B, C and D reside on the same network segment.
l It is required to configure Switch A as the DR, and configure Switch C as the BDR.
Network diagram
Figure 1-25 Network diagram for OSPF DR election configuration
Configuration procedure
1) Configure IP addresses for interfaces (omitted)
2) Configure OSPF basic functions
# Configure Switch A.
<SwitchA> system-view
[SwitchA] router id 1.1.1.1
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# Configure Switch B.
<SwitchB> system-view
[SwitchB] router id 2.2.2.2
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# Configure Switch C.
<SwitchC> system-view
[SwitchC] router id 3.3.3.3
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# Configure Switch D.
<SwitchD> system-view
[SwitchD] router id 4.4.4.4
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
[SwitchD-ospf-1] quit
# Display OSPF neighbor information on Switch A.
[SwitchA] display ospf peer verbose
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.1.1(Vlan-interface1)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.1.2 GR State: Normal
State: 2-Way Mode: None Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 38 sec
Neighbor is up for 00:01:31
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3 GR State: Normal
State: Full Mode: Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Neighbor is up for 00:01:28
Authentication Sequence: [ 0 ]
Router ID: 4.4.4.4 Address: 192.168.1.4 GR State: Normal
State: Full Mode: Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Neighbor is up for 00:01:28
Authentication Sequence: [ 0 ]
Switch D becomes the DR, and Switch C is the BDR.
3) Configure router priorities on interfaces
# Configure Switch A.
[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] ospf dr-priority 100
[SwitchA-Vlan-interface1] quit
# Configure Switch B.
[SwitchB] interface vlan-interface 1
[SwitchB-Vlan-interface1] ospf dr-priority 0
[SwitchB-Vlan-interface1] quit
# Configure Switch C.
[SwitchC] interface vlan-interface 1
[SwitchC-Vlan-interface1] ospf dr-priority 2
[SwitchC-Vlan-interface] quit
# Display neighbor information on Switch D.
[SwitchD] display ospf peer verbose
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.0 interface 192.168.1.4(Vlan-interface1)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 100
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Neighbor is up for 00:11:17
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.2 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Neighbor is up for 00:11:19
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 2
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 33 sec
Neighbor is up for 00:11:15
Authentication Sequence: [ 0 ]
The DR and BDR have no change.
In the above output, you can find the priority configuration does not take effect immediately.
4) Restart OSPF process
# Restart the OSPF process of Switch D.
<SwitchD> reset ospf 1 process
Warning : Reset OSPF process? [Y/N]:y
# Display neighbor information on Switch D.
[SwitchD] display ospf peer verbose
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.0 interface 192.168.1.4(Vlan-interface1)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1 GR State: Normal
State: Full Mode: Nbr is Slave Priority: 100
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:01:40
Authentication Sequence: [ 0 ]
Router ID: 2.2.2.2 Address: 192.168.1.2 GR State: Normal
State: 2-Way Mode: None Priority: 0
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Neighbor is up for 00:01:44
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.1.3 GR State: Normal
State: Full Mode: Nbr is Slave Priority: 2
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:01:41
Authentication Sequence: [ 0 ]
Switch A becomes the DR, and Switch C is the BDR.
If the neighbor state is full, it means Switch D has established the adjacency with the neighbor. If the neighbor state is 2-way, it means the two switches are neither the DR nor the BDR, and they do not exchange LSAs.
# Display OSPF interface information.
[SwitchA] display ospf interface
OSPF Process 1 with Router ID 1.1.1.1
Interfaces
Area: 0.0.0.0
IP Address Type State Cost Pri DR BDR
192.168.1.1 Broadcast DR 1 100 192.168.1.1 192.168.1.3
[SwitchB] display ospf interface
OSPF Process 1 with Router ID 2.2.2.2
Interfaces
Area: 0.0.0.0
IP Address Type State Cost Pri DR BDR
192.168.1.2 Broadcast DROther 1 0 192.168.1.1 192.168.1.3
The interface state DROther means the interface is not the DR/BDR.
Configuring OSPF Virtual Links
Network requirements
l In the following figure, Area 2 has no direct connection to Area 0, and Area 1 acts as the Transit Area to connect Area 2 to Area 0 via a configured virtual link between Switch B and Switch C.
l After configuration, Switch B can learn routes to Area 2.
Network diagram
Figure 1-26 Network diagram for OSPF virtual link configuration
Configuration procedure
1) Configure IP addresses for interfaces (omitted)
2) Configure OSPF basic functions
# Configure Switch A.
<SwitchA> system-view
[SwitchA] ospf 1 router-id 1.1.1.1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
# Configure Switch B.
<SwitchB> system-view
[SwitchB] ospf 1 router-id 2.2.2.2
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] area 1
[SwitchB–ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255
[SwitchB–ospf-1-area-0.0.0.1] quit
# Configure Switch C.
<SwitchC> system-view
[SwitchC] ospf 1 router-id 3.3.3.3
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] area 2
[SwitchC–ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255
[SwitchC–ospf-1-area-0.0.0.2] quit
# Configure Switch D.
<SwitchD> system-view
[SwitchD] ospf 1 router-id 4.4.4.4
[SwitchD-ospf-1] area 2
[SwitchD-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.2] quit
# Display the OSPF routing table of Switch B.
[SwitchB] display ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 2 Transit 10.2.1.1 3.3.3.3 0.0.0.1
10.1.1.0/24 2 Transit 10.1.1.2 2.2.2.2 0.0.0.0
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
Since Area 0 has no direct connection to Area 2, the routing table of Switch B has no route to Area 2.
3) Configure a virtual link
# Configure Switch B.
[SwitchB] ospf
[SwitchB-ospf-1] area 1
[SwitchB-ospf-1-area-0.0.0.1] vlink-peer 3.3.3.3
[SwitchB-ospf-1-area-0.0.0.1] quit
[SwitchB-ospf-1] quit
# Configure Switch C.
[SwitchC] ospf 1
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2
[SwitchC-ospf-1-area-0.0.0.1] quit
# Display the OSPF routing table of Switch B.
[SwitchB] display ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 2 Transit 10.2.1.1 3.3.3.3 0.0.0.1
10.3.1.0/24 5 Inter 10.2.1.2 3.3.3.3 0.0.0.0
10.1.1.0/24 2 Transit 10.1.1.2 2.2.2.2 0.0.0.0
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
Switch B has learned the route 10.3.1.0/24 to Area 2.
OSPF Graceful Restart Configuration Example
Network requirements
l Switch A, Switch B and Switch C that belong to the same autonomous system and the same OSPF routing domain are GR capable.
l Switch A acts as the non IETF standard GR Restarter whereas Switch B and Switch C are the GR Helpers and re-synchronize their LSDB with Switch A through OOB communication of GR.
Network diagram
Figure 1-27 Network diagram for OSPF GR configuration
Configuration procedure
1) Configure Switch A
<SwitchA> system-view
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 192.1.1.1 255.255.255.0
[SwitchA-Vlan-interface100] quit
[SwitchA] router id 1.1.1.1
[SwitchA] ospf 100
[SwitchA-ospf-100] enable link-local-signaling
[SwitchA-ospf-100] enable out-of-band-resynchronization
[RouterA-ospf-100] graceful-restart
[SwitchA-ospf-100] area 0
[SwitchA-ospf-100-area-0.0.0.0] network 192.1.1.0 0.0.0.255
[SwitchA-ospf-100-area-0.0.0.0] return
2) Configure Switch B
<SwitchB> system-view
[SwitchB] acl number 2000
[SwitchB-acl-basic-2000] rule 10 permit source 192.1.1.1 0.0.0.0
[SwitchB-acl-basic-2000] quit
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 192.1.1.2 255.255.255.0
[SwitchB-Vlan-interface100] quit
[SwitchB] router id 2.2.2.2
[SwitchB] ospf 100
[SwitchB-ospf-100] graceful-restart help 2000
[SwitchB-ospf-100] area 0
[SwitchB-ospf-100-area-0.0.0.0] network 192.1.1.0 0.0.0.255
3) Configure Switch C
<SwitchC> system-view
[SwitchC] acl number 2000
[SwitchC-acl-basic-2000] rule 10 permit source 192.1.1.1 0.0.0.0
[SwitchC-acl-basic-2000] quit
[SwitchC] interface vlan-interface 100
[SwitchC-Vlan-interface100] ip address 192.1.1.3 255.255.255.0
[SwitchC-Vlan-interface100] quit
[SwitchC] router id 3.3.3.3
[SwitchC] ospf 100
[SwitchC-ospf-100] graceful-restart help 2000
[SwitchC-ospf-100] area 0
[SwitchC-ospf-100-area-0.0.0.0] network 192.1.1.0 0.0.0.255
4) Verify the configuration
# After the configurations on Switch A, Switch B and Switch C are completed and the switches are running steadily, enable OSPF Graceful Restart event debugging and then perform OSPF GR on Switch A.
<SwitchA> debugging ospf event graceful-restart
<SwitchA> terminal monitor
<SwitchA> terminal debugging
<SwitchA> reset ospf 100 process graceful-restart
Warning : Reset OSPF process? [Y/N]:y
%Dec 12 09:36:12:500 2006 SwitchA RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbour
192.1.1.1(Vlan100) from Full to Down
OSPF 1: Intf 192.1.1.1 Rcv InterfaceDown State BackupDR -> Down.
OSPF 1 nonstandard GR Started for OSPF Router
OSPF 1 notify RM that OSPF process will enter GR.
OSPF 1 created GR wait timer, timeout interval is 40(s).
OSPF 1 created GR Interval timer,timeout interval is 120(s).
OSPF 1: Intf 192.1.1.1 Rcv InterfaceUp State Down -> Waiting.
OSPF 1: Intf 192.1.1.1 Rcv BackupSeen State Waiting -> BackupDR.
OSPF 1 created OOB Progress timer for neighbor 192.1.1.2.
OSPF 1 restarted OOB Progress timer for neighbor 192.1.1.2.
OSPF 1 restarted OOB Progress timer for neighbor 192.1.1.2.
%Oct 22 09:36:12:566 2008 SwitchA RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbour
192.1.1.2(Vlan100) from Loading to Full
OSPF 1 restarted OOB Progress timer for neighbor 192.1.1.2.
OSPF 1 deleted OOB Progress timer for neighbor 192.1.1.2.
OSPF 1 Gr Wait Timeout timer fired.
OSPF 1 deleted GR wait timer.
OSPF 1 deleted GR Interval timer.
OSPF 1 GR Completed for OSPF Router
OSPF 1 notified RM that OSPF process left GR.
RM notified that all protocol left GR.
OSPF 1 started flushing STALE LSA after all protocol left GR.
OSPF 1: Flush Stale Area LSAs
OSPF 1: Start Flush Stale ASE + NSSA LSAs
OSPF 1: End Flush Stale ASE + NSSA LSAs
Switch A completes GR with the help of Switch B.
Configuring Route Filtering
Network requirements
l All the switches in the network run OSPF. The AS is divided into three areas.
l Switch A and Switch B work as ABRs.
l Configure Switch C as an ASBR to redistribute external routes (static routes), and configure a filter policy on Switch C to filter out redistributed route 3.1.3.0/24.
l Configure a route policy on Switch A to filter route 10.5.1.0/24.
Network diagram
Figure 1-28 Network diagram for OSPF route filtering configuration
Configuration procedure
1) Configure IP addresses for interfaces (omitted)
2) Configure OSPF basic functions (Refer to Configuring OSPF Basic Functions ).
3) Configure OSPF to redistribute routes.
# On Switch C, configure a static route destined for network 3.1.1.0/24.
<SwitchC> system-view
[SwitchC] ip route-static 3.1.1.0 24 10.4.1.2
# On Switch C, configure a static route destined for network 3.1.2.0/24.
[SwitchC] ip route-static 3.1.2.0 24 10.4.1.2
# On Switch C, configure a static route destined for network 3.1.3.0/24.
[SwitchC] ip route-static 3.1.3.0 24 10.4.1.2
# On Switch C, configure OSPF to redistribute static routes.
[SwitchC] ospf 1
[SwitchC-ospf-1] import-route static
[SwitchC-ospf-1] quit
# Display the OSPF routing table of Switch A.
<SwitchA> display ip routing-table
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost NextHop Interface
3.1.1.0/24 O_ASE 150 1 10.2.1.2 Vlan200
3.1.2.0/24 O_ASE 150 1 10.2.1.2 Vlan200
3.1.3.0/24 O_ASE 150 1 10.2.1.2 Vlan200
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan200
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.0/24 Direct 0 0 10.2.1.1 Vlan200
10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.0/24 OSPF 10 4 10.1.1.2 Vlan100
10.4.1.0/24 OSPF 10 13 10.2.1.2 Vlan200
10.5.1.0/24 OSPF 10 14 10.1.1.2 Vlan100
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
4) On Switch C, filter out route 3.1.3.0/24.
# Configure the IPv4 prefix list.
[SwitchC] ip ip-prefix prefix1 index 1 deny 3.1.3.0 24
[SwitchC] ip ip-prefix prefix1 index 2 permit 3.1.1.0 24
[SwitchC] ip ip-prefix prefix1 index 3 permit 3.1.2.0 24
# Reference the prefix list to filter out route 3.1.3.0/24.
[SwitchC] ospf 1
[SwitchC-ospf-1] filter-policy ip-prefix prefix1 export static
# Display the OSPF routing table of Switch A.
<SwitchA> display ip routing-table
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost NextHop Interface
3.1.1.0/24 O_ASE 150 1 10.2.1.2 Vlan200
3.1.2.0/24 O_ASE 150 1 10.2.1.2 Vlan200
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan100
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.0/24 Direct 0 0 10.2.1.1 Vlan200
10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.0/24 OSPF 10 4 10.1.1.2 Vlan100
10.4.1.0/24 OSPF 10 13 10.2.1.2 Vlan200
10.5.1.0/24 OSPF 10 14 10.1.1.2 Vlan100
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The route destined for network 3.1.3.0/24 is filtered out.
5) On Switch A, filter out the route 10.5.1.1/24.
# Configure the ACL on Switch A.
<SwitchA> system-veiw
[SwitchA] acl number 2000
[SwitchA-acl-basic-2000] rule 0 deny source 10.5.1.0 0.0.0.255
[SwitchA-acl-basic-2000] rule 1 permit source any
[SwitchA-acl-basic-2000] quit
# Use the ACL to filter route 10.5.1.0/24.
[SwitchA] ospf 1
[SwitchA-ospf-1] filter-policy 2000 import
[SwitchA-ospf-1] quit
# Display the OSPF routing table of Switch A.
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
3.1.1.0/24 O_ASE 150 1 10.2.1.2 Vlan200
3.1.2.0/24 O_ASE 150 1 10.2.1.2 Vlan200
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan100
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.2.1.0/24 Direct 0 0 10.2.1.1 Vlan200
10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.3.1.0/24 OSPF 10 4 10.1.1.2 Vlan100
10.4.1.0/24 OSPF 10 13 10.2.1.2 Vlan200
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The route destined for 10.5.1.1/24 is filtered out.
Troubleshooting OSPF Configuration
No OSPF Neighbor Relationship Established
Symptom
No OSPF neighbor relationship can be established.
Analysis
If the physical link and lower layer protocols work well, check OSPF parameters configured on interfaces. Two neighbors must have the same parameters, such as the area ID, network segment and mask (a P2P or virtual link may have different network segments and masks).
Processing steps
1) Display OSPF neighbor information using the display ospf peer command.
2) Display OSPF interface information using the display ospf interface command.
3) Ping the neighbor router’s IP address to check connectivity.
4) Check OSPF timers. The dead interval on an interface must be at least four times the hello interval.
5) On an NBMA network, using the peer ip-address command to specify the neighbor manually is required.
6) On an NBMA or a broadcast network, at least one connected interface must have a DR priority higher than 0.
Incorrect Routing Information
Symptom
OSPF cannot find routes to other areas.
Analysis
The backbone area must maintain connectivity to all other areas. If a router connects to more than one area, at least one area must be connected to the backbone. The backbone cannot be configured as a Stub area.
In a Stub area, all routers cannot receive external routes, and all interfaces connected to the Stub area must belong to the Stub area.
Solution
1) Use the display ospf peer command to display neighbors.
2) Use the display ospf interface command to display OSPF interface information.
3) Use the display ospf lsdb command to display the Link State Database to check its integrity.
4) Display information about area configuration using the display current-configuration configuration ospf command. If more than two areas are configured, at least one area is connected to the backbone.
5) In a Stub area, all routers attached are configured with the stub command. In an NSSA area, all interface connected to which are configured with the nssa command.
6) If a virtual link is configured, use the display ospf vlink command to check the state of the virtual link.