Example: Defining Default Behavior for All Static Routes

This example shows how to define the default behavior for all static routes.

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. Configure static routes and define their next hop addresses. See Example: Configuring a Basic Set of Static Routes.
  4. Control static route selection. See Example: Controlling Static Route Selection.
  5. Control static routes in routing and forwarding tables. See Example: Controlling Static Routes in Routing and Forwarding Tables.

Overview

This example shows how to define the default behavior for all static routes.

Configuration

CLI Quick Configuration

To quickly configure the default behavior for all static routes, copy the following command and paste it into the CLI:

[edit]set routing-options static defaults 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 define the default behavior for all static routes:

  1. Create a static route default.
    [edit]user@host# edit routing-options static defaults
  2. Retain the static route default in the forwarding table.
    [edit routing-options static defaults]user@host# set retain
  3. Prevent the static route default from being readvertised.
    [edit routing-options static defaults]user@host# set no-readvertise
  4. Include the static route default in the routing table.
    [edit routing-options static defaults]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 static {defaults {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.


user@host> show route terse
inet.0: 20 destinations, 20 routes (20 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 192.168.47.5/32        S   5                        Reject
* 172.16.0.0/12      S   5                       >192.168.71.254
* 192.168.0.0/18     S   5                       >192.168.71.254
* 192.168.40.0/22    S   5                       >192.168.71.254
* 192.168.64.0/18    S   5                       >192.168.71.254
* 192.168.64.0/21    D   0                       >fxp0.0
* 192.168.71.246/32  L   0                        Local
* 192.168.220.4/30   D   0                       >ge-0/0/1.0
* 192.168.220.5/32   L   0                        Local
* 192.168.220.8/30   D   0                       >ge-0/0/2.0
* 192.168.220.9/32   L   0                        Local
* 192.168.220.12/30  D   0                       >ge-0/0/3.0
* 192.168.220.13/32  L   0                        Local
* 192.168.220.17/32  L   0                        Reject
* 192.168.220.21/32  L   0                        Reject
* 192.168.220.24/30  D   0                       >at-1/0/0.0
* 192.168.220.25/32  L   0                        Local
* 192.168.220.28/30  D   0                       >at-1/0/1.0
* 192.168.220.29/32  L   0                        Local
* 224.0.0.9/32       R 100          1             MultiRecv

Meaning

The output shows a list of the routes that are currently in the inet.0 routing table. Verify the following information:

Related Topics