OSPF

OSPF (Open Shortest Path First) is a link state routing protocol. Link state routers exchange information about the state of their network connections or links. Using this information, each router can construct the topology of the internetwork and derive routing information.

Unlike RIP, OSPF does not have the count-to-infinity problem. Therefore, its metric does not have to be limited to 16. An OSPF metric can be as large as 65535. With a larger metric, you can build a larger internetwork. In addition, you can assign a wide range of costs for different types of networks, based on characteristics such as bandwidth.

OSPF also converges on the common routing information faster than RIP does. The reason is that OSPF does not have the count-to-infinity problem and OSPF link state information is flooded instantaneously. The faster convergence prevents loss of connectivity and temporary routing loops.

Finally, OSPF generates less traffic. Unlike RIP, which requires periodic updates, OSPF routers update their link state information only when the link state changes, or every 30 minutes, as opposed to 30 seconds for RIP. Consequently, more bandwidth is available to the data traffic.

For more information about the OSPF protocol version 2, refer to RFC 1583.


OSPF Topology

OSPF areas are connected in a hierarchical manner. The OSPF autonomous system (AS) can be partitioned into different regions, called areas. When divided into areas, there must be a special area called the backbone area. All OSPF areas are then connected to the backbone area. The backbone area is represented in Figure 2-19 by Area 0.

Routers that attach an area to the backbone area are called area border routers. An area border router has at least one interface in a nonbackbone area and one interface in the backbone area.

OSPF routers can exchange information with other ASs or domains running a different routing protocol, such as EGP or RIP. The exchanges between routing protocols are performed by the gateway at the border of the OSPF domain. This gateway is called an autonomous system boundary router, or ASBR. To learn routing information from other domains or ASs, an ASBR must be running EGP or RIP, as well as OSPF. It then disseminates that information throughout the OSPF domain for the OSPF routers.

Figure 2-19.
OSPF Areas


Area Partitioning

As the OSPF domain gets larger, the probability of link state change also increases, because the domain includes more routers and networks. Consequently, each link state change causes route recomputation on all routers, and the burden on the CPU increases. In addition, each route computation is more time-consuming because there are more destination networks for which to compute. When the OSPF domain becomes too large, you might want to partition it into multiple areas. Partitioning reduces the burden on the CPU. We recommend that you limit the size of an area to include fewer than 200 routers. However, under certain conditions you can enable the route aggregation feature to increase this limitation. See "Route Aggregation.”

Partitioning the OSPF domain into areas provides several advantages. It permits administrative separation of different geographical or organizational groups, such as engineering and marketing. Creating areas enables you to limit the sharing of routing information between areas. This makes a particular area more secure. Creating areas also reduces the number of Link State Advertisements (LSAs) per area and enables you to isolate an area with frequent topological changes.


Internal Routers

An internal router is a router that has all of its interfaces attached networks that belong to the same area. Routers with only backbone interfaces are also internal routers. These routers run a single copy of the basic routing algorithm.


Area Border Routers

A router that is attached to multiple areas is called an Area border router (ABR). ABRs run multiple copies of the basic routing algorithm, one copy for each attached area and an additional copy for the backbone. ABRs condense the topological information of their attached areas for distribution to the backbone. The backbone in turn distributes the information to the other areas. The packets that distribute this information are called summary link advertisements.


Autonomous System Boundary Routers

Routing information from other ASs (such as RIP), from exterior gateway protocols (such as EGP), or from other routing protocols can be combined and disseminated through ASBRs. Because they provide an interface to other ASs and routing protocols, ASBRs have access to routing information that is learned from routers outside the OSPF domain. ASBRs can be internal or area boundary routers and are not required to participate in the backbone area.


Virtual Links

Networks and routers in an OSPF backbone area must be interconnected. However, when the OSPF domain is divided into areas, the backbone area can become partitioned because of geographic reasons. The partitioned parts of the backbone area can be reconnected with a virtual link.

A virtual link is a path through the transit area, or nonbackbone area. The ABRs at each end of the virtual link treat the path between the two as a point-to-point link. When that virtual point-to-point link is used, the partitioned backbone area is reconnected, as shown in Figure 2-20.

The use of a virtual link is complicated and error-prone. Consequently, we recommend that you make every effort to keep the backbone area physically connected. The virtual link should be used only when necessary.

