Skip to content

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

static_routes (iosxr.devices.configuration.routing)

Section titled “static_routes (iosxr.devices.configuration.routing)”
NameTypeConstraintMandatoryDefault Value
address_familyClass[address_family]No
vrfsList[vrfs]No

address_family (iosxr.devices.configuration.routing.static_routes)

Section titled “address_family (iosxr.devices.configuration.routing.static_routes)”
NameTypeConstraintMandatoryDefault Value
ipv4_unicastClass[ipv4_unicast]No
ipv6_unicastClass[ipv6_unicast]No
ipv4_multicastClass[ipv4_multicast]No
ipv6_multicastClass[ipv6_multicast]No

vrfs (iosxr.devices.configuration.routing.static_routes)

Section titled “vrfs (iosxr.devices.configuration.routing.static_routes)”
NameTypeConstraintMandatoryDefault Value
vrf_nameStringYes
address_familyClass[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)”
NameTypeConstraintMandatoryDefault Value
prefixesList[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)”
NameTypeConstraintMandatoryDefault Value
addressIPYes
maskIntegermin: 0, max: 128Yes
next_hopsList[next_hops]No
sr_policiesList[sr_policies]No
vrfsList[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)”
NameTypeConstraintMandatoryDefault Value
interface_nameStringNo
addressIPNo
bfd_fast_detect_minimum_intervalIntegermin: 1, max: 30000No
bfd_fast_detect_multiplierIntegermin: 1, max: 10No
descriptionStringmax: 30No
distanceIntegermin: 1, max: 254No
metricIntegermin: 1, max: 16777214No
permanentBooleantrue, falseNo
tagIntegermin: 1, max: 4294967295No
trackStringNo

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)”
NameTypeConstraintMandatoryDefault Value
sr_policy_nameStringYes
descriptionStringmax: 30No
tagIntegermin: 1, max: 4294967295No
distanceIntegermin: 1, max: 254No
permanentBooleantrue, falseNo
trackStringNo
metricIntegermin: 1, max: 16777214No

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)”
NameTypeConstraintMandatoryDefault Value
vrf_nameStringYes
next_hopsList[next_hops]No
sr_policiesList[sr_policies]No

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 branch

Example-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: 100

Example-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: 300

Example-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: 10

Example-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: 10

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: 10

Example-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: 10

Example-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: 15

Example-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: 15

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 route

Example-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: 10

Example-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: 300

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: 3000

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: 10

Example-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: 15

Example-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