OSPF-Backup Designated Router (BDR)-LSA types

Open Shortest Path First (OSPF) is a popular routing protocol for IP networks for several key reasons. It is classless, offering full CIDR and VLSM support; it scales well; converges quickly; and guarantees loop-free routing. It also supports address summarization and the tagging of external routes, similar to EIGRP. For networks that require additional security, you can configure OSPF routers to authenticate with one another to ensure that unauthorized devices can't affect routing tables.

Perhaps the most important reasons for OSPF's popularity are that it is both an open standard and a mature protocol. Virtually every vendor of routing hardware and software supports it. This makes it the routing protocol of choice in multivendor enterprise networks. It is also frequently found in ISP networks for the same reasons.

But for all of these benefits, OSPF is also considerably more complicated to set up than EIGRP or RIP. Unlike EIGRP, which can be readily retrofitted into almost any existing network, your network has to be designed with OSPF in mind if you want it to scale well. For more information on OSPF network design, please refer to Designing Large-Scale LANs by Kevin Dooley (O'Reilly). And you can find more information about the protocol itself in IP Routing by Ravi Malhotra (O'Reilly). The remainder of this section is intended only to serve as a reminder to readers who are already familiar with OSPF.

OSPF is currently in its second version, which is documented in RFC 2328. It uses a large, dimensionless metric on every link (also equivalently called a "cost"), with a maximum value of 65535. But unlike RIP and EIGRP, which use a metric that reflects the cost of the entire path, OSPF's metric is just a per-link cost. The RFC does not specify a maximum total path cost. So, in fact, any given path through an OSPF network can include many high-cost links, but still be usable. This 16-bit OSPF metric, while significantly larger than the simple hop-count metric used in RIP, is much smaller than EIGRP's 32-bit metric. So many of the metric manipulation techniques we discussed for EIGRP in Chapter 7 do not work in OSPF. The smaller metric sometimes means that you have to exercise care in how you define the costs of each link. We will discuss this issue in more detail in Recipe 8.3.

Like EIGRP, OSPF routers only start to exchange routing information after they have established a neighbor relationship. However, unlike EIGRP, OSPF routers don't actually exchange routing tables directly. Instead, they exchange Link State Advertisements (LSA), which describe the states of different network links. Each router then obtains an accurate image of the current topology of the network, which it uses to build its routing tables. If you group the routers into Areas, as we will discuss in a moment, every router in each Area sees the same LSA information, which guarantees that all of the routing tables are compatible with one another.

The OSPF protocol operates directly at the IP layer by using IP protocol number 89, without an intervening transport layer protocol such as UDP or TCP. Devices exchange OSPF information using multicast packets that are confined to the local segment. OSPF actually uses two different multicast IP addresses. All OSPF routers use 224.0.0.5, and Designated Router (DR) routers use 224.0.0.6.

The DR is basically a master router for a network segment. This is only relevant when there are several OSPF routers on a multiple access medium such as an Ethernet segment. In this case, to avoid the scaling problems of establishing a mesh of neighbor relationships between all of the routers on the segment, one router becomes the DR for the segment. Then all of the other routers talk to the DR. Each segment also elects a Backup Designated Router (BDR) in case the DR fails.

One of the most important features of OSPF is the concept of an Area. This is also partly what makes OSPF more difficult to configure. An OSPF network can be broken up into areas that are connected by Area Border Routers (ABR). Routing information can then be summarized at the ABR before being passed along to the next area. This means that routers in one area don't need to worry about the LSA information from routers in other areas, which drastically improves network stability and convergence times, as well as reducing the amount of resources required to support OSPF on the routers.

For OSPF to work well, you need to allocate your IP addresses appropriately among the Areas. In particular, you want to be able to summarize the routes for an Area when you pass this information along to the next Area. The summarization doesn't need to reduce perfectly to a single route for each Area. But the fewer LSAs you need to pass between Areas, the better OSPF will scale.

Each Area has a 32-bit identifier number, which is often represented in dotted decimal notation, similar to IP addresses. Every OSPF network should have an Area 0 (or 0.0.0.0), and every ABR must be a member of Area 0. This enforces a hierarchical design model for OSPF networks. The one exception to this rule happens in a network with only one Area. In this case, you can actually give this Area any number. We recommend using an Area 0, even if it is the only area in your network to avoid some of the problems that will occur if you ever need to partition the network into Areas later. The only time this ability to run a single area network with no Area 0 relevant is when a network failure isolates one Area from the rest of the network. In this case, the isolated Area can continue working normally internally.

You can get around this strict design requirement of having all Areas connected only through Area 0 by using OSPF virtual links. These are essentially little more than IP tunnels. You can use virtual links to ensure that every ABR connects to Area 0, even if one or more of them are not physically connected to Area 0. However, we should stress that we do not recommend using virtual links, except as a temporary measureperhaps while migrating your network to a new architecture or while merging two networks.

The OSPF protocol defines several different LSA types. We will briefly review these different types before discussing the area types, because it will help to understand what is going on in these different area types. The standard LSA types are summarized in Table 8-1.

