Supported Platforms
Related Documentation
- ACX, M, MX, QFX, T Series
- OSPF Areas and Router Functionality Overview
- ACX, J, M, MX, SRX, T Series
- OSPF Configuration Overview
Examples: Configuring OSPF Areas
Understanding OSPF Areas and Backbone Areas
OSPF networks in an autonomous system (AS) are administratively grouped into areas. Each area within an AS operates like an independent network and has a unique 32-bit area ID, which functions similar to a network address. Within an area, the topology database contains only information about the area, link-state advertisements (LSAs) are flooded only to nodes within the area, and routes are computed only within the area. The topology of an area is hidden from the rest of the AS, thus significantly reducing routing traffic in the AS. Subnetworks are divided into other areas, which are connected to form the whole of the main network. Routing devices that are wholly within an area are called internal routers. All interfaces on internal routers are directly connected to networks within the area.
The central area of an AS, called the backbone area, has a special function and is always assigned the area ID 0.0.0.0. (Within a simple, single-area network, this is also the ID of the area.) Area IDs are unique numeric identifiers, in dotted decimal notation, but they are not IP addresses. Area IDs need only be unique within an AS. All other networks or areas in the AS must be directly connected to the backbone area by a routing device that has interfaces in more than one area. These connecting routing devices are called area border routers (ABRs). Figure 1 shows an OSPF topology of three areas connected by two ABRs.
Figure 1: Multiarea OSPF Topology

Because all areas are adjacent to the backbone area, OSPF routers send all traffic not destined for their own area through the backbone area. The ABRs in the backbone area are then responsible for transmitting the traffic through the appropriate ABR to the destination area. The ABRs summarize the link-state records of each area and advertise destination address summaries to neighboring areas. The advertisements contain the ID of the area in which each destination lies, so that packets are routed to the appropriate ABR. For example, in the OSPF areas shown in Figure 1, packets sent from Router A to Router C are automatically routed through ABR B.
Junos OS supports active backbone detection. Active backbone detection is implemented to verify that ABRs are connected to the backbone. If the connection to the backbone area is lost, then the routing device’s default metric is not advertised, effectively rerouting traffic through another ABR with a valid connection to the backbone. Active backbone detection enables transit through an ABR with no active backbone connection. An ABR advertises to other routing devices that it is an ABR even if the connection to the backbone is down, so that the neighbors can consider it for interarea routes.
An OSPF restriction requires all areas to be directly connected to the backbone area so that packets can be properly routed. All packets are routed first to the backbone area by default. Packets that are destined for an area other than the backbone area are then routed to the appropriate ABR and on to the remote host within the destination area.
Example: Configuring a Single-Area OSPF Network
This example shows how to configure a single-area OSPF network.
Requirements
Before you begin:
- Configure the device interfaces. See the Router Interfaces or the Junos OS Interfaces Configuration Guide for Security Devices.
- Configure the router identifiers for the devices in your OSPF network. See Example: Configuring an OSPF Router Identifier.
Overview
To activate OSPF on a network, you must enable the OSPF protocol on all interfaces within the network on which OSPF traffic is to travel. To enable OSPF, you must configure one or more interfaces on the device within an OSPF area. Once the interfaces are configured, OSPF LSAs are transmitted on all OSPF-enabled interfaces, and the network topology is shared throughout the network.
In an autonomous system (AS), the backbone area is always assigned area ID 0.0.0.0 (within a simple, single-area network, this is also the ID of the area). Area IDs are unique numeric identifiers, in dotted decimal notation. Area IDs need only be unique within an AS. All other networks or areas in the AS must be directly connected to the backbone area by area border routers that have interfaces in more than one area. You must also create a backbone area if your network consists of multiple areas. In this example, you create the backbone area and add interfaces, such as ge-0/0/0, as needed to the OSPF area.
To use OSPF on the device, you must configure at least one OSPF area, such as the one shown in Figure 2.
Figure 2: Typical Single-Area OSPF Network Topology

Configuration
CLI Quick Configuration
To quickly configure a single-area OSPF network, copy the following command and paste it into the CLI. You repeat this configuration for all interfaces that are part of the OSPF area.
Step-by-Step Procedure
To configure a single-area OSPF network:
- Configure the single-area OSPF network by specifying the
area ID and associated interface.
Note: For a single-area OSPFv3 network, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit]user@host# set protocols ospf area 0.0.0.0 interface ge-0/0/0 - If you are done configuring the device, commit the configuration.[edit]user@host# commit
Results
Confirm your configuration by entering the show protocols ospf command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
To confirm your OSPFv3 configuration, enter the show protocols ospf3 command.
Verification
Confirm that the configuration is working properly.
Verifying the Interfaces in the Area
Purpose
Verify that the interface for OSPF or OSPFv3 has been configured for the appropriate area. Confirm that the Area field displays the value that you configured.
Action
From operational mode, enter the show ospf interface command for OSPFv2, and enter the show ospf3 interface command for OSPFv3.
Example: Configuring a Multiarea OSPF Network
This example shows how to configure a multiarea OSPF network. To reduce traffic and topology maintenance for the devices in an OSPF autonomous system (AS), you can group the OSPF-enabled routing devices into multiple areas.
Requirements
Before you begin:
- Configure the device interfaces. See the Router Interfaces or the Junos OS Interfaces Configuration Guide for Security Devices.
- Configure the router identifiers for the devices in your OSPF network. See Example: Configuring an OSPF Router Identifier.
- Control OSPF designated router election. See Example: Controlling OSPF Designated Router Election.
- Configure a single-area OSPF network. See Example: Configuring a Single-Area OSPF Network.
Overview
To activate OSPF on a network, you must enable the OSPF protocol on all interfaces within the network on which OSPF traffic is to travel. To enable OSPF, you must configure one or more interfaces on the device within an OSPF area. Once the interfaces are configured, OSPF LSAs are transmitted on all OSPF-enabled interfaces, and the network topology is shared throughout the network.
Each OSPF area consists of routing devices configured with the same area number. The backbone area is always assigned area ID 0.0.0.0. (All area identifiers (IDs) must be unique within an AS.) All other networks or areas in the AS must be directly connected to the backbone area by a router that has interfaces in more than one area. In Figure 3, Devices A and C are in the backbone area (area 0), and Devices D and E are in area 2. Device B has a special role. This is the area border router that connects area 0 and area 2. The area border router maintains a separate topological database for each area to which it is connected.
To reduce traffic and topology maintenance for the devices in an OSPF AS, you can group them into multiple areas as shown in Figure 3. In this example, you create the backbone area, create an additional area (area 2) and assign it unique area ID 0.0.0.2, and you configure Device B as the area border router, where interface ge-0/0/0 participates in OSPF area 0 and interface ge-0/0/2 participates in OSPF area 2.
Figure 3: Typical Multiarea OSPF Network Topology

Configuration
CLI Quick Configuration
To quickly configure a multiarea OSPF network, copy the following commands and paste them into the CLI. You repeat this configuration for all interfaces that are part of the OSPF area.
Device A
Device C
Device B
Device D
Device E
Step-by-Step Procedure
To configure a multiarea OSPF network:
- Configure the backbone area.
Note: For an OSPFv3 network, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit]user@C# set protocols ospf area 0.0.0.0 interface ge-0/0/0[edit]user@B# set protocols ospf area 0.0.0.0 interface ge-0/0/0 - Configure an additional area for your OSPF network.[edit]user@B# set protocols ospf area 0.0.0.2 interface ge-0/0/2[edit]user@E# set protocols ospf area 0.0.0.2 interface ge-0/0/2
- If you are done configuring the device, commit the configuration.[edit]user@host# commit
Results
Confirm your configuration by entering the show protocols ospf command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
To confirm your OSPFv3 configuration, enter the show protocols ospf3 command.
Verification
Confirm that the configuration is working properly.
Verifying the Interfaces in the Area
Purpose
Verify that the interface for OSPF or OSPFv3 has been configured for the appropriate area. Confirm that the Area field displays the value that you configured.
Action
From operational mode, enter the show ospf interface command for OSPFv2, and enter the show ospf3 interface command for OSPFv3.
Related Documentation
- ACX, M, MX, QFX, T Series
- OSPF Areas and Router Functionality Overview
- ACX, J, M, MX, SRX, T Series
- OSPF Configuration Overview
Published: 2013-07-09
Supported Platforms
Related Documentation
- ACX, M, MX, QFX, T Series
- OSPF Areas and Router Functionality Overview
- ACX, J, M, MX, SRX, T Series
- OSPF Configuration Overview