Figure 2-20.
OSPF Virtual and Transit Areas


Hierarchical Routing

OSPF has three types of hierarchical routing:


Intra-Area Routing and Inter-Area Routing

Routing within an area, or intra-area routing, can occur without knowledge of routing information from other areas. However, with routing between areas, or inter-area routing, packets must be passed to the local area border router and then to the destination's area border router before they are passed to the destination area.

Inter-area routing requires sharing an area's routing information with other ABRs.


Route Aggregation

When you assign network numbers according to specific standards, you can enable the route aggregation feature to aggregate route information that is sent between areas. Route aggregation enables you to aggregate the network number of several networks into one network number when the aggregated networks are advertised into another area. You might want to enable route aggregation if an area in your OSPF domain contains many networks. This enables an ABR to advertise network numbers between areas more quickly.

Routers that receive the aggregated advertisements need fewer routes. This means that faster routing lookups, less processing, and less memory is needed than for routers that do not receive aggregated advertisements. Instead of advertising the routes individually, route aggregation combines network numbers with the same prefix in one area into one network number. For example, you can aggregate network numbers 10.1.0.0, 10.2.0.0, 10.3.0.0, 10.4.0.0 into the network number 10.0.0.0.

We recommend that you plan your network so that you do not duplicate prefixes of network numbers in different areas. To enable route aggregation, you must assign the prefix of a network number to only one area. Within one area, you can assign more than one prefix. However, OSPF domains that use the same prefix in different areas cannot use route aggregation.


External Link Advertisement

The routing between the OSPF domain and others, such as RIP or EGP, is done through the ASBRs. This process is called external link advertisement. The ASBRs are located on the border of the OSPF domain. To disseminate the external destinations, they flood external link advertisements throughout the OSPF domain.

There are two types of metrics used in external link advertisements, type 1 and type 2. The meaning of the external link advertisement metric depends on the type. See "Interactions between OSPF and Other Routing Protocols” for more information.


Stub Areas

OSPF also supports the use of stub areas. When there is only a single ABR for an area, all destinations outside the area go through that router. In this case, you might want to configure the area as a stub area. A stub area does not allow its ABRs to advertise external routes, including routes to other areas as well as routes external to the OSPF domain. Instead, ABRs advertise a single default route. By not generating advertisements for individual destinations, a stub area saves memory, CPU, and bandwidth resources on all OSPF routers within the stub area.

There are a couple of restrictions on the use of stub areas. Virtual links cannot be configured through stub areas. In addition, ASBRs should not be placed inside a stub area. If an ASBR is placed within a stub area, it circulates external link advertisements only within the area. Therefore, all OSPF routers outside the stub area do not learn about external destinations.


OSPF Routers and Hosts

OSPF is a router-to-router protocol that exchanges routing information between routers. Hosts do not participate in OSPF exchanges. Therefore, the hosts are not informed about routers and routes discovered by the OSPF protocol. To supply hosts with OSPF router information, you can employ one of the following configurations:

The first method requires you to configure hosts manually to use default routers. This is the only workable method if the hosts do not understand Router Discovery messages or RIP messages.

The second method requires that hosts support ICMP Router Discovery. If the hosts support it, you can configure the routers to generate periodic ICMP Router Advertisement messages.

The third method requires the hosts to recognize RIP messages. If you are using one of the many larger hosts, such as UNIX workstations, that recognize RIP, configure the Internet Access Server 4.1 routing software to advertise its routing table on the network using periodic RIP update messages. (This is the Send Only option.) The disadvantage of this method is that it incurs high network overhead because RIP update messages are large and are broadcast every 30 seconds.


Load Sharing over Equal-Cost Routes

Load sharing enables a router to divide the traffic over equal-cost OSPF routes. With this configuration, the router can have several available next hops toward any destination. Consequently, the router can divide the traffic among the various equal-cost routes to the same destination. As a result, load sharing increases the effective bandwidth of an end-to-end path. In addition, it can improve the traffic distribution on an internetwork.

This feature has a session-by-session implementation. A load sharing session here is a series of packets destined to the same host on a destination network. It is not the same as an application session. A router uses one of the multiple equal-cost routes for the session of packet transmissions. Another route to the same destination network through a different next hop is used for the next session.