Table 8-1. LSA types
LSA type Name Description
1 Router-LSA A Router-LSA includes information about the link states of all of a router's interfaces. These LSAs are flooded throughout the area, but not into adjacent areas.
2 Network-LSA On NBMA and broadcast capable network segments, the DR originates Network-LSAs. The Network-LSA describes the routers that are connected to this broadcast or NBMA segment. Network-LSAs are flooded throughout the area, but not into adjacent areas.
3 Summary-LSA ABR routers originate Summary-LSAs to describe interarea routes to networks that are outside of the area but inside of the AS. They are flooded throughout an area. Type 3 LSAs are used for routes to networks.
4 Summary-LSA Type 4 LSAs are similar to Type 3 LSAs, except that they are used for routes to ASBR routers.
5 AS-external-LSA ASBR routers originate Type 5 LSAs to describe routes to networks that are external to the AS. Type 5 LSAs are flooded throughout the AS.
6 MOSPF-LSA Type 6 LSAs are used for carrying multicast routing information with MOSPF. Cisco routers do not currently support Type 6 LSAs.
7 NSSA-External-LSA Type 7 LSAs are originated by ASBRs in an NSSA area. They are similar to Type 5 LSAs, except that they are only flooded throughout the NSSA area. When Type 7 LSAs reach the ABR, it translates them into Type 5 LSAs and distributes them to the rest of the AS.


There are several different types of OSPF Areas. They are differentiated by how they summarize information into and out of the area. The other important difference between area types concerns whether or not they can be used for transit between other parts of the network. A transit Area allows packets to simply pass through the area on their way to another area or another network. Any router that connects OSPF to another network or a different routing protocol is called an Autonomous System Boundary Router (ASBR).

The first important type of Area is the backbone area, which is used by Area 0. This area is special because it can always act as a transit area, between other areas, between this OSPF autonomous system and external networks, or even between external networks.

The second Area type is called a stub area. Stub areas see detailed routing information on all other areas, but only summary information about networks outside of the AS. The ABR sends Type 3 LSA packets to summarize this information. The ABR connecting to a stub area summarizes routes to external networks, outside of the AS. All external routes are reduced to a single summary. This is important because it means that you cannot make connections to external networks via a stub area. It also means that if your network is essentially all one big AS, perhaps with a default route to the Internet, then there is no advantage to using a stub area. Stub areas are most useful when there are many external routes, so summarizing them saves router resources.

In terms of LSA types, the distinguishing factor for a stub area is that the ABR will not send any Type 5 LSAs into this area.

Third is the totally stub area. Totally stub areas, also called "stub no-summary," summarize not only external routes, but also routes from other areas (interarea routes). Routers in this type of area only see routing information local to their area, plus a default route pointing to the ABR, from which they can reach all other areas and all other networks. The ABR accomplishes this by preventing all Type 3, 4, and 5 LSA messages, except for the default summary route, which it transmits as a single Type 3 LSA message.

As with regular stub areas, you cannot make connections to external networks through totally stub areas by using redistribution into OSPF.

Totally stub areas are clearly useful in WAN situations where the overhead of maintaining and updating a large link state database is both onerous and unnecessary. The only problem with totally stub areas is that this is essentially a Cisco invention. Some other vendors have added support for this area type, but it is not universally supported, so you might have problems implementing it in a multivendor network. But as long as you use Cisco ABR routers, the other routers inside of a totally stub Area won't know that anything special has happened to their routing information, so the nonABR routers can be any non-Cisco devices.

Not So Stubby Areas (NSSA) are defined in RFC 1587. This is a variant of the stub area that is able to connect to external networks. It accomplishes this by introducing a new LSA type (LSA Type 7) that is used within the area to carry external routes that originate with ASBRs connected to this area. The ABR only summarizes those external routes that are received from other areas, and therefore reached through the ABR. External routes from ASBRs inside the area are not summarized. In order to pass the internally generated external routes to the rest of the network, the ABR translates these Type 7 LSAs into the more conventional Type 5 LSA before relaying this information into Area 0.

The result is that you can use NSSA areas to connect to external networks. This is extremely important to remember because even a simple redistributed static route is considered an external route. If you want external routes to be available for the rest of the network, then NSSA is a good way to handle them. NSSA is an open standard part of the OSPF protocol, so most of the router vendors who implement OSPF include NSSA support.

Finally, another useful Cisco adaptation is the Totally Stubby Not So Stubby Area type. This comical sounding name belies an extremely useful feature. This area type combines the best of NSSA and totally stub areas by summarizing information from all other areas, but handling external routes like NSSA. It allows you to summarize internal routes from other areas while still allowing you to put an ASBR happens inside of the area.

As with the totally stub area, the ABR connecting to a Totally Stubby NSSA area prevents all Type 3, 4, and 5 LSAs. And, like an NSSA, it uses Type 7 LSA messages to carry external routes from ASBR routers inside of the area. So the Totally Stubby NSSA Area can be used as a transit Area to an external network, but it can also benefit from summarization of interarea routes.

In many networks, the number of external routes is relatively small, while there are many internal (interarea) routes. So it is actually much more important to summarize the internal routes in these cases. But the stub and totally stub area types that allow this interarea route summarization don't allow you to connect to external networks. The Totally Stubby NSSA Area type is ideal when you need to connect to an external network through an area that you would really prefer to keep stubby for performance and scaling reasons.

Another important concept in OSPF involves how it exchanges routing information with external autonomous systems. Any router that advertises an external route to the rest of the network must be on the border with another network, so it is called an Autonomous System Border Router (ASBR).

OSPF defines two different types of external routes. The only difference between them is in the way that OSPF calculates their costs. The cost of a Type 1 external route is the sum of the external metric plus the internal cost to reach the ASBR. The cost of a Type 2 external route is just the external metric cost. For Type 2 external routes, OSPF does not add in the cost to reach the ASBR.

When making routing decisions, OSPF prefers Type 1 to Type 2 external routes. So, for example, you can use Type 1 external routes to ensure that every internal router selects the closest ASBR that connects to a particular external network. But you might want to also set up a backup ASBR that injects Type 2 routes. Then the internal routers will prefer the Type 1 routes, if they are present.