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
devicesListdevicesNo
device_groupsListdevice_groupsNo
globalClassglobalNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
routingClassroutingNo

NameTypeConstraintMandatoryDefault Value
static_routesClassstatic_routesNo

static_routes (iosxr.devices.configuration.routing)

Section titled “static_routes (iosxr.devices.configuration.routing)”
NameTypeConstraintMandatoryDefault Value
address_familyClassaddress_familyNo
vrfsListvrfsNo

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

Section titled “address_family (iosxr.devices.configuration.routing.static_routes)”
NameTypeConstraintMandatoryDefault Value
ipv4_unicastClassipv4_unicastNo
ipv6_unicastClassipv6_unicastNo
ipv4_multicastClassipv4_multicastNo
ipv6_multicastClassipv6_multicastNo

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

Section titled “vrfs (iosxr.devices.configuration.routing.static_routes)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
address_familyClassaddress_familyNo

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

Section titled “ipv4_unicast (iosxr.devices.configuration.routing.static_routes.address_family)”
NameTypeConstraintMandatoryDefault Value
prefixesListprefixesNo

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

Section titled “ipv6_unicast (iosxr.devices.configuration.routing.static_routes.address_family)”
NameTypeConstraintMandatoryDefault Value
prefixesListprefixesNo

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

Section titled “ipv4_multicast (iosxr.devices.configuration.routing.static_routes.address_family)”
NameTypeConstraintMandatoryDefault Value
prefixesListprefixesNo

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

Section titled “ipv6_multicast (iosxr.devices.configuration.routing.static_routes.address_family)”
NameTypeConstraintMandatoryDefault Value
prefixesListprefixesNo

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
lengthIntegermin: 0, max: 128Yes
next_hopsListnext_hopsNo
sr_policiesListsr_policiesNo
vrfsListvrfsNo

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
interfaceStringNo
ipIPNo
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
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
nameStringYes
next_hopsListnext_hopsNo
sr_policiesListsr_policiesNo

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
length: 24
next_hops:
- interface: GigabitEthernet0/0/0/1
description: Interface-only route
- address: 10.2.0.0
length: 16
next_hops:
- ip: 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
length: 0
next_hops:
- ip: 192.168.1.1
description: Primary ISP
distance: 1
metric: 100
- ip: 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
length: 24
next_hops:
- interface: GigabitEthernet0/0/0/2
ip: 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
length: 16
next_hops:
- interface: GigabitEthernet0/0/0/3
ip: 192.168.3.1
description: Monitored route
bfd_fast_detect_minimum_interval: 100
bfd_fast_detect_multiplier: 3
metric: 10
- ip: 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
length: 24
vrfs:
- name: CUSTOMER_A
next_hops:
- ip: 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
length: 16
next_hops:
- interface: 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
length: 24
next_hops:
- interface: GigabitEthernet0/0/0/11
ip: 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
length: 16
next_hops:
- interface: GigabitEthernet0/0/0/13
ip: 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
length: 24
vrfs:
- name: MULTICAST_VRF
next_hops:
- interface: GigabitEthernet0/0/0/14
description: VRF multicast interface
metric: 10
- ip: 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::"
length: 48
next_hops:
- interface: 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::"
length: 64
next_hops:
- ip: "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::"
length: 64
next_hops:
- interface: GigabitEthernet0/0/0/2
ip: "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::"
length: 64
next_hops:
- interface: 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:
- name: VRF1
address_family:
ipv4_unicast:
prefixes:
- address: 172.16.0.0
length: 16
next_hops:
- interface: GigabitEthernet0/0/0/1
- address: 10.1.0.0
length: 24
next_hops:
- ip: 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:
- name: VRF1
address_family:
ipv4_unicast:
prefixes:
- address: 10.6.0.0
length: 24
vrfs:
- name: VRF2
next_hops:
- interface: GigabitEthernet0/0/0/5
description: Cross-VRF to VRF2 interface
metric: 10
distance: 1
- ip: 192.168.5.1
description: Cross-VRF to VRF2 gateway
bfd_fast_detect_minimum_interval: 100
bfd_fast_detect_multiplier: 3
metric: 10
- interface: GigabitEthernet0/0/0/6
ip: 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:
- name: MULTICAST_VRF1
address_family:
ipv6_multicast:
prefixes:
- address: "2001:db8:30::1"
length: 128
next_hops:
- ip: "2001:db8:ff05::1"
description: IPv6 specific source
metric: 10