OSPF Areas HowTo

About

This document aims to provide example OSPF use-cases where we configure OSPF areas to limit the amount of routing information each router needs to process and store.

For an overview of all available configuration settings for OSPF refer to the configuration guide:

Introduction

In certain situations it can be beneficial to reduce the amount of routing information that each individual router in an OSPF network needs to handle and store in their internal database. In order to achieve this OSPF provides the concept of areas, these can help segment an OSPF network.

The following example use-cases are presented in this document:

Case 1: Standard Area

This case present a very simple example how to segment an OSPF networks into different area domains. The example in Figure 1 below, only showcase five different OSPF routers divided into three different areas. If more areas are needed they simply add them in the same manner as area 0.0.0.1 and 0.0.0.2 will be added in this example.

Note

Remember that any additional area that is added must be directly connected to the backbone (area 0.0.0.0). In cases where this for some reason is not possible, an OSPF feature called Virtual Link could be utilized. However, this is currently not supported.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. Area 0.0.0.0                                            .
.  (Backbone)                                             .
.                        .-------.                        .
.            10.0.1.0/24 |       | 10.0.2.0/24            .
.      .-----------------+  BR   +-----------------.      .
.      |               .1|       |.1               |      .
.    .2|                 '-------'                 |.2    .
.  .---+---.                                   .---+---.  .
. .|       |. . . . . . . . . . . . . . . . . .|       |. .
   | ABR1  |                                   | ABR2  |
. .|       |. . . . . . . .     . . . . . . . .|       |. .
.  '---+---' Area 0.0.0.1 .     . Area 0.0.0.2 '---+---'  .
.    .1|                  .     .                  |.1    .
.      |                  .     .                  |      .
.      | 192.168.1.0/24   .     .   192.168.2.0/24 |      .
.      |                  .     .                  |      .
.    .2|                  .     .                  |.2    .
.  .---+---.              .     .              .---+---.  .
.  |       |              .     .              |       |  .
.  |  R1   |              .     .              |  R2   |  .
.  |       |              .     .              |       |  .
.  '-------'              .     .              '-------'  .
. . . . . . . . . . . . . .     . . . . . . . . . . . . . .

Figure 1: Example of an OSPF network segmented into three different areas.

Segmenting an OSPF network into basic area domains is essentially the same as creating a “flat” OSPF network (only one area 0.0.0.0), as described here. The only addition needed to create simple area segmentation, is to include what area a network that OSPF should serve is to be part of.

For instance, in this case the router ABR1 would be configured to serve the network 10.0.1.0/24 as part of area 0.0.0.0 and the network 192.168.1.0/24 as part of the area 0.0.0.1. The same principle would be applied for the configuration of OSPF on the other routers in the entire OSPF network,

Configuration

We configure OSPF on each of the individual routers that, and ensure that the networks are added to the correct areas.

Backbone Router

The backbone router will serve two networks 10.0.1.0/24 and 10.0.2.0/24, both being part of area 0.0.0.0:

BR:/#> configure
BR:/config/#> router
BR:/config/router/#> ospf
BR:/config/router/ospf/#> network 10.0.1.0/24 area 0
BR:/config/router/ospf/#> network 10.0.2.0/24 area 0
BR:/config/router/ospf/#> leave
BR:/#>

Area Border Router 1

The ABR1 will serve two networks 10.0.1.0/24 and 192.168.1.0/24, with the first being part of area 0.0.0.0 and the second area 0.0.0.1:

ABR1:/#> configure
ABR1:/config/#> router
ABR1:/config/router/#> ospf
ABR1:/config/router/ospf/#> network 10.0.1.0/24 area 0
ABR1:/config/router/ospf/#> network 192.168.1.0/24 area 1
ABR1:/config/router/ospf/#> leave
ABR1:/#>

Router 1

The R1 will serve one network 192.168.1.0/24, with it being part of area 0.0.0.1:

R1:/#> configure
R1:/config/#> router
R1:/config/router/#> ospf
R1:/config/router/ospf/#> network 192.168.1.0/24 area 1
R1:/config/router/ospf/#> leave
R1:/#>

Area Border Router 2

The ABR2 will serve two networks 10.0.2.0/24 and 192.168.2.0/24, with the first being part of area 0.0.0.0 and the second area 0.0.0.2:

ABR2:/#> configure
ABR2:/config/#> router
ABR2:/config/router/#> ospf
ABR2:/config/router/ospf/#> network 10.0.2.0/24 area 0
ABR2:/config/router/ospf/#> network 192.168.2.0/24 area 2
ABR2:/config/router/ospf/#> leave
ABR2:/#>

Router 2

The R2 will serve one network 192.168.2.0/24, with it being part of area 0.0.0.2:

R2:/#> configure
R2:/config/#> router
R2:/config/router/#> ospf
R2:/config/router/ospf/#> network 192.168.2.0/24 area 2
R2:/config/router/ospf/#> leave
R2:/#>

Case 2: Stub Area

The example use-case, presented in Figure 2, looks almost the same as Case 1, the difference is that we have a new router added to our OSPF network as part of area 0.0.0.0 (backbone). This is an Autonomous System Boundary Router (ASBR), which is connected to some external network that is distributed into the OSPF domain.

Tip

We do not cover configuration of route redistribution in this example use-case, for an example use-case of how to configure route redistribution see this.

For this example use-case we are interested in limiting the amount of external routing information that needs to be propagated throughout the network, by limiting the routing information that is passed into area 0.0.0.1 and area 0.0.0.2 even further. In order to limit external routing information that is passed into a certain area, OSPF provides a specific type of area known as a stub area.

Note

The backbone (area 0.0.0.0) cannot be declared a stub area.

                      External Network
                          .--.-.
                         ( (    )__
                        (_,  \ ) ,_)
                          '-'--`--'
                             |
                         .---+---.
                         |       |
. . . . . . . . . . . . .| ASBR  |. . . . . . . . . . . . .
. Area 0.0.0.0           |       |                        .
.  (Backbone)            '---+---'                        .
.                            |                            .
.                            |                            .
.                        .---+---.                        .
.            10.0.1.0/24 |       | 10.0.2.0/24            .
.      .-----------------+  BR   +-----------------.      .
.      |               .1|       |.1               |      .
.    .2|                 '-------'                 |.2    .
.  .---+---.                                   .---+---.  .
. .|       |. . . . . . . . . . . . . . . . . .|       |. .
   | ABR1  |                                   | ABR2  |
. .|       |. . . . . . . .     . . . . . . . .|       |. .
.  '---+---' Area 0.0.0.1 .     . Area 0.0.0.2 '---+---'  .
.    .1|        (Stub)    .     .    (Stub)        |.1    .
.      |                  .     .                  |      .
.      | 192.168.1.0/24   .     .   192.168.2.0/24 |      .
.      |                  .     .                  |      .
.    .2|                  .     .                  |.2    .
.  .---+---.              .     .              .---+---.  .
.  |       |              .     .              |       |  .
.  |  R1   |              .     .              |  R2   |  .
.  |       |              .     .              |       |  .
.  '-------'              .     .              '-------'  .
. . . . . . . . . . . . . .     . . . . . . . . . . . . . .

Figure 2: Example of an OSPF network segmented into three different areas, with two of the designated as stub areas. The backbone area also distributes some external network into the OSPF domain.

The routers present within the stub areas still have full routing information for the networks and routers within their own area, along with summary routing information to destinations within other areas. However, the routers within the stub area will harbor no routing information learnt from external routing sources.

For the routers inside the stub area, reaching the destinations outside the OSPF domain is based on default routing towards the area’s ABR. All external routing information that is to be distributed into an area will be filtered out by the ABR, instead the ABR will inject a default route towards itself into the area.

Hence, if an external destination is to be reached from a router located inside a stub area the default route will be used to reach the area’s ABR. In turn the ABR will have the routing information necessary to route traffic further on its way towards the intended destination.

Configuration

We assume the starting configuration of the devices is based on Case 1.

In order to create a stub area, all the routers that constitute the area (including the areas ABR) must configure the area as stub.

For routers ABR1 and R1 area 0.0.0.1 needs to be configured stub. And for the routers ABR2 and R2 area 0.0.0.2 needs to be configured stub.

ABR1

Go into the configuration for area 1 and set it to act as a stub area:

ABR1:/#> configure
ABR1:/config/#> router
ABR1:/config/router/#> ospf
ABR1:/config/router/ospf/#> area 1
ABR1:/config/router/ospf/area-0.0.0.1/#> stub
ABR1:/config/router/ospf/area-0.0.0.1/#> leave
ABR1:/#>

R1

Go into the configuration for area 1 and set it to act as a stub area:

R1:/#> configure
R1:/config/#> router
R1:/config/router/#> ospf
R1:/config/router/ospf/#> area 1
R1:/config/router/ospf/area-0.0.0.1/#> stub
R1:/config/router/ospf/area-0.0.0.1/#> leave
R1:/#>

ABR2

Go into the configuration for area 2 and set it to act as a stub area:

ABR2:/#> configure
ABR2:/config/#> router
ABR2:/config/router/#> ospf
ABR2:/config/router/ospf/#> area 2
ABR2:/config/router/ospf/area-0.0.0.2/#> stub
ABR2:/config/router/ospf/area-0.0.0.2/#> leave
ABR2:/#>

R2

Go into the configuration for area 2 and set it to act as a stub area:

R2:/#> configure
R2:/config/#> router
R2:/config/router/#> ospf
R2:/config/router/ospf/#> area 2
R2:/config/router/ospf/area-0.0.0.2/#> stub
R2:/config/router/ospf/area-0.0.0.2/#> leave
R2:/#>

Totally Stubby Area

Stub areas can be configured to limit the amount of routing information that is distributed into it even further by declaring it a Totally stub area.

What this will do is that summary routing information from other areas within the OSPF domain, will not be distributed to the routers inside the area. The behavior is essentially the same as what a regular stub area does in limiting external routing information inside the area, but this is limiting routing information from other OSPF areas.

If an area is to be configured as a totally stub area, it only needs to be done on the area’s ABR:

ABR:/#> configure
ABR:/config/#> router
ABR:/config/router/#> ospf
ABR:/config/router/ospf/#> area 1
ABR:/config/router/ospf/area-0.0.0.1/#> stub no-summary
ABR:/config/router/ospf/area-0.0.0.1/#> leave
ABR:/#>

Default route

As mentioned, the ABR will inject a default route towards itself into the area it serves. The cost of the default route injected into the area is by default set to 1. If this cost needs to be adjusted it can be done in the following manner:

ABR:/#> configure
ABR:/config/#> router
ABR:/config/router/#> ospf
ABR:/config/router/ospf/#> area 1
ABR:/config/router/ospf/area-0.0.0.1/#> default-cost 10
ABR:/config/router/ospf/area-0.0.0.1/#> leave
ABR:/#>

Case 3: Not So Stubby Area (NSSA)

This use-case builds further upon the one presented in Case 2, describing stub areas. As explained a stub area cannot redistribute routing information that has been learnt from external sources. What this entails is that a stub area cannot contain any Autonomous System Border Router (ASBR).

In the use-case presented in this example, as seen in Figure 3, we still want to limit the routing information that is distributed by utilizing stub areas. However, in this case we have an ASBR router inside area 0.0.0.2. This is not possible with a stub area, but OSPF support another type of area that allows for this called a Not So Stubby Area (NSSA).

                      External Network
                          .--.-.
                         ( (    )__
                        (_,  \ ) ,_)
                          '-'--`--'
                             |
                         .---+---.
                         |       |
. . . . . . . . . . . . .| ASBR1 |. . . . . . . . . . . . .
. Area 0.0.0.0           |       |                        .
.  (Backbone)            '---+---'                        .
.                            |                            .
.                            |                            .
.                        .---+---.                        .
.            10.0.1.0/24 |       | 10.0.2.0/24            .
.      .-----------------+  BR   +-----------------.      .
.      |               .1|       |.1               |      .
.    .2|                 '-------'                 |.2    .
.  .---+---.                                   .---+---.  .
. .|       |. . . . . . . . . . . . . . . . . .|       |. .
   | ABR1  |                                   | ABR2  |
. .|       |. . . . . . . .     . . . . . . . .|       |. .
.  '---+---' Area 0.0.0.1 .     . Area 0.0.0.2 '---+---'  .
.    .1|        (Stub)    .     .    (NSSA)        |.1    .
.      |                  .     .                  |      .
.      | 192.168.1.0/24   .     .   192.168.2.0/24 |      .
.      |                  .     .                  |      .
.    .2|                  .     .                  |.2    .
.  .---+---.              .     .              .---+---.  .
.  |       |              .     .              |       |  .
.  |  R1   |              .     .              |  R2   |  .
.  |       |              .     .              |       |  .
.  '-------'              .     .              '---+---'  .
. . . . . . . . . . . . . .     .                  |      .
                                .                  |      .
                                .              .---+---.  .
                                .              |       |  .
                                . . . . . . . .| ASBR2 |. .
                                               |       |
                                               '---+---'
                                                   |
                                                .--.-.
                                               ( (    )__
                                              (_,  \ ) ,_)
                                                '-'--`--'
                                            External Network

Figure 3: Example of an OSPF network segmented into three different areas, with one area configured as a NSSA and distributing an external network into the OSPF domain.

In the example both area 0.0.0.1 and 0.0.0.2 are declared as stub areas to avoid routing information being propagated from an external network redistributed by the ASBR in the backbone. But area 0.0.0.2 is declared a NSSA in order to be able to redistribute the routes from its connected external network, while still limiting routing information from the backbones external networks as previously.

Configuration

We assume the starting configuration of the devices is based on Case 2.

In order to create a NSSA, all the routers that constitute the area (including the areas ABR and ASBR) must configure the area as NSSA.

ABR2

Go into the configuration for area 2 and set it to act as a NSSA:

ABR2:/#> configure
ABR2:/config/#> router
ABR2:/config/router/#> ospf
ABR2:/config/router/ospf/#> area 2
ABR2:/config/router/ospf/area-0.0.0.2/#> nssa
ABR2:/config/router/ospf/area-0.0.0.2/#> leave
ABR2:/#>

R2

Go into the configuration for area 2 and set it to act as a NSSA:

R2:/#> configure
R2:/config/#> router
R2:/config/router/#> ospf
R2:/config/router/ospf/#> area 2
R2:/config/router/ospf/area-0.0.0.2/#> nssa
R2:/config/router/ospf/area-0.0.0.2/#> leave
R2:/#>

ASBR2

Go into the configuration for area 2 and set it to act as a NSSA:

ASBR2:/#> configure
ASBR2:/config/#> router
ASBR2:/config/router/#> ospf
ASBR2:/config/router/ospf/#> area 2
ASBR2:/config/router/ospf/area-0.0.0.2/#> nssa
ASBR2:/config/router/ospf/area-0.0.0.2/#> leave
ASBR2:/#>

NSSA totally stub area

Same as for stub areas, NSSA areas can also be configured to limit the amount of routing information from other ares in the OSPF network, by declaring it a NSSA totally stub area.

This only needs to be configured on the ABR of the area:

ABR:/#> configure
ABR:/config/#> router
ABR:/config/router/#> ospf
ABR:/config/router/ospf/#> area 1
ABR:/config/router/ospf/area-0.0.0.1/#> nssa no-summary
ABR:/config/router/ospf/area-0.0.0.1/#> leave
ABR:/#>