Skip to content

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
NameTypeConstraintMandatoryDefault Value
static_routesList[static_routes]No

static_routes (iosxe.devices.configuration.routing)

Section titled “static_routes (iosxe.devices.configuration.routing)”
NameTypeConstraintMandatoryDefault Value
prefixIPYes
maskIPYes
vrfStringNo
next_hopsList[next_hops]No

next_hops (iosxe.devices.configuration.routing.static_routes)

Section titled “next_hops (iosxe.devices.configuration.routing.static_routes)”
NameTypeConstraintMandatoryDefault Value
ipIPYes
interface_typeChoiceLoopback, Vlan, GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigabitEthernet, FortyGigabitEthernet, HundredGigabitEthernetNo
interface_idIntegerNo
distanceIntegermin: 1, max: 255No
globalBooleantrue, falseNo
nameStringNo
permanentBooleantrue, falseNo
tagIntegermin: 1, max: 4294967295No
track_idIntegermin: 1, max: 1000No

By manually configuring static routes, you gain precise control and predictable routing behavior for network traffic without dynamic protocol overhead.

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.

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.1
ip route 192.168.20.0 255.255.255.0 10.0.0.5 100
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0
ip route 172.16.1.0 255.255.255.0 10.0.0.10 permanent

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