OSPF Areas and Hierarchies
OSPF area types, LSA flooding, and hierarchical network design.
Introduction: From a City Map to a Continental Atlas
In our previous discussion, we established that OSPF provides each router with a complete map, or atlas, of the network, allowing it to calculate the best path to any destination. This is a powerful concept. However, imagine trying to navigate using a single, gigantic map that details every street, alley, and cul-de-sac in an entire continent. Such a map would be monstrously large, slow to read, and a nightmare to update every time a small road closes for construction.
A single-area OSPF network faces the exact same problem. In a very large network with thousands of routers, the Link-State Database (LSDB): our network atlas, becomes enormous. The Shortest Path First (SPF) algorithm becomes a huge computational burden for router CPUs. Worse, a single flapping link anywhere in the network forces every single router to rerun this complex calculation, creating network-wide instability.
To solve this, OSPF introduces a brilliant hierarchical design concept: Areas. OSPF allows a large network to be broken down into smaller, more manageable collections of routers. This is like dividing our continental atlas into a set of regional and state maps. A router within a state knows its local roads perfectly but only needs a summary: like knowing which highway to take, to reach a different state.
The Backbone: Area 0 - The Interstate Highway System
The foundation of OSPF's hierarchical design is the backbone area, which is always designated as Area 0. All other areas must connect to this central area.
You can think of Area 0 as the national interstate highway system. It serves as a high-speed transit core that connects all other regions (areas). A packet traveling from a router in Area 10 to a router in Area 20 does not take a direct shortcut; it travels from Area 10 onto the Area 0 backbone, zips across the backbone, and then exits into Area 20 to find its final destination.
The Golden Rules of OSPF Areas
- Area 0 Must Be Contiguous: The backbone itself cannot be split into pieces. All routers within Area 0 must have a path to each other without leaving Area 0. A partitioned backbone leads to a broken OSPF domain.
- All Other Areas Must Connect to Area 0: Every non-backbone area must have at least one router that is also part of Area 0. This router is the gateway for that area to the rest of the network. An area that loses its connection to the backbone becomes isolated.
These rules are not arbitrary; they are a fundamental mechanism for preventing routing loops in a link-state environment. By forcing all inter-area traffic through a central, well-defined backbone, OSPF ensures that routers always have a consistent, loop-free view of how to reach other areas.
The Language of OSPF: Link-State Advertisements (LSAs)
To understand how areas work, we must understand how routers communicate. The OSPF "map" is not a single file; it is a database (the LSDB) built from many small messages called Link-State Advertisements (LSAs). Each LSA is like a page in the atlas, describing a small piece of the network topology.
There are several different types of LSAs, and the key to OSPF areas is that different LSA types have different flooding scopes: meaning, some types are only shared within a local area, while others are allowed to cross area boundaries. This selective information sharing is what creates the hierarchy and provides scalability.
Primary LSA Types and Their Flooding Scope
Type 1 LSA - Router LSA
This is a router's personal business card. Each router generates a Type 1 LSA to introduce itself. It lists all of its own links (interfaces), the state of each link, the IP address of the interface, and the OSPF cost associated with it.
Flooding Scope: Strictly contained within a single area. It never crosses an .
Type 2 LSA - Network LSA
This LSA exists only on multi-access networks like Ethernet. It is generated by the Designated Router (DR) for that segment. It lists all the routers that are connected to that specific network segment. It's essentially the DR's "attendance sheet" for the street.
Flooding Scope: Strictly contained within a single area. Like the Type 1, it never crosses an ABR.
Routers use Type 1 and Type 2 LSAs to build a complete, detailed map of their own local area.
Type 3 LSA - Summary LSA
This is the "postcard" sent between areas. An ABR generates a Type 3 LSA to tell routers in one area about networks that exist in another area. Crucially, it doesn't contain detailed topology; it's a summary: "To reach network , your total cost is 50, and you should send packets to me."
Flooding Scope: Generated by an ABR and flooded into an area from the backbone (Area 0), and from a non-backbone area into the backbone. It carries summary information across area boundaries.
Type 5 LSA - AS External LSA
This is the "advertisement" from another routing world. It is generated by an . It describes a route to a destination that is outside of the OSPF domain, for example, a route learned from the Internet via BGP.
Flooding Scope: By default, Type 5 LSAs are flooded throughout the entire OSPF domain, including the backbone and all standard areas. This can cause scalability issues, which special area types are designed to solve.
Special Area Types: Optimizing Scalability
To give network designers even greater control over LSA flooding and routing table size, OSPF defines several special area types. These are typically used for "stub" areas: areas that have only one or a few exit points.
Stub Area
Analogy: A cul-de-sac neighborhood. The residents know all the streets inside their neighborhood, but for anywhere else in the city, they just need to know one thing: how to get to the main road.
A Stub Area is an area that does not accept information about external routes.
- It blocks Type 5 LSAs (external routes) from being flooded into it.
- To provide connectivity to the outside world, the ABR for the stub area automatically injects a default route () into the area. All routers in the stub area use this default route to send traffic destined for external networks to the ABR.
- This significantly reduces the size of the LSDB and routing tables inside the stub area, saving router resources. A stub area cannot contain an ASBR.
Totally Stubby Area
Analogy: A completely gated community. The residents not only don't know the map of the outside world, they don't even know the detailed map of neighboring communities. They only know their own internal streets and the location of the single exit gate.
A Totally Stubby Area is an even more restrictive version.
- It blocks Type 5 LSAs (external routes) AND Type 3 LSAs (summary routes for other internal areas).
- The ABR injects a single default route that is used for ALL traffic destined outside the local area, whether it's going to another OSPF area or the internet.
- This provides the maximum possible reduction in LSDB and routing table size. It's a Cisco proprietary feature but is widely supported.
Not-So-Stubby Area (NSSA)
Analogy: A gated community that has its own small, private airport. It doesn't want to hear about flights from the main international airport (it blocks Type 5s), but it needs to be able to tell the rest of the world about its own outgoing flights.
A Not-So-Stubby Area (NSSA) is a clever hybrid. It is a stub area that is allowed to contain an ASBR.
- Like a stub area, it blocks Type 5 LSAs coming from the backbone.
- However, an ASBR inside the NSSA can inject external routes. To do this without breaking the "no Type 5s" rule, it uses a special Type 7 LSA.
- This Type 7 LSA is flooded only within the NSSA. When it reaches the NSSA's ABR, the ABR translates the Type 7 LSA into a regular Type 5 LSA and floods it into the rest of the OSPF domain.
- This allows a stub network to originate external routing information while still being protected from the complexity of the full external routing table. There is also a Totally NSSA, which combines both concepts.
The Virtual Link: An OSPF "Extension Cord "
What happens if a non-backbone area cannot physically connect directly to Area 0? This violates a fundamental OSPF rule. To solve this specific problem, OSPF provides a sort of "duct tape" solution called a Virtual Link.
A Virtual Link is a logical tunnel created through a transit, non-backbone area to connect a disconnected area to the backbone. It allows the backbone (Area 0) to appear contiguous even when it is physically broken, or allows an isolated area to logically "reach over" a transit area to connect to the backbone. While a powerful tool, virtual links add complexity and are generally considered a temporary fix or a last resort for correcting a suboptimal network design, not a feature to be used in initial planning.