The way that Open Shortest Path First (OSPF) generates and advertises default routes (0.0.0.0) varies depending on the type of area the default route is being injected into. In this document, we cover normal areas, stub/totally stub areas and not-so-stubby areas (NSSAs).
For more information on document conventions, refer to the Cisco Technical Tips Conventions.
There are no specific prerequisites for this document.
This document is not restricted to specific software and hardware versions.
Normal Areas: These areas can either be standard areas or transit (backbone) areas. Standard areas are defined as areas that can accept intra-area, inter-area and external routes. The backbone area is the central area to which all other areas in OSPF connect.
Note: Intra-area routes refer to updates that are passed within the area. Inter-area routes refer to updates that are passed between areas. External routes refer to updates passed from another routing protocol into the OSPF domain by the Autonomous System Boundary Router (ASBR).
Stub Areas: These areas do not accept routes belonging to external autonomous systems (AS); however, these areas have inter-area and intra-area routes. In order to reach the outside networks, the routers in the stub area use a default route which is injected into the area by the Area Border Router (ABR). A stub area is typically configured in situations where the branch office need not know about all the routes to every other office, instead it could use a default route to the central office and get to other places from there. Hence the memory requirements of the leaf node routers is reduced, and so is the size of the OSPF database.
To define an area as a stub area, use the OSPF router configuration command, area <area id> stub
Totally Stub Areas: These areas do not allow routes other than intra-area and the default routes to be propagated within the area. The ABR injects a default route into the area and all the routers belonging to this area use the default route to send any traffic outside the area.
To define a totally stub area, use the OSPF router configuration command, area <area id> stub no-summary, on the ABR.
NSSA: This type of area allows the flexibility of importing a few external routes into the area while still trying to retain the stub characteristic. Assume that one of the routers in the stub area is connected to an external AS running a different routing protocol, it now becomes the ASBR, and hence the area can no more be called a stub area. However, if the area is configured as a NSSA, then the ASBR generates a NSSA external link-state advertisement (LSA) (Type-7) which can be flooded throughout the NSSA area. These Type-7 LSAs are converted into Type-5 LSAs at the NSSA ABR and flooded throughout the OSPF domain
In order to define a NSSA, use the OSPF router configuration command, area <area id> nssa.
For more information on NSSA, refer to OSPF Not-So-Stubby Area.
By default, in normal areas OSPF routers don't generate default routes into their routing domains, even if one exists. To have an OSPF router generate a default route, use the default-information originate [always] [metric metric-value] [metric-type type-value] [route-map map-name] command in the OSPF router configuration mode. This generates an external Type-2 link with link-state ID 0.0.0.0 and network mask 0.0.0.0, which makes the router an ASBR.
With the above command, the metric and the metric type of the default route can be specified. The default is metric = 1 and the metric-type = E2. To understand more about the external Type 1 and Type 2 routes, refer to the Redistributing Routes into OSPF section in the OSPF Design Guide.
There are two ways to inject a default route into a normal area.
If the ASBR already has the default route in its routing table, you can advertise the existing 0.0.0.0/0 into the OSPF domain with the default-information originate router configuration command.
If the ASBR doesn't have a default route, you can add the keyword always to the default-information originate command (default-information originate always).
This command will advertise a default route into the OSPF domain, regardless of whether it has a route to 0.0.0.0. Another benefit of adding always keyword is that it can add stability to the internetwork. For example, if the ASBR is learning a default route from another routing domain such as RIP and this route is flapping, then without the always keyword, each time the route flaps, the ASBR will send a new Type 5 LSA into the OSPF domain causing some instability inside the OSPF domain. With the always keyword, the ASBR will advertise the default inside the OSPF domain always, and thus the flapping of the default route from the RIP domain will not cause any instability inside the OSPF domain.
For a Sample Configuration of how OSPF injects a default route into a normal area, refer to How OSPF Injects a Default Route into a Normal Area.
In stub and totally stub areas, the ABR to the stub area generates a summary LSA with the link-state ID 0.0.0.0. This is true even if the ABR doesn't have a default route of its own. In this case, you don't need to use the default-information originate command.
As previously discussed, external routes are not propagated inside the stub areas and even inter-area routes (summary routes) are not propagated inside the totally stubby areas. The routers inside these areas use the default route generated by the ABR to reach destinations outside of the area.
For a Sample Configuration of how OSPF injects a default route into a stub or totally stub area, refer to How OSPF Injects a Default Route into a Stub or Totally Stub Area.
The ABR for the NSSA generates the default route, but not by default. To force the ABR to generate the default route, use the area <area id> nssa default-information originate command. The ABR generates a Type 7 LSA with the link-state ID 0.0.0.0 and is advertised inside the NSSA. This default route will be propagated inside the NSSA as Type 7 LSA
Another way to advertise the default route inside NSSA is to use the area <area id> nssa no-summary
With the no-summary keyword, the NSSA ABR will not advertise the inter-area routes (Type 3 and Type 4 summary routes) inside the NSSA, instead will advertise a default route. This default route will be propagated inside the NSSA as Type 3 LSA.
For a Sample Configuration shows how OSPF injects a default route into a NSSA, refer to How OSPF Injects a Default Route into a Not So Stubby Area.
For more information about how NSSA generates default routes, refer to the Default Route in NSSA section in OSPF Not-So-Stubby Area.