A router ID is a 32-bit unsigned integer, which identifies a router in an autonomous system (AS). A router ID must exist before the router runs OSPF.
A router ID can be manually configured or automatically selected by the router.
If no router ID has been manually configured, the router automatically selects the system ID or an interface IP address as the router ID.
In any of the following situations, router ID reselection may be triggered:
When a large number of routers run OSPF, link state databases (LSDBs) become very large and require a large amount of storage space. Large LSDBs also complicate shortest path first (SPF) computation and overload the routers. As the network scale expands, there is an increasing probability that the network topology changes, causing the network to change continuously. In this case, a large number of OSPF packets are transmitted on the network, leading to a decrease in bandwidth utilization efficiency. In addition, each time the topology changes, all routers on the network must recalculate routes.
OSPF prevents frequent LSDB updates and improves network utilization by partitioning an AS into different areas. routers can be logically allocated to different groups (areas), and each group is identified by an area ID. A router, not a link, resides at the border of an area. and a network segment or link can belong to only one area. An area must be specified for each OSPF interface.
OSPF areas include common areas, stub areas, and not-so-stubby areas (NSSAs). Table 1 describes these OSPF areas.
Area Type |
Function |
Description |
---|---|---|
Common area |
By default, OSPF areas are defined as common areas. Common areas include:
|
|
A stub area is a non-backbone area with only one area border router (ABR) and generally resides at the border of an AS. The ABR in a stub area does not transmit received AS external routes, which significantly decreases the number of entries in the routing table on the router and the amount of routing information to be transmitted. To ensure the reachability of AS external routes, the ABR in the stub area generates a default route and advertises the route to non-ABRs in the stub area. A totally stub area allows only intra-area routes and ABR-advertised Type 3 default routes to be advertised within the area and does not allow AS external routes or inter-area routes to be advertised. |
|
|
An NSSA is similar to a stub area. An NSSA does not support Type 5 LSAs but can import AS external routes. Type 7 LSAs carrying the information about AS external routes are generated by ASBRs in an NSSA and are advertised only within the NSSA. When the Type 7 LSAs reach an ABR in the NSSA, the ABR translates the Type 7 LSAs into Type 5 LSAs and floods them to the entire OSPF domain. A totally NSSA allows only intra-area routes to be advertised within the area. AS external routes or inter-area routes cannot be advertised in a totally NSSA. |
|
Routers are classified by location in an AS. Figure 1 and Table 2 show the classification.
Router Type |
Description |
---|---|
Internal router |
All interfaces of an internal router belong to the same OSPF area. |
An ABR can belong to two or more areas, one of which must be a backbone area. An ABR connects the backbone area and non-backbone areas, and it can connect to the backbone area either physically or logically. |
|
Backbone router |
At least one interface on this type of router belongs to the backbone area. Internal routers in the backbone area and all ABRs are backbone routers. |
Exchanges routing information with other ASs. An ASBR may be an internal router or an ABR, and therefore may not necessarily reside at the border of an AS. |
OSPF encapsulates routing information into LSAs for transmission. Table 3 describes LSAs and their functions.
LSA Type |
LSA Function |
---|---|
Router-LSA (Type 1) |
Describes the link status and cost of a router. Router-LSAs are generated by each router and advertised within the area to which the router belongs. |
Network-LSA (Type 2) |
Describes the link status on the local network segment. Network-LSAs are generated by a DR and advertised within the area to which the DR belongs. |
Network-summary-LSA (Type 3) |
Describes routes on a network segment of an area. Network-summary-LSAs are generated by an ABR and advertised to other areas, excluding totally stub areas and totally NSSAs. For example, an ABR belongs to both area 0 and area 1, area 0 has a network segment 10.1.1.0, and area 1 has a network segment 10.2.1.0. In this case, the ABR generates Type 3 LSAs destined for the network segment 10.2.1.0 for area 0, and Type 3 LSAs destined for the network segment 10.1.1.0 for area 1. |
ASBR-summary-LSA (Type 4) |
Describes routes of an area to the ASBRs of other areas. ASBR-summary-LSAs are generated by an ABR and advertised to other areas, excluding stub areas, totally stub areas, NSSAs, totally NSSAs, and the areas to which the ASBRs belong. |
Describes AS external routes. AS-external-LSAs are generated by an ASBR and are advertised to all areas, excluding stub areas, totally stub areas, NSSAs, and totally NSSAs. |
|
Describes AS external routes. NSSA-LSAs are generated by an ASBR and advertised only within NSSAs. |
|
Opaque-LSA (Type 9/Type 10/Type 11) |
Opaque-LSAs provide a general mechanism for OSPF extension.
|
Table 4 describes whether a type of LSA is supported in an area.
Area Type |
Router-LSA (Type 1) |
Network-LSA (Type 2) |
Network-summary-LSA (Type 3) |
ASBR-summary-LSA (Type 4) |
AS-external-LSA (Type 5) |
NSSA-LSA (Type 7) |
---|---|---|---|---|---|---|
Common area (including standard and backbone areas) |
Supported |
Supported |
Supported |
Supported |
Supported |
Not supported |
Stub area |
Supported |
Supported |
Supported |
Not supported |
Not supported |
Not supported |
Totally stub area |
Supported |
Supported |
Not supported (except the default Type 3 LSA) |
Not supported |
Not supported |
Not supported |
NSSA |
Supported |
Supported |
Supported |
Not supported |
Not supported |
Supported |
Totally NSSA |
Supported |
Supported |
Not supported (except the default Type 3 LSA) |
Not supported |
Not supported |
Supported |
OSPF uses IP packets to encapsulate protocol packets. The protocol number is 89. OSPF packets are classified as Hello, database description (DD), link state request (LSR), link state update (LSU), or link state acknowledgment (LSAck) packets, as described in Table 5.
Packet Type |
Function |
---|---|
Hello packet |
Hello packets are sent periodically to discover and maintain OSPF neighbor relationships. |
Database description (DD) packet |
A DD packet contains the summaries of LSAs in the local LSDB. DD packets are used for LSDB synchronization between two routers. |
Link state request (LSR) packet |
LSR packets are sent to OSPF neighbors to request required LSAs. A router sends LSR packets to its OSPF neighbor only after DD packets have been successfully exchanged. |
Link state update (LSU) packet |
LSU packets are used to transmit required LSAs to OSPF neighbors. |
Link state acknowledgment (LSAck) packet |
LSAck packets are used to acknowledge received LSAs. |
Route types are classified as intra-area, inter-area, Type 1 external, or Type 2 external routes. Intra-area and inter-area routes describe the network structure of an AS. Type 1 or Type 2 AS external routes describe how to select routes to destinations outside an AS.
Table 6 describes OSPF routes in descending order of priority.
Route Type |
Description |
---|---|
Intra Area |
Intra-area route. |
Inter Area |
Inter-area route. |
Type 1 external route |
This type of route is more reliable. Cost of a Type 1 external route = Cost of the route from a router to an ASBR + Cost of the route from the ASBR to the destination When multiple ASBRs exist, the cost of each Type 1 external route equals the cost of the route from the local device to an ASBR plus the cost of the route from the ASBR to the destination. The cost is used for route selection. |
Type 2 external route |
Because a Type 2 external route offers low reliability, its cost is considered to be much greater than the cost of any internal route to an ASBR. Cost of a Type 2 external route = Cost of the route from an ASBR to the destination If multiple ASBRs have routes to the same destination, the route with the lowest cost from the corresponding ASBR to the destination is selected and imported. If the routes have the same cost from the corresponding ASBR to each route destination, the route with the smallest cost from the local router to the corresponding ASBR is selected. The cost of each Type 2 external route equals the cost of the route from the corresponding ASBR to the destination. |
According to the link layer protocol type, OSPF classifies networks into four types, as described in Table 7.
Network Type |
Link Layer Protocol |
Graph |
---|---|---|
Broadcast |
|
|
NBMA |
X.25 |
|
Point-to-Multipoint (P2MP) |
No link layer protocol is considered as the P2MP type by default. P2MP is forcibly changed from another type of network. In most cases, a non-fully meshed NBMA network is changed to a P2MP network. |
|
P2P |
|
On broadcast or NBMA networks, any two routers need to exchange routing information. As shown in Figure 2, n routers are deployed on the network. n x (n - 1)/2 adjacencies must be established. Any route change on a router is transmitted to other routers, which wastes bandwidth resources. OSPF resolves this problem by defining a DR and a BDR. After a DR is elected, all routers send routing information only to the DR. Then the DR broadcasts LSAs. routers other than the DR and BDR are called DR others. The DR others establish only adjacencies with the DR and BDR and not with each other. This process reduces the number of adjacencies established between routers on broadcast or NBMA networks.
If the original DR fails, routers must reelect a DR and the routers except the new DR must synchronize routing information to the new DR. This process is lengthy, which may cause incorrect route calculations. A BDR is used to shorten the process. The BDR is a backup for a DR. A BDR is elected together with a DR. The BDR establishes adjacencies with all routers on the network segment and exchanges routing information with them. If the DR fails, the BDR immediately becomes a new DR. Because no re-election is required and adjacencies have been established, this process is very short. In this case, a new BDR needs to be elected. Although this process takes a long time, it does not affect route calculation.
The DR and BDR are not designated manually. Instead, they are elected by all routers on the network segment. The DR priority of an interface on the router determines whether the interface is qualified for DR or BDR election. On the local network segment, the routers whose DR priorities are greater than 0 are all candidates. Hello packets are used for the election. Each router adds information about the DR elected by itself to a Hello packet and sends the packet to other routers on the network segment. If two routers on the same network segment declare that they are DRs, the one with a higher DR priority wins. If they have the same priority, the one with a larger router ID wins. If the priority of a router is 0, it cannot be elected as a DR or BDR.
OSPF multi-process allows multiple OSPF processes to independently run on the same router. Route exchange between different OSPF processes is similar to that between different routing protocols, A router's interface can belong only to one OSPF process.
A typical application of OSPF multi-process is that OSPF runs between PEs and CEs in VPN scenarios and OSPF is also used as an IGP on the VPN backbone network. The OSPF processes on the PEs are independent of each other.
A default route is the route whose destination address and mask are both all 0s. If no matching route is found, the default route can be used by the router to forward packets.
OSPF default routes are generally applied to the following scenarios:
An ABR in an area advertises Type 3 default summary LSAs within the area to help the routers in the area forward inter-area packets.
An ASBR in an AS advertises Type 5 external default ASE LSAs or Type 7 external default NSSA LSAs to help the routers in the AS forward AS external packets.
OSPF routes are hierarchically managed. The priority of the default route carried in Type 3 LSAs is higher than the priority of the default route carried in Type 5 or Type 7 LSAs.
The rules for advertising OSPF default routes are as follows:
Table 8 describes the principles for advertising default routes in different areas.
Area Type |
Principles for Advertising Default Routes |
---|---|
Common area |
By default, OSPF devices in a common area do not generate default routes, even if they have default routes. When a default route is generated by another routing process, the router must advertise the default route to the entire OSPF AS. To achieve this, a command must be run on the ASBR to generate a default route. After the configuration is complete, the router generates a default ASE LSA (Type 5 LSA) and advertises it to the entire OSPF AS. If no default route exists on the ASBR, the router does not advertise a default route. |
Stub Area |
Type 5 LSAs cannot be advertised within a stub area. A router in the stub area must learn AS external routes from an ABR. The ABR automatically generates a default Summary LSA (Type 3 LSA) and advertises it within the entire stub area. Then the device can learn AS external routes from the ABR. |
Totally Stub Area |
Neither Type 3 (except default Type 3 LSAs) nor Type 5 LSAs can be advertised within a totally stub area. A router in the totally stub area must learn AS external and inter-area routes from an ABR. After you configure a totally stub area, an ABR automatically generates a default Summary LSA (Type 3 LSA) and advertises it within the entire totally stub area. Then the device can learn AS external and inter-area routes from the ABR. |
NSSA |
A small number of AS external routes learned from the ASBR in an NSSA can be imported to the NSSA. External routes ASE LSAs (Type 5 LSAs) to other areas cannot be advertised within the NSSA. When at least a neighbor in Full status and an interface that is Up exist in the backbone area, the ABR automatically generates a Type 7 LSA carrying a default route and advertises it within the entire NSSA. In this case, a small number of routes are learned through the ASBR in the NSSA, and other routes are learned through the ABR in the NSSA. You can manually configure the ASBR to generate a default NSSA LSA (Type 7 LSA) and advertise it in the entire NSSA. In this manner, external routes can also be learned through the ASBR in the NSSA. An ABR does not translate Type 7 LSA default routes into Type 5 LSA default routes for transmission in the entire OSPF domain. |
Totally NSSA |
A totally NSSA does not allow ASE LSAs (Type 5 LSAs) of external routes or inter-area routes (Type 3 LSAs, except the default Type 3 LSAs) to be transmitted within the area. A router in this area must external routes to other areas from an ABR. The ABR automatically generates Type 3 and Type7 LSAs carrying a default route and advertises them to the entire totally NSSA. Then AS external and inter-area routes can be advertised within the totally NSSA. |