Router Static
Static routes provide explicit paths through the network for IP traffic and are useful for simple network topologies, backup routes, or when dynamic routing protocols are not suitable.
Diagram
Section titled “Diagram”Classes
Section titled “Classes”routing (iosxr.devices.configuration)
Section titled “routing (iosxr.devices.configuration)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| static_routes | Class | [static_routes] | No |
static_routes (iosxr.devices.configuration.routing)
Section titled “static_routes (iosxr.devices.configuration.routing)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| address_family | Class | [address_family] | No | |
| vrfs | List | [vrfs] | No |
address_family (iosxr.devices.configuration.routing.static_routes)
Section titled “address_family (iosxr.devices.configuration.routing.static_routes)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| ipv4_unicast | Class | [ipv4_unicast] | No | |
| ipv6_unicast | Class | [ipv6_unicast] | No | |
| ipv4_multicast | Class | [ipv4_multicast] | No | |
| ipv6_multicast | Class | [ipv6_multicast] | No |
vrfs (iosxr.devices.configuration.routing.static_routes)
Section titled “vrfs (iosxr.devices.configuration.routing.static_routes)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| vrf_name | String | Yes | ||
| address_family | Class | [address_family] | No |
ipv4_unicast (iosxr.devices.configuration.routing.static_routes.address_family)
Section titled “ipv4_unicast (iosxr.devices.configuration.routing.static_routes.address_family)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| prefixes | List | [prefixes] | No |
prefixes (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast)
Section titled “prefixes (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| address | IP | Yes | ||
| mask | Integer | min: 0, max: 128 | Yes | |
| next_hops | List | [next_hops] | No | |
| sr_policies | List | [sr_policies] | No | |
| vrfs | List | [vrfs] | No |
next_hops (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast.prefixes)
Section titled “next_hops (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast.prefixes)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| interface_name | String | No | ||
| address | IP | No | ||
| bfd_fast_detect_minimum_interval | Integer | min: 1, max: 30000 | No | |
| bfd_fast_detect_multiplier | Integer | min: 1, max: 10 | No | |
| description | String | max: 30 | No | |
| distance | Integer | min: 1, max: 254 | No | |
| metric | Integer | min: 1, max: 16777214 | No | |
| permanent | Boolean | true, false | No | |
| tag | Integer | min: 1, max: 4294967295 | No | |
| track | String | No |
sr_policies (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast.prefixes)
Section titled “sr_policies (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast.prefixes)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| sr_policy_name | String | Yes | ||
| description | String | max: 30 | No | |
| tag | Integer | min: 1, max: 4294967295 | No | |
| distance | Integer | min: 1, max: 254 | No | |
| permanent | Boolean | true, false | No | |
| track | String | No | ||
| metric | Integer | min: 1, max: 16777214 | No |
vrfs (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast.prefixes)
Section titled “vrfs (iosxr.devices.configuration.routing.static_routes.address_family.ipv4_unicast.prefixes)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| vrf_name | String | Yes | ||
| next_hops | List | [next_hops] | No | |
| sr_policies | List | [sr_policies] | No |
IPv4 Unicast Static Route Examples
Section titled “IPv4 Unicast Static Route Examples”Example-1: Configure basic static routes with different nexthop types.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv4_unicast: prefixes: - address: 10.1.1.0 mask: 24 next_hops: - interface_name: GigabitEthernet0/0/0/1 description: Interface-only route - address: 10.2.0.0 mask: 16 next_hops: - address: 192.168.1.254 description: Gateway to branchExample-2: Configure default route with load balancing.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv4_unicast: prefixes: - address: 0.0.0.0 mask: 0 next_hops: - address: 192.168.1.1 description: Primary ISP distance: 1 metric: 100 - address: 192.168.1.2 description: Backup ISP distance: 2 metric: 100Example-3: Configure static routes with interface and address nexthop.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv4_unicast: prefixes: - address: 10.3.0.0 mask: 24 next_hops: - interface_name: GigabitEthernet0/0/0/2 address: 192.168.2.1 description: Point-to-point link tag: 300Example-4: Configure static routes with BFD monitoring.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv4_unicast: prefixes: - address: 172.16.0.0 mask: 16 next_hops: - interface_name: GigabitEthernet0/0/0/3 address: 192.168.3.1 description: Monitored route bfd_fast_detect_minimum_interval: 100 bfd_fast_detect_multiplier: 3 metric: 10 - address: 192.168.3.2 description: Backup path distance: 50 metric: 10Example-5: Configure static routes with VRF nexthops.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv4_unicast: prefixes: - address: 192.168.100.0 mask: 24 vrfs: - vrf_name: CUSTOMER_A next_hops: - address: 172.16.1.1 description: Management gateway distance: 10IPv4 Multicast Static Route Examples
Section titled “IPv4 Multicast Static Route Examples”Static multicast routes define the Reverse Path Forwarding (RPF) interface for multicast sources, ensuring proper multicast traffic flow. These routes are essential for multicast routing when dynamic multicast routing protocols like PIM are not available or when explicit RPF paths are required.
Example-1: Basic IPv4 multicast route with interface nexthop.
iosxr: devices: - name: router-1 host: 10.122.20.77 configuration: hostname: router-1 routing: static_routes: address_family: ipv4_multicast: prefixes: - address: 10.10.0.0 mask: 16 next_hops: - interface_name: GigabitEthernet0/0/0/10 description: Multicast upstream interface metric: 10Example-2: IPv4 multicast route with interface and address nexthop with BFD.
iosxr: devices: - name: router-1 host: 10.122.20.77 configuration: hostname: router-1 routing: static_routes: address_family: ipv4_multicast: prefixes: - address: 10.20.1.0 mask: 24 next_hops: - interface_name: GigabitEthernet0/0/0/11 address: 10.20.20.1 description: Multicast with BFD bfd_fast_detect_minimum_interval: 100 bfd_fast_detect_multiplier: 3 metric: 10Example-3: Source Specific Multicast (SSM) source route with BFD and tag.
iosxr: devices: - name: router-1 host: 10.122.20.77 configuration: hostname: router-1 routing: static_routes: address_family: ipv4_multicast: prefixes: - address: 10.40.0.0 mask: 16 next_hops: - interface_name: GigabitEthernet0/0/0/13 address: 10.40.40.1 description: SSM upstream bfd_fast_detect_minimum_interval: 200 bfd_fast_detect_multiplier: 4 tag: 1000 metric: 15Example-4: IPv4 multicast with VRF nexthops.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv4_multicast: prefixes: - address: 10.50.3.0 mask: 24 vrfs: - vrf_name: MULTICAST_VRF next_hops: - interface_name: GigabitEthernet0/0/0/14 description: VRF multicast interface metric: 10 - address: 10.50.50.1 description: VRF multicast gateway bfd_fast_detect_minimum_interval: 100 bfd_fast_detect_multiplier: 3 metric: 15IPv6 Unicast Static Route Examples
Section titled “IPv6 Unicast Static Route Examples”Static routes provide explicit paths through the network for IPv6 traffic and are useful for simple network topologies, backup routes, or when dynamic routing protocols are not suitable. IPv6 static routes support interface-only nexthops, global unicast addresses, and link-local addresses.
Example-1: Basic IPv6 static route with interface nexthop.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv6_unicast: prefixes: - address: "2001:db8:10::" mask: 48 next_hops: - interface_name: GigabitEthernet0/0/0/1 description: IPv6 interface-only routeExample-2: IPv6 static route with global unicast address nexthop.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv6_unicast: prefixes: - address: "2001:db8:20::" mask: 64 next_hops: - address: "2001:db8:ff::1" description: IPv6 gateway to branch metric: 10Example-3: IPv6 static route with interface and link-local address.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: address_family: ipv6_unicast: prefixes: - address: "2001:db8:30::" mask: 64 next_hops: - interface_name: GigabitEthernet0/0/0/2 address: "fe80::1" description: IPv6 link-local nexthop tag: 300IPv6 Multicast Static Route Examples
Section titled “IPv6 Multicast Static Route Examples”Static IPv6 multicast routes define the Reverse Path Forwarding (RPF) interface for IPv6 multicast sources, ensuring proper multicast traffic flow. These routes are essential for IPv6 multicast routing when dynamic multicast routing protocols are not available or when explicit RPF paths are required.
Example-1: IPv6 SSM source with tag.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: hostname: router-1 routing: static_routes: address_family: ipv6_multicast: prefixes: - address: "2001:db8:50::" mask: 64 next_hops: - interface_name: GigabitEthernet0/0/0/23 description: IPv6 SSM upstream metric: 10 tag: 3000VRF Static Route Examples
Section titled “VRF Static Route Examples”VRF static routes provide explicit paths for traffic within specific VRF contexts, enabling network segmentation and multi-tenancy. These routes support cross-VRF nexthops for inter-VRF routing scenarios and different address-families.
Example-1: Basic VRF static routes with interface and address nexthops.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: vrfs: - vrf_name: VRF1 address_family: ipv4_unicast: prefixes: - address: 172.16.0.0 mask: 16 next_hops: - interface_name: GigabitEthernet0/0/0/1 - address: 10.1.0.0 mask: 24 next_hops: - address: 192.168.1.1 description: Gateway in VRF1 metric: 10Example-2: Cross-VRF static route with nexthops in different VRF.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: vrfs: - vrf_name: VRF1 address_family: ipv4_unicast: prefixes: - address: 10.6.0.0 mask: 24 vrfs: - vrf_name: VRF2 next_hops: - interface_name: GigabitEthernet0/0/0/5 description: Cross-VRF to VRF2 interface metric: 10 distance: 1 - address: 192.168.5.1 description: Cross-VRF to VRF2 gateway bfd_fast_detect_minimum_interval: 100 bfd_fast_detect_multiplier: 3 metric: 10 - interface_name: GigabitEthernet0/0/0/6 address: 11.11.11.3 description: XRF to VRF2 intf-addr bfd_fast_detect_minimum_interval: 200 bfd_fast_detect_multiplier: 4 metric: 15Example-3: VRF IPv6 specific source host with global unicast address.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: routing: static_routes: vrfs: - vrf_name: MULTICAST_VRF1 address_family: ipv6_multicast: prefixes: - address: "2001:db8:30::1" mask: 128 next_hops: - address: "2001:db8:ff05::1" description: IPv6 specific source metric: 10