Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Populating a Routing Table Created by Virtual Router Configuration

 

This example shows how to populate the routing table that is created when you configure a virtual router.

Requirements

In this example, no special configuration beyond device initialization is required.

Overview

You can install routes into more than one routing table. For example, you might want a simple configuration that allows you to install a static route into the default routing table inet.0, as well as a second routing table vpna.inet.0. Instead of configuring the same static route for each routing table, you can use routing table groups to insert the route into multiple tables. To create a routing table group, include the rib-groups statement.

This example shows how to export static routes, direct routes, and local routes from the default IPv4 unicast routing table (inet.0) and import them into the IPv4 unicast routing table of a virtual router called vpna (vpna.inet.0).

Note

To explicitly create a routing table, include the rib statement. In this case, you do not need to use the rib statement because when you configure a routing instance, Junos OS automatically creates the routing table instance-nameinet.0.

In this example, Device A and Device B are directly connected to each other. Device A also has a virtual router configured called vpna. Device A’s inet.0 routing table has direct and local routes (also known as interface routes). These routes are imported into vpna’s inet.0 routing table (vpna.inet.0). Device A also has a static route configured. This static route is also imported into vpna.inet.0.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Device A

Device B

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure this example:

  1. Configure the routing instance.
  2. Configure the interfaces.
  3. Configure one or more static routes.
  4. Include the direct and local routes in a routing table group called group1.

    The interface-routes statement specifies direct and local routes to match against. For an example of how to configure and apply a routing policy that specifies particular routes for import and export, see Example: Exporting Specific Routes from One Routing Table Into Another Routing Table.

  5. Include all static routes in the group1 routing table group.

    The static statement specifies the protocol (static) to match against.

  6. Configure the primary routing table for group1.

    The primary routing table determines the address family of the routing table group. To configure an IPv4 group, specify inet.0 as the primary table. To configure an IPv6 group, specify inet6.0 as the primary routing table.

  7. Configure the secondary routing table for group1.
  8. If you are done configuring the device, commit the configuration.

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure Device B:

  1. Configure the interfaces.
  2. If you are done configuring the device, commit the configuration.

Results

Confirm your configuration by issuing the show interfaces, show routing-instances, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

Verification

Confirm that the configuration is working properly.

Checking the Routing Tables

Purpose

Make sure that the expected routes appear in the routing tables.

Action

user@A> show route table inet.0
user@A> show route table vpna.inet.0

Meaning

The static route and the interface routes appear in both routing tables.