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:
- Establish basic connectivity. See the Getting Started Guide for your device.
- Configure network interfaces. See Junos OS Interfaces Configuration Guide for Security Devices .
- Configure static routes and define their next hop addresses. See Example: Configuring a Basic Set of Static Routes.
- Control static route selection. See Example: Controlling Static Route Selection.
- 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.
- Configure attributes that define static route behavior either at the individual route level or as a default behavior that applies to all static routes. In the case of conflicting configurations, the configuration at the individual route level overrides static route defaults.
- Specify that the route is to be retained in the forwarding table after the routing process shuts down. By default, static routes are not retained.
- Specify that the static route is not to be readvertised. By default, static routes are eligible to be readvertised.
- Specify that the static route is to be included in the routing table whether the route is active or not. By default, passive routes are not included in the routing table.
Configuration
CLI Quick Configuration
To quickly configure the default behavior for all static routes, copy the following command and paste it into the CLI:
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:
- Create a static route default.[edit]user@host# edit routing-options static defaults
- Retain the static route default in the
forwarding table.[edit routing-options static defaults]user@host# set retain
- Prevent the static route default from
being readvertised.[edit routing-options static defaults]user@host# set no-readvertise
- 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 (...).
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 terseinet.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:
- Each configured static route is present. Routes are listed in ascending order by IP address. Static routes are identified with an S in the protocol (P) column of the output.
- Each static route is active. Routes that are active show the next-hop IP address in the Next hop column. If a route's next-hop address is unreachable, the next-hop address is identified as Reject. These routes are not active routes, but they appear in the routing table because the passive attribute is set.
- The preference for each static route is correct. The preference for a particular route is listed in the Prf column of the output.
Related Topics
- Junos OS Feature Support Reference for SRX Series and J Series Devices
- show route terse in the Junos Routing Protocols and Policies Command Reference
Hide Navigation Pane
Show Navigation Pane
Download
SHA1