By maintaining multiple equal-cost paths to a destination network, a router forwards the traffic destined to the same host through one route. The router also forwards traffic destined to a different host on the same network through another route. The association of host and route is not permanent, but it is created only for a host when packet transmission to the host is needed. It is maintained in a cache that is refreshed periodically.

Load sharing is performed only on equal-cost routes learned from OSPF. You enable load sharing within OSPF. The maximum number of equal-cost routes to each destination network that Novell Internet Access Server 4.1 maintains is four. You cannot configure this value.


Interactions between OSPF and Other Routing Protocols

The following sections explain the interactions of OSPF with other routing protocols.


Protocol Preference

When multiple routing protocols supply routes to the same destination, the routes are added to the routing table in the following order of preference:

OSPF external routes are learned from other protocols, such as RIP and EGP. The ASBR sets incoming OSPF external routes as type 1 or type 2. Then the OSPF internal router calculates the travel costs. The difference between OSPF external type 1 and type 2 routes is how their travel costs are calculated.

For OSPF external type 1 routes, the cost of travel between the internal router and the ASBR is added to the cost of travel between the ASBR and the external router. Novell's implementation of OSPF recognizes OSPF external type 1 routes, but does not generate them. Other vendors generate OSPF external type 1 routes.

For OSPF external type 2 routes, the cost of travel between the ASBR and the internal router is ignored. Only the cost of travel between the external router and the ASBR is counted as travel cost. Novell's implementation of OSPF both recognizes and generates OSPF external type 2 routes.


OSPF External Route Metrics

If two routes have the same preference, the route with the smaller metric is added to the routing table. For example, when two OSPF internal routes to the same destination are being evaluated, one with metric 10 and the other with metric 20, the one with metric 10 is added to the routing table. Although OSPF external type 2, RIP, and EGP are all in preference level 3, there is a further preference level among them. When the metric is the same between an OSPF external type 2 route and a RIP or EGP route, the route received from RIP or EGP is preferred.

An OSPF external route has two metrics, an internal metric and an external metric. For OSPF external type 2, the external metric is comparable to RIP and EGP metrics, whereas the internal metric is ignored. For example, a RIP route and an OSPF route are presented to the same network simultaneously. The RIP route has an external metric of 10. The OSPF external type 2 route has an internal metric of 100 and an external metric of 9. In this case, the OSPF route is added to the routing table because the external metric of 9 is smaller than the RIP metric of 10.

However, if the external metric of the OSPF external type 2 route is the same as the metric of the RIP or EGP route, then the RIP or EGP route is selected. The reason is the OSPF route internal metric. Although it is considered much smaller than the external metric or the RIP or EGP metric, the internal metric still carries weight when two equal-cost routes are compared. For example, if a RIP route with a metric of 10 and an OSPF external type 2 route with an external metric of 10 are both going to the same destination, the RIP route is added to the routing table.

When it is added to the IP routing table, the metric of an OSPF route is generally set to the values shown in Table 2-3.


Table 2-3. OSPF Metric Translation to IP Metric

Preference

Type

Internal Metric

External Metric

IP Metric

1

OSPF internal

m

0

m

2

OSPF external type 1

m1

m2

m1 + m2

3

OSPF external type 2

m1

m2

m2

The IP metric measures the cost to send a route to its destination.

For example, an OSPF external type 1 route with an internal metric of 100 and external metric of 10 shows 110 in its metric field. However, when viewed with TCPCON, an OSPF external type 2 route with the same set of metrics shows 10 in its metric field. For information about TCPCON, refer to Novell Internet Access Server 4.1 Troubleshooting and Novell Internet Access Server 4.1 Management and Optimization.

Although the route metric determines the preference between two different routes (to the same destination) generated by the same protocol, it might not be able to determine route preference by comparing the metrics of two routes generated by different protocols. The meaning of the metric differs from protocol to protocol, and is not necessarily comparable.


OSPF Advertisements for RIP or EGP Routes

Routes that OSPF learns from the RIP or EGP protocols are advertised into the OSPF domain as external type 2 routes only. The external metric the ASBR advertises is the RIP/EGP metric. Novell's implementation of OSPF does not originate external type 1 routes. However, it recognizes that external type 1 routes originated from other routers, and processes them as described in the previous section.


RIP Advertisements for OSPF Routes

