Static Route
Static routing provides manual route configuration that defines explicit paths for network traffic by specifying destination networks and their associated next-hop addresses or exit interfaces, offering predictable and deterministic routing behavior without the overhead of dynamic routing protocols. It supports advanced features including multiple next-hop addresses for load balancing and redundancy, administrative distance adjustment for path preference, route tagging for policy application, and object tracking for conditional route installation based on network reachability. Static routes are essential for simple network topologies, default route configuration, policy routing, and situations requiring precise control over traffic paths without the complexity and resource consumption of dynamic routing protocols.
Diagram
Section titled “Diagram”Classes
Section titled “Classes”routing (iosxe.devices.configuration)
Section titled “routing (iosxe.devices.configuration)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
static_routes | List | [static_routes] | No |
static_routes (iosxe.devices.configuration.routing)
Section titled “static_routes (iosxe.devices.configuration.routing)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
prefix | IP | Yes | ||
mask | IP | Yes | ||
vrf | String | No | ||
next_hops | List | [next_hops] | No |
next_hops (iosxe.devices.configuration.routing.static_routes)
Section titled “next_hops (iosxe.devices.configuration.routing.static_routes)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
ip | IP | Yes | ||
interface_type | Choice | Loopback , Vlan , GigabitEthernet , TwoGigabitEthernet , FiveGigabitEthernet , TenGigabitEthernet , TwentyFiveGigabitEthernet , FortyGigabitEthernet , HundredGigabitEthernet | No | |
interface_id | Integer | No | ||
distance | Integer | min: 1 , max: 255 | No | |
global | Boolean | true , false | No | |
name | String | No | ||
permanent | Boolean | true , false | No | |
tag | Integer | min: 1 , max: 4294967295 | No | |
track_id | Integer | min: 1 , max: 1000 | No |
By manually configuring static routes, you gain precise control and predictable routing behavior for network traffic without dynamic protocol overhead.
Static Route Parameters
Section titled “Static Route Parameters”Key Components:
Destination Network Prefix (
prefix
): The target network for the static route.Subnet Mask (
mask
): The subnet mask for the destination network.Next-Hop IP Address (
next_hops.ip
): The IP address of the next-hop router.Exit Interface (
next_hops.interface
): The outgoing interface for the static route.Administrative Distance (
next_hops.metric
): Sets the preference for the route.Metric (
next_hops.metric
): Optional metric for route selection.Permanent (
next_hops.permanent
): Ensures the route remains in the table even if the next-hop is unreachable.Tag (
next_hops.tag
): Applies a tag for policy routing.Object Tracking (
next_hops.track
): Installs the route conditionally based on object reachability.
Key Parameters Briefly Explained:
prefix
: Destination network.mask
: Subnet mask.next_hops.ip
: Next-hop IP address.next_hops.interface
: Exit interface.next_hops.metric
: Administrative distance or metric.next_hops.permanent
: Route persistence.next_hops.tag
: Policy tag.next_hops.track
: Conditional route installation.
You can use these static route parameters to define explicit paths for network traffic. Customize the destination, next-hop, administrative distance, and other settings to fit your network’s specific routing requirements, policy enforcement, and redundancy needs. Adjusting these parameters lets you tailor traffic flow and ensure predictable routing behavior.
Sample Configuration
Section titled “Sample Configuration”The following configuration describes how to set up static routes on a Cisco IOS-XE device, including basic static routes, default routes, and routes with specific administrative distances or persistence settings for controlled traffic flow.
ip route 192.168.10.0 255.255.255.0 10.0.0.1ip route 192.168.20.0 255.255.255.0 10.0.0.5 100ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0ip route 172.16.1.0 255.255.255.0 10.0.0.10 permanent
Example YAML Code
Section titled “Example YAML Code”The following YAML code defines static routes on an IOS-XE device, specifying the prefix, mask, and next-hop details, including optional metrics and permanence settings.
iosxe: devices: - name: Device1 configuration: routing: static_routes: - prefix: 5.5.5.5 mask: 255.255.255.255 next_hops: - ip: 7.7.7.7 metric: 10 permanent: true - prefix: 4.4.4.4 mask: 255.255.255.255 next_hops: - ip: 8.8.8.8