Example: Controlling Static Routes in Routing and Forwarding Tables

This example shows how to control static routes in the routing and forwarding tables.

Requirements

Before you begin:

  1. Establish basic connectivity. See the Getting Started Guide for your device.
  2. Configure network interfaces. See Junos OS Interfaces Configuration Guide for Security Devices.
  3. Control static route selection. See Example: Controlling Static Route Selection.

Overview

This example shows how to control static routes in routing and forwarding tables.

Configuration

CLI Quick Configuration

To quickly configure static routes in routing and forwarding tables, copy the following command and paste it into the CLI:

[edit]set routing-options static route 192.168.47.5/32 retain no-readvertise passive

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode.

To control static routes in routing and forwarding tables:

  1. Create a static route.
    [edit]user@host# edit routing-options static route 192.168.47.5/32
  2. Retain the static route in the forwarding table.
    [edit routing-options static route 192.168.47.5/32]user@host# set retain
  3. Prevent the static route from being readvertised.
    [edit routing-options static route 192.168.47.5/32]user@host# set no-readvertise
  4. Include the static route in the routing table.
    [edit routing-options static route 192.168.47.5/32]user@host# set passive

Results

From configuration mode, confirm your configuration by entering the show routing-options static command. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

For brevity, this show routing-options static command output includes only the configuration that is relevant to this example. Any other configuration on the system has been replaced with ellipses (...).

[edit]user@host# show routing-options staticroute 192.168.47.5/32...retain;no-readvertise;passive;}

If you are done configuring the device, enter commit from configuration mode.

Verification

To confirm that the configuration is working properly, perform this task:

Verifying the Static Route Configuration

Purpose

Verify the static route configuration by displaying the routing table and checking its contents.

Action

From operational mode, enter the show route terse command.

Related Topics