Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Configuring OSPF Routing Instances

Understanding OSPF Routing Instances

A routing instance is a collection of routing tables, interfaces, and routing protocol parameters. The set of interfaces belongs to the routing tables, and the OSPF routing protocol parameters control the information in the routing tables. You can further install routes learned from OSPF routing instances into routing tables in the OSPF routing table group.

Note:

The default routing instance, primary, refers to the main inet.0 routing table. The primary routing instance is reserved and cannot be specified as a routing instance.

You can configure the following types of routing instances:

  • OSPFv2—Forwarding, Layer 2 virtual private network (VPN), nonforwarding, VPN routing and forwarding (VRF), virtual router, and virtual private LAN service (VPLS).

  • OSPFv3—Nonforwarding, VRF, and virtual router.

Each routing instance has a unique name and a corresponding IP unicast table. For example, if you configure a routing instance with the name my-instance, the corresponding IP unicast table is my-instance.inet.0. All routes for my-instance are installed into my-instance.inet.0.

You can also configure multiple routing instances of OSPF.

Minimum Routing-Instance Configuration for OSPFv2

To configure a routing instance for OSPFv2, you must include at least the following statements in the configuration:

Note:

You can configure a logical interface under only one routing instance.

Minimum Routing-Instance Configuration for OSPFv3

To configure a routing instance for OSPFv3, you must include at least the following statements in the configuration:

Note:

You can configure a logical interface under only one routing instance.

Multiple Routing Instances of OSPF

Multiple instances of OSPF are used for Layer 3 VPN implementations. The multiple instances of OSPF keep routing information for different VPNs separate. The VRF instance advertises routes from the customer edge (CE) router to the provider edge (PE) router and advertises routes from the PE router to the CE router. Each VPN receives only routing information belonging to that VPN.

You can create multiple instances of OSPF by including statements at the following hierarchy levels:

  • [edit routing-instances routing-instance-name (ospf | ospf3)]

  • [edit logical-systems logical-system-name routing-instances routing-instance-name (ospf | ospf3)]

Installing Routes from OSPF Routing Instances into the OSPF Routing Table Group

To install routes learned from OSPF routing instances into routing tables in the OSPF routing table group, include the rib-group statement:

For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.

Example: Configuring Multiple Routing Instances of OSPF

This example shows how to configure multiple routing instances of OSPF.

Requirements

Before you begin:

Overview

When you configure multiple routing instances of OSPF, we recommend that you perform the following tasks:

  1. Configure the OSPFv2 or OSPFv3 default instance at the [edit protocols (ospf | ospf3)] and [edit logical-systems logical-system-name protocols (ospf | ospf3)] hierarchy levels with the statements needed for your network so that routes are installed in inet.0 and in the forwarding table. Make sure to include the routing table group.

  2. Configure an OSPFv2 or OSPFv3 routing instance for each additional OSPFv2 or OSPFv3 routing entity, configuring the following:

    • Interfaces

    • Routing options

    • OSPF protocol statements belonging to that entity

    • Routing table group

  3. Configure a routing table group to install routes from the default route table, inet.0, into a routing instance’s route table.

  4. Configure a routing table group to install routes from a routing instance into the default route table, inet.0.

    Note:

    Nonforwarding routing instances do not have forwarding tables that correspond to their routing tables.

  5. Create an export policy to export routes with a specific tag, and use that tag to export routes back into the instances. For more information, see the Routing Policies, Firewall Filters, and Traffic Policers User Guide.

Figure 1 shows how you can use multiple routing instances of OSPFv2 or OSPFv3 to segregate prefixes within a large network. The network consists of three administrative entities: voice-policy, other-policy, and the default routing instance. Each entity is composed of several geographically separate sites that are connected by the backbone and managed by the backbone entity.

Topology

Figure 1: Configuration for Multiple Routing InstancesConfiguration for Multiple Routing Instances

Sites A and D belong to the voice-policy routing instance. Sites B and C belong to the other-policy instance. Device 1 and Device 3 at the edge of the backbone connect the routing instances. Each runs a separate OSPF or OSPFv3 instance (one per entity).

Device 1 runs three OSPFv2 or OSPFv3 instances: one each for Site A (voice-policy), Site C (other-policy), and the backbone, otherwise known as the default instance. Device 3 also runs three OSPFv2 or OSPFv3  instances: one each for Site B (other-policy), Site D (voice-policy), and the backbone (default instance).

When Device 1 runs the OSPFv2 or OSPFv3 instances, the following occur:

  • Routes from the default instance routing table are placed in the voice-policy and other-policy instance routing tables.

  • Routes from the voice-policy routing instance are placed in the default instance routing table.

  • Routes from the other-policy routing instance are placed in the default instance routing table.

  • Routes from the voice-policy routing instance do not enter the other-policy instance routing table.

  • Routes from the other-policy routing instance do not enter the voice-policy instance routing table.

Configuration

Procedure

CLI Quick Configuration

To quickly configure multiple routing instances of OSPF, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

Configuration on Device 1:

Configuration on Device 3:

Step-by-Step Procedure

To configure multiple routing instances of OSPF:

  1. Configure the routing instances for voice-policy and other-policy.

    Note:

    To specify OSPFv3, include the ospf3 statement at the [edit routing-instances protocols] hierarchy level.

  2. Configure the routing table group inet-to-voice-and-other to take routes from inet.0 (default routing table) and place them in the voice-policy.inet.0 and other-policy.inet.0 routing tables.

  3. Configure the routing table group voice-to-inet to take routes from voice-policy.inet.0 and place them in the inet.0 default routing table.

  4. Configure the routing table group other-to-inet to take routes from other-policy.inet.0 and place them in the inet.0 default routing table.

  5. Configure the default OSPF instance.

    Note:

    To specify OSPFv3, include the ospf3 statement at the [edit routing-instances protocols] hierarchy level.

  6. If you are done configuring the device, commit the configuration.

Results

Confirm your configuration by entering the show routing-instances, show routing-options, and 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 Device 1:

Configuration on Device 3:

To confirm your OSPFv3 configuration, enter the show routing-instances, show routing-options, and show protocols ospf3 commands.

Verification

Confirm that the configuration is working properly.

Verifying the Routing Instances

Purpose

Verify the configured routing instance settings.

Action

From operational mode, enter the show route instance detail command.