Page 2
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
This document briefly describes what OSPF is. The following describes differences between OSPF and RIP, OSPF fundamentals, and basic OSPF function configuration.
The Open Shortest Path First (OSPF) protocol, developed by the Internet Engineering Task Force (IETF), is a link-state Interior Gateway Protocol (IGP). At present, OSPF Version 2, defined in RFC 2328, is intended for IPv4, and OSPF Version 3, defined in RFC 2740, is intended for IPv6. Unless otherwise stated, OSPF stated in this document refers to OSPF Version 2. The following describes OSPF fundamentals, and basic OSPF function configuration.
A router requires a router ID if it is to run OSPF. A router ID is a 32-bit unsigned integer, uniquely identifying a router in an AS. A router ID can be manually configured or automatically selected by a router:
After the router has been running OSPF and selected its router ID, it still uses this router ID if the interface whose IP address is used as the router ID is Down or disappears (for example, the undo interface loopback loopback-number command is run) or a larger interface IP address exists. The router can obtain a new router ID only after a router ID is reconfigured for the router or an OSPF router ID is reconfigured and the OSPF process restarts. OSPF is a link-state protocol. A link can be considered as a router interface. The link state is a description of that interface and of the relationship with its neighboring routers. For example, a description of the interface includes the IP address and mask of the interface, the type of the connected network, and the connected neighbors. The collection of all these link states forms a link-state database (LSDB).
Table 1-1 Packet types
Table 1-2 LSA types
Table 1-3 Support status of LSAs in different types of areas
Figure 1-1 lists common Router types used in OSPF. Figure 1-1 Router types Table 1-4 Router types
Inter-area and intra-area routes in an AS describe the AS's network structure. AS external routes describe the routes to destinations outside an AS. OSPF classifies the imported AS external routes into Type 1 and Type 2 external routes. Table 1-5 lists route types in descending priority order. Table 1-5 Route types
Table 1-6 Area types
Table 1-7 lists four OSPF network types that are classified based on link layer protocols. Table 1-7 OSPF network types
On broadcast or NBMA networks, any two routers need to exchange routing information. As shown in Figure 1-2, n routers are deployed on the network. n x (n - 1)/2 adjacencies must be established. Any route change on a router is transmitted to other routers, which wastes bandwidth resources. OSPF resolves this problem by defining a DR and a backup designated router (BDR). After a DR is elected, all routers send routing information only to the DR. Then the DR broadcasts LSAs. Routers other than the DR and BDR are called DR others. The DR others establish only adjacencies with the DR and BDR and not with each other. This process reduces the number of adjacencies established between routers on broadcast or NBMA networks. Figure 1-2 Network topologies before and after a DR election If the original DR fails, routers must reelect a DR and the routers except the new DR must synchronize routing information to the new DR. This process is lengthy, which may cause incorrect route calculations. A BDR is used to shorten the process. The BDR is a backup for a DR. A BDR is elected together with a DR. The BDR establishes adjacencies with all routers on the network segment and exchanges routing information with them. When the DR fails, the BDR immediately becomes a new DR. The routers need to reelect a new BDR, but this process does not affect route calculations. The DR priority of a router interface determines its qualification for DR and BDR elections. The router interfaces with their DR priorities greater than 0 are eligible. Each router adds the elected DR to a Hello packet and sends it to other routers on the network segment. When both router interfaces on the same network segment declare that they are DRs, the router interface with a higher DR priority is elected as a DR. If the two router interfaces have the same DR priority, the router interface with a larger router ID is elected as a DR. Stub areas are specific areas where ABRs do not flood the received AS external routes. In stub areas, Routers maintain fewer routing entries and less routing information. Configuring a stub area is optional. Not every area can be configured as a stub area. A stub area is usually a non-backbone area with only one ABR and is located at the AS border. To ensure the reachability of the routes to destinations outside an AS, the ABR in the stub area generates a default route and advertises the route to the non-ABRs in the same stub area. Note the following points when configuring a stub area:
NSSAs are a special type of OSPF areas. There are many similarities between an NSSA and a stub area. Both of them do not advertise the external routes received from the other OSPF areas. The difference is that a stub area cannot import AS external routes, whereas an NSSA can import AS external routes and advertise the imported routes to the entire AS. After an area is configured as an NSSA, an ABR in the NSSA generates a default route and advertises the route to the other Routers in the NSSA. This is to ensure the reachability of the routes to the destinations outside an AS. Note the following points when configuring an NSSA:
To exchange routing information on an OSPF network, neighbor routers must establish adjacencies. The differences between neighbor relationships and adjacencies are described as follows:
OSPF has eight state machines: Down, Attempt, Init, 2-way, Exstart, Exchange, Loading, and Full.
OSPF supports packet authentication. Only the OSPF packets that have been authenticated can be received. If OSPF packets are not authenticated, a neighbor relationship cannot be established. The Router supports two authentication methods:
When both area-based and interface-based authentication methods are configured, interface-based authentication takes effect. Route summarization means that an ABR in an area summarizes the routes with the same prefix into one route and advertises the summarized route to the other areas. Route summarization between areas reduces the amount of routing information to be transmitted, reducing the size of routing tables and improving device performance. Route summarization can be carried out by an ABR or an ASBR:
A default route is a route of which the destination address and mask are all 0s. If a router cannot find a route in its routing table for forwarding packets, it can forward packets using a default route. Due to hierarchical management of OSPF routes, the priority of default Type 3 routes is higher than the priority of default Type 5 or Type 7 routes. OSPF default routes are usually used in the following cases:
Principles for advertising OSPF default routes are described below:
Table 1-8 lists principles for advertising default routes in different areas. Table 1-8 Principles for advertising OSPF default routes
OSPF supports route filtering using routing policies. By default, OSPF does not filter routes. Routing policies used by OSPF include the route-policy, access-list, and prefix-list. OSPF route filtering can be used for:
Table 1-9 Differences between inter-area LSA learning and route learning
OSPF supports multi-process. Multiple OSPF processes can run on the same Router, and they are independent of each other. Route exchanges between different OSPF processes are similar to route exchanges between different routing protocols. Each interface on the Router belongs to only one OSPF process. A typical application of OSPF multi-process is that OSPF runs between PEs and CEs in a VPN, whereas OSPF is used as an IGP on the backbone of the VPN. Two OSPF processes on the same PE are independent of each other. RFC 1583 is an earlier version of OSPFv2. When OSPF calculates external routes, routing loops may occur because RFC 2328 and RFC 1583 define different route selection rules. To prevent routing loops, both communication ends must use the same route selection rules.
OSPF calculates external routes based on Type 5 LSAs. If the router enabled with RFC 1583 compatibility receives a Type 5 LSA:
By default, OSPF uses the route selection rules defined in RFC 1583.
OSPF route calculation involves the following processes:
Adjacencies can be established in either of the following situations:
The adjacency establishment process is different on different networks. Adjacency establishment on a broadcast network On a broadcast network, the DR and BDR establish adjacencies with each router on the same network segment, but DR others establish only neighbor relationships. Figure 1-3 shows the adjacency establishment process on a broadcast network. Figure 1-3 Adjacency establishment process on a broadcast network The adjacency establishment process on a broadcast network is as follows:
Adjacency establishment on an NBMA network The adjacency establishment process on an NBMA network is similar to that on a broadcast network. The blue part shown in Figure 1-4 highlights the differences from a broadcast network. On an NBMA network, all routers establish adjacencies only with the DR and BDR. Figure 1-4 Adjacency establishment process on an NBMA network The adjacency establishment process on an NBMA network is as follows:
Adjacency establishment on a point-to-point (P2P)/point-to-multipoint (P2MP) network The process for establishing an adjacency on a P2P/P2MP network is similar to that on a broadcast network except that no DR or BDR needs to be elected on a P2P/P2MP network. DD packets are transmitted in multicast mode on P2P networks and in unicast mode on P2MP networks. OSPF uses an LSA to describe the network topology. A Type 1 LSA describes the attributes of a link between routers. A router transforms its LSDB into a weighted, directed graph, which reflects the topology of the entire AS. All routers in the same area have the same graph. Figure 1-5 shows a weighted, directed graph. Figure 1-5 Weighted, directed graph Based on the graph, each router uses an SPF algorithm to calculate an SPT with itself as the root. The SPT shows routes to nodes in the AS. Figure 1-6 shows an SPT. Figure 1-6 SPT When a router's LSDB changes, the router recalculates a shortest path. Frequent SPF calculations consume a large amount of resources and affect router efficiency. Changing the interval between SPF calculations can prevent resource consumption caused by frequent LSDB changes. The default interval between SPF calculations is 5 seconds. The route calculation process is as follows:
Before building OSPF networks, you need to configure basic OSPF functions. When OSPF is configured on multiple routers in the same area, most configuration data, such as the timer, filter, and aggregation, must be planned uniformly in the area. Incorrect configurations may cause neighboring routers to fail to send messages to each other or even causing routing information congestion and self-loops. The OSPF-relevant commands that are configured in the interface view take effect regardless of whether OSPF is enabled. After OSPF is disabled, the OSPF-relevant commands also exist on interfaces. Before configuring basic OSPF functions, complete the following task:
To run OSPF, the router needs to have a router ID. A router ID of the router is a 32-bit unsigned integer, which uniquely identifies the router in an AS. To ensure the stability of OSPF, you need to manually configure a router ID for each device during network planning.
More and more devices are deployed with the increasing expansion of the network scale. As a result, each device has to maintain a large LSDB, which becomes a heavy burden. OSPF solves this problem by dividing an AS into areas. An area is regarded as a logical device group. Each group is identified by an area ID. The borders of an area are devices, rather than links. A network segment (or a link) belongs to only one area; that is, each OSPF interface must belong to an area.
After creating an OSPF process, you need to configure the network segments included in an area. A network segment belongs to only one area. that is, you need to specify an area for each interface that runs OSPF. In this document, network segment refers to the network segment to which the IP address of the OSPF interface belongs. OSPF checks the network mask carried in a received Hello packets. If the network mask carried in a received Hello packet is different from the network mask of the local device, the Hello packet is discarded. As a result, an OSPF neighbor relationship is not established.
After OSPF areas are defined, OSPF route updates between non-backbone areas are transmitted through a backbone area. Therefore, OSPF requires that all non-backbone areas maintain connectivity with the backbone area and that the backbone areas in different OSPF areas maintain connectivity with each other. In real world situations, this requirement may not be met because of certain restrictions. To resolve this problem, you can configure OSPF virtual links. Perform the following steps on the router running OSPF.
After virtual links are created, different default MTUs may be used on devices provided by different vendors. To ensure consistency, the MTU is set to 0 by default when the interface sends DD packets. For details, see Configuring an Interface to Fill in the DD Packet with the Actual MTU.
When multiple neighboring routers are configured or a large number of LSA update packets are flooded, the neighboring router may receive a large number of LSA update packets in a short period. This keeps the neighboring router busy processing a burst of LSA update packets and causes the neighboring router to discard Hello packets that are used to maintain the OSPF neighbor relationships. As a result, the neighbor relationships are interrupted. After the neighbor relationships are reestablished, more packets will be exchanged. This increases the frequency of neighbor relationship interruption. To resolve this problem, you can restrict the flooding of LSA update packets to maintain neighbor relationships. Perform the following steps on the router running OSPF.
All configurations of basic OSPF functions are complete.
|