RIP advertises OSPF internal and external type 1 routes with a metric of 1. For external type 2 routes, it advertises the value of the external metric as the value of the metric recorded in the route entry plus 1. In essence, RIP treats the entire OSPF domain as a single RIP network with a metric of 1.

If you want to run a router as an OSPF and RIP gateway while limiting the route propagation between the two protocols, then set up a filter between them. For more information about configuring routing information filters, refer to Novell Internet Access Server 4.1 Routing Configuration.


Migrating from RIP to OSPF

Having both RIP and OSPF enabled on a router does not necessarily cause the router to act as a gateway between RIP and OSPF in both directions. When both OSPF and RIP are running, RIP advertises OSPF routes automatically. However, OSPF does not automatically advertise RIP routes in the OSPF domain (or routes of other protocols) as external routes.

To make OSPF advertise the routes of other protocols, you must turn on the OSPF ASBR function. You accomplish this in the Novell Internet Access Server Configuration utility (NIASCFG). Enable the ASBR function in the OSPF configuration screen under TCP/IP protocol configurations. Online help contains more information about NIASCFG parameters for TCP/IP.

Do not enable RIP, OSPF, and the ASBR function of OSPF on too many machines. Having numerous RIP/OSPF gateways is inefficient because too many gateways advertise routes to the same destinations. For RIP, more bandwidth is used for RIP advertisements. For OSPF, excessive memory is consumed for storing so many external link advertisements in the link state databases of every OSPF router. The ASBR function should not be enabled if the machine is not located on the border of the OSPF domain.

Do not partition either the RIP or OSPF domain. If they are partitioned, the routing information from either domain must be tunneled through the other domain. For example, RIP routing information from one RIP partition will have to be tunneled through an OSPF domain to the other RIP partition. Such tunneling requires unnecessary ASBRs, and unnecessary external advertisements are created. To avoid the redundancy of ASBRs and external advertisements of a partitioned domain, use unpartitioned RIP and OSPF domains. In addition, using unpartitioned domains makes managing the internetwork easier because it simplifies the overall topology of the AS.

We suggest that you have no more than two or three gateways connecting the RIP and OSPF domains.


Configuring OSPF with Third-Party Vendors

Routers from different vendors redistribute routes between protocols. It is possible to create routing loops because a vendor does not increment the hop count when a route is advertised from RIP to OSPF and then back to RIP. In this case, external type 1 routes must be used or no loops must exist in the topology.

For example, you might want to run RIP on networks 192.1.1.0 and 192.1.2.0 while you run OSPF on networks 192.1.3.0 and 192.1.4.0, as shown in Figure 2-21. Then connect 192.1.1.0 and 192.1.2.0 with the RIP router and 192.1.3.0 and 192.1.4.0 with the OSPF router. Between the RIP and OSPF networks, you can install two RIP/OSPF gateways. (The second gateway is the backup in case the first one fails.)

Figure 2-21.
RIP and OSPF Gateway Router

We strongly advise you to configure all third-party routers to prefer routes as shown in "Protocol Preference.” In addition, we recommend that routers do not originate external type 1 advertisements. Most of the third-party routers follow similar preferences by default. If third-party routers are configured to prefer routes differently from Novell's configuration, problems can occur. For example, a third-party router might prefer RIP routes over OSPF external type 2 routes, regardless of metrics. Or, third-party routers might generate OSPF external type 1 routes for the RIP routes that they added. If either of these configurations is enacted, a continuous update loop can occur between the third-party router and the Novell software (between a RIP update, an OSPF external type 1 update, and an OSPF external type 2 update).


OSPF Concepts

This section describes the OSPF concepts that provide IP routing:


Neighbors

OSPF neighbors are peer OSPF routers on a network. An OSPF router discovers its neighbors through the exchange of Hello packets. In broadcast networks, such as an Ethernet local network, the OSPF router multicasts a Hello packet. That packet is received by all the router's neighbors. In nonbroadcast networks, such as X.25 PDN, the location of the neighbors (IP address) is configured manually in NIASCFG. To indicate it is alive, the router sends Hello packets to its configured neighbors.

In the Hello packet, the originating router lists the ID of neighbors that it has heard from. The receiving router assumes a bidirectional relationship with the originating router if the received Hello contains the ID of the receiving router. All links in OSPF must be bidirectional. Links that are not bidirectional do not participate in OSPF routing.


Designated Router

Among OSPF routers on a network, there is a special router called the Designated Router (DR). The DR performs two functions on the network:

Each node in the OSPF domain must advertise its link state. The router advertisement is originated by individual routers. The network advertisement is generated by the DR on the network. The DR lists the IDs of its qualifying neighbors on that network. By linking the network advertisements and router advertisements from all the neighbors, an OSPF router constructs the topological state of the whole OSPF domain.

When an advertisement is originated by a router, it must be disseminated to all the OSPF routers in the OSPF domain. In addition, all routers must agree on the internetwork topology. If the routers do not agree, OSPF routing breaks down and loss of connectivity or routing loops can occur. The dissemination and synchronization of link state advertisements among OSPF routers is achieved through the use of adjacencies. The DR is the central point of all adjacent relationships on the network.

The DR for a network is selected from among all bidirectional neighbors, through a selection process. When there is no DR, the neighbors select the DR according to the priority value conveyed in the Hello packets. The router with the highest priority value becomes the DR. Once a DR is selected, it continues to act as the DR until the network goes down. Refer to RFC 1583 for the details of the DR election algorithm.

The election process also chooses the backup DR. Both the DR and the backup DR maintain an adjacency relationship with their neighbors. However, the backup DR is not responsible for generating network advertisements for the network. When the DR malfunctions, the backup DR takes over. Because the backup DR maintains adjacency relationships with its neighbors, it does not have to reestablish adjacencies. Consequently, the transition from one DR to another is faster with a backup DR than without a backup DR.


Adjacency

For OSPF to work properly, all OSPF routers must be in agreement on the link state, or topology, of the OSPF domain. OSPF achieves that agreement by requiring a router to be constantly in synchronization with some subset of its neighbors. The router is then said to be adjacent to those neighbors.

To ensure synchronization among routers, not all routers must be in synchronization with all their neighbors. For example, if A is in synchronization with B and B is in synchronization with C, then A will be in synchronization with C. Therefore, A needs to be adjacent only to B and not to C. In practice, OSPF simplifies the synchronization by requiring the adjacency only between the DR, the backup DR, and their neighbors. If the router is not a DR or a backup DR, it forms an adjacency only with the DR and backup DR. Because there always is a DR, all routers in an OSPF domain are interconnected by the adjacencies and are in synchronization with all other routers.

Because adjacent neighbors must agree on the link state of the OSPF domain, they exchange their link state databases with each other to synchronize their databases at the beginning. Once their state databases are exchanged and become identical to each other, the adjacent neighbors are said to be full. Only after both neighbors on an adjacency become full is the adjacency considered completely formed.

In addition to link state database synchronization, the adjacency serves as the path for disseminating a newly originated link state advertisement throughout the OSPF domain.


Flooding

The process of disseminating a link state advertisement is called flooding. When a new advertisement is flooded throughout the OSPF domain, it is disseminated along the adjacencies. Because all routers are interconnected by adjacencies, they have a chance to receive the new advertisement.

All routers must synchronize their link state databases, so the flooding must be reliable. OSPF achieves reliability through positive ACK and retransmission. Refer to RFC 1583 for more information.

The flooding algorithm can detect duplicate advertisements and install the correct one. For example, a router that goes down and comes back up might encounter an advertisement that it originated. To prevent ambiguity, OSPF uses a sequence number and an age to decide which version of the advertisement is the correct one. Refer to RFC 1583 for more information.


Dijkstra Algorithm

Once the complete link state information becomes available, the OSPF router can compute the reachable network destinations and routes to them. The router must recompute the routing table whenever a new network or router link state advertisement is received. To compute the routes from link state information, OSPF uses the Dijkstra algorithm, a method to compute the shortest path to destinations in a topology.

The summary and external link advertisements do not represent topological link states. Instead, they are advertisements of reachable destinations by the originating routers, similar to RIP. Therefore, a change in the summary or external link state advertisements does not require that the Dijkstra algorithm be used to compute the route. These destinations are computed by an update of the individual routing entries in the route table, according to the change conveyed by the new advertisement. Refer to RFC 1583 for more information about the Dijkstra algorithm.


Network Types Supported by OSPF

OSPF is flexible because it is able to support the following network types: