Supported Platforms
Example: OSPF Virtual Links
Understanding OSPF Virtual Links
OSPF requires that all areas in an autonomous system (AS) must be physically connected to the backbone area (area 0). In large networks with many areas, in which direct connectivity between all areas and the backbone area is physically difficult or impossible, you can configure virtual links to connect noncontiguous areas. Virtual links use a transit area that contains two or more area border routers (ABRs) to pass network traffic from one adjacent area to another. The transit area must have full routing information and it cannot be a stub area. For example, Figure 1 shows a virtual link between a noncontiguous area and the backbone area through an area connected to both.
Figure 1: OSPF Topology with a Virtual Link

In the topology shown in Figure 1, a virtual link is established between area 0.0.0.3 and the backbone area through area 0.0.0.2. The virtual link transits area 0.0.0.2. All outbound traffic destined for other areas is routed through area 0.0.0.2 to the backbone area and then to the appropriate ABR. All inbound traffic destined for area 0.0.0.3 is routed to the backbone area and then through area 0.0.0.2.
Example: Configuring OSPF Virtual Links
This example shows how to configure an OSPF virtual link to connect noncontiguous areas.
Requirements
Before you begin:
- Configure the device interfaces. See the Junos® OS Network Interfaces.
- Configure a single-area OSPF network. See Example: Configuring a Single-Area OSPF Network.
- Configure a multiarea OSPF network. See Example: Configuring a Multiarea OSPF Network.
Overview
If any routing device on the backbone is not physically connected to the backbone, you must establish a virtual connection between that routing device and the backbone to connect the noncontiguous areas.
To configure an OSPF virtual link through an area, you specify the router ID (IP address) of the routing devices at each end of the virtual link. These routing devices must be area border routers (ABRs), with one that is physically connected to the backbone. You cannot configure virtual links through stub areas. You must also specify the number of the area through which the virtual link transits (also known as the transit area). You apply these settings to the backbone area (defined by the area 0.0.0.0) configuration on the ABRs that are part of the virtual link.
In this example, Device R1 and Device R2 are the routing devices at each end of the virtual link, with Device R1 physically connected to the backbone, as shown in Figure 2. You configure the following virtual link settings:
- neighbor-id—Specifies the IP address of the routing device at the other end of the virtual link. In this example, Device R1 has a router ID of 192.168.0.5, and Device R2 has a router ID of 192.168.0.3.
- transit-area—Specifies the area identifier through which the virtual link transits. In this example, area 0.0.0.3 is not connected to the backbone, so you configure a virtual link session between area 0.0.0.3 and the backbone area through area 0.0.0.2. Area 0.0.0.2 is the transit area.
Figure 2: OSPF Virtual Link

Configuration
CLI Quick Configuration
- To quickly configure an OSPF virtual link on the local
routing device (Device R1), copy the following commands and paste
them into the CLI.
Note: You must configure both routing devices that are part of the virtual link and specify the applicable neighbor ID on each routing device.
[edit] set routing-options router-id 192.168.0.5set protocols ospf area 0.0.0.0 virtual-link neighbor-id 192.168.0.3 transit-area 0.0.0.2 - To quickly configure an OSPF virtual link on the remote
routing device (Device R2), copy the following commands and paste
them into the CLI. [edit] set routing-options router-id 192.168.0.3set protocols ospf area 0.0.0.0 virtual-link neighbor-id 192.168.0.5 transit-area 0.0.0.2
Step-by-Step Procedure
To configure an OSPF virtual link on the local routing device (Device R1):
- Configure the router ID.[edit]user@R1# set routing-options router-id 192.168.0.5
- Enter OSPF configuration mode and specify OSPF area 0.0.0.0.
Note: For an OSPFv3 virtual link, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit]user@R1# edit protocols ospf area 0.0.0.0 - Configure an OSPF virtual link and specify the transit
area 0.0.0.2.
This routing device must be an ABR that is physically connected to the backbone.[edit protocols ospf area 0.0.0.0]user@R1# set virtual-link neighbor-id 192.168.0.3 transit-area 0.0.0.2 - If you are done configuring the device, commit the configuration.[edit protocols ospf area 0.0.0.0]user@R1# commit
Step-by-Step Procedure
To configure an OSPF virtual link on the remote ABR (Device R2, the routing device at the other end of the link):
- Configure the router ID.[edit]user@R2# set routing-options router-id 192.168.0.3
- Enter OSPF configuration mode and specify OSPF area 0.0.0.0.
Note: For an OSPFv3 virtual link, include the ospf3 statement at the [edit protocols] hierarchy level.
[edit]user@R2# edit protocols ospf area 0.0.0.0 - Configure an OSPF virtual link on the remote ABR and specify
the transit area 0.0.0.2.
This routing device is not physically connected to the backbone.[edit protocols ospf area 0.0.0.0]user@R2# set virtual-link neighbor-id 192.168.0.5 transit-area 0.0.0.2 - If you are done configuring the device, commit the configuration.[edit protocols ospf area 0.0.0.0]user@R2# commit
Results
Confirm your configuration by entering the show routing-options and the show protocols ospf commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Configuration on the local routing device (Device R1):
Configuration on the remote ABR (Device R2):
To confirm your OSPFv3 configuration, enter the show protocols ospf3 command.
Verification
Confirm that the configuration is working properly.
Verifying Entries in the Link-State Database
Purpose
Verify that the entries in the OSPFv2 or OSPFv3 link-state database display. The Router field in the OSPFv2 output displays LSA information, including the type of link. If configured as a virtual link, the Type is Virtual. For each router link, the Type field in the OSPFv3 output displays the type of interface. If configured as a virtual link, the Type is Virtual.
Action
From operational mode, enter the show ospf database detail command for OSPFv2, and enter the show ospf3 database detail command for OSPFv3.
Verifying OSPF Interface Status and Configuration
Purpose
Verify that the OSPFv2 or OSPFv3 interface is configured and status displays. The Type field displays the type of interface. If the interface is configured as part of a virtual link, the Type is Virtual.
Action
From operational mode, enter the show ospf interface detail command for OSPFv2, and enter the show ospf3 interface detail command for OSPFv3.