set routing-options static route 0.0.0.0/0 next-hop <next_hop_ip>
To configure static routes on a Juniper SRX device, you’ll use the Junos OS CLI to define the desired routes. A static route manually specifies the path that network traffic should take to reach a specific destination. Below are the steps to configure static routes on a Juniper SRX device:
Step 1: Access the SRX Device
Log into the SRX device using SSH, console, or any other method you use to access the CLI.
Step 2: Enter Configuration Mode
Once logged in, enter configuration mode:
Step 3: Configure Static Routes
Static routes are configured in the routing-options
section. There are two main types of static routes you can configure:
- Direct static route: A route pointing to a specific next-hop IP address or an exit interface.
- Default static route: A route that is used for any destination not explicitly listed in the routing table.
3.1 Direct Static Route
To configure a static route that points to a specific next-hop IP address:
Where:
<destination_network>
is the destination IP network or subnet.<next_hop_ip>
is the IP address of the next hop router or gateway.
Example:
To add a static route for network 192.168.100.0/24
with a next-hop IP address of 10.0.0.1
, you would use:
set routing-options static route 192.168.100.0/24 next-hop 10.0.0.1
3.2 Static Route via an Interface
Alternatively, you can configure a static route that points to a specific outgoing interface (without specifying a next-hop IP). This is typically used in scenarios where the next-hop is directly connected to the specified interface.
Where:
<destination_network>
is the destination IP network or subnet.<interface_name>
is the name of the local interface (e.g.,ge-0/0/0
).
Example:
To add a static route for network 10.10.10.0/24
via the interface ge-0/0/1
:
3.3 Default Route (Gateway of Last Resort)
To configure a default static route (also known as a "gateway of last resort"):
Example:
To configure a default route that points to 10.0.0.1
as the next-hop gateway:
This tells the SRX device to send all traffic destined for networks not explicitly listed in the routing table to the IP address 10.0.0.1
.
Step 4: Commit the Configuration
Once you've entered the static route configurations, commit the changes to apply them:
Step 5: Verify the Static Routes
You can verify the static route configuration by using the following commands:
-
Show the static route configuration:
-
Check the routing table to verify the static routes are installed:
-
Check specific route details (including static routes):