Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Example: Creating Routing Tables

This example shows how to create a custom routing table.

Requirements

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

Overview

Creating routing tables is optional. You might have policy considerations that would lead you to create separate routing tables to manage the propagation of routing information. This capability is rarely used, but it is demonstrated here for completeness.

If you do not create any routing tables, Junos OS uses its default routing tables.

Note: If you want to add static, aggregate, generated, or martian routes only to the default IPv4 unicast routing table (inet.0), you do not have to create any routing tables because, by default, these routes are added to inet.0. You can add these routes by including the static, aggregate, generate, and martians statements.

To explicitly create a routing table, include the rib statement and child statements under the rib statement.

The routing table name, routing-table-name, includes the protocol family, optionally followed by a period and a number. The protocol family can be inet for the IPv4 family, inet6 for the IPv6 family, or iso for the International Standards Organization (ISO) protocol family. The number represents the routing instance. The first instance is 0.

This example shows how to configure a custom IPv4 routing table called inet.14. The example also shows how to populate the routing table with a single static route.

Note: On EX Series switches, only dynamically learned routes can be imported from one routing table group to another.

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.

set routing-options rib inet.14 static route 10.2.0.0/16 discard

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 create a routing table:

  1. Configure the routing table.
    [edit routing-options]user@host# set rib inet.14 static route 10.2.0.0/16 discard
  2. If you are done configuring the device, commit the configuration.
    [edit]user@host# commit

Results

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

user@host# show routing-optionsrib inet.14 {static {route 10.2.0.0/16 discard;}}

Verification

Confirm that the configuration is working properly.

Checking the Routing Table

Purpose

Make sure that the static route appears in the custom routing table.

Action

user@host> show route table inet.14
inet.14: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
Restart Complete
+ = Active Route, - = Last Active, * = Both

10.2.0.0/16        *[Static/5] 00:00:09
                      Discard

Meaning

The static route is in the custom routing table.

Published: 2012-12-08