Routing Configuration Guide for Cisco 8000 Series Routers, Cisco IOS XR Release

PDF

Configuration examples

Want to summarize with AI?

Log in

Introduces example configurations that show how to deploy static routing in common scenarios.


This section provides additional configuration examples for specific scenarios.


Configure a static route

You can configure static routes to point to a next hop interface, next hop IP address, or both. If you specify an interface, the static route is installed in the Routing Information Base (RIB) when the interface is reachable. If you do not specify an interface, the route is installed when the next hop address is reachable. When you configure a static route with the permanent attribute, it is installed in RIB regardless of reachability.

Tip

You can programmatically configure and view the operational state of the static route using openconfig-local-routing.yang or openconfig-network-instance.yang OpenConfig data models. To get started with using data models, see the Programmability Configuration Guide for Cisco 8000 Series Routers .

Use this task to configure a static route.

Procedure

1.

In static route configuration mode, configure the VRF.

Example:


Router# configure
Router(config)# router static 
Router(config-static)# vrf vrf_A
Router(config-static-vrf)# 

If a VRF is not specified, the static route is configured under the default VRF.

2.

In address family mode, configure an administrative distance of 110.

A default static route is often used in simple router topologies. This example shows how to route packets for network 10.0.0.0 through to a next hop at 192.0.2.1 if dynamic information with administrative distance less than 110 is not available.

Example:


Router(config-static-vrf)# address family ipv4 unicast
Router(config-static-vrf-afi)# 10.0.0.0/8 192.0.2.1 110
Router(config-static-vrf-afi)# commit

Associate a VRF with a static route

Use this task to associate a VRF with a static route.

Procedure

1.

In static route configuration mode, configure the VRF.

Example:


Router# configure
Router(config)# router static 
Router(config-static)# vrf vrf_A
Router(config-static-vrf)# 
2.

In address family mode, configure an administrative distance of 201.

Example:


Router(config-static-vrf)# address family ipv6 unicast
Router(config-static-vrf-afi)# 2001:0DB8::/32 2001:0DB8:3000::1 201
3.

Bind the interface to the VRF.

Ensure that the interface name exactly matches the VRF name configured earlier.

Example:

Router(config)# interface FourHundredGigE 0/5/0/0

Configure a static route between PE-CE routers

Use this task to configure static routing between PE and CE routers.

Note

The system does not support VRF fallback with IPv6 VPN Provider Edge (6VPE).

Procedure

1.

In static route configuration mode, configure the VRF.

Example:


Router# configure
Router(config)# router static 
Router(config-static)# vrf vrf_A
Router(config-static-vrf)# 
2.

In address family mode, configure an administrative distance of 201.

Example:


Router(config-static-vrf)# address family ipv4 unicast
Router(config-static-vrf-afi)# 0.0.0.0/0 192.0.2.1 120
Router(config-static-vrf-afi)# end

In this example, a static route between PE and CE routers is configured, and a VRF is associated with the static route:


  configure
   router static
    vrf vrf_A
    address-family ipv4 unicast 
    0.0.0.0/0 192.0.2.1 120
    end

Change maximum number of allowable static routes

Before you begin

Note

By default, you can configure up to 4000 static routes on a router for each address family. You can raise or lower the limit using the maximum path command.

If the maximum number of static routes for an address family is reduced below the currently configured number, the system rejects the change. If you commit a batch of routes that would exceed the maximum allowed, the first n routes are accepted, and the remainder are rejected. The value of n is the difference between the maximum number allowed and the number previously configured.

Use this task to change the maximum number of allowable static routes.

Procedure

Run the maximum path command in static route configuration mode to change the maximum number of static routes allowed.

  • Specify IPv4 or IPv6 address prefixes.

  • Specify the maximum number of static routes for the given address family. The range is from 1 to 140,000.

  • This example sets the maximum number of static IPv4 routes to 10,000.

Example:

Router(config)# router static
Router(config-static)# maximum path ipv4 10000

You can configure a static route to use the null 0 interface to discard traffic for a specific prefix. To discard all traffic to the prefix 2001:0DB8:42:1/64, define this static route:


  configure 
   router static
    address-family ipv6 unicast 
    2001:0DB8:42:1::/64 null 0 
    end
  

Configure native UCMP for static routing

Native UCMP enables effective load balancing by assigning lower metrics to higher bandwidth links, ensuring traffic is distributed according to link capacity. This approach supports both IPv4 and IPv6 static routes in virtual routing and forwarding (VRF) contexts and is preferred for multi-hop destinations.

Native UCMP:

  • ensures higher-bandwidth links are utilized efficiently

  • supports both local and native UCMP configurations, and

  • applies to static routing scenarios requiring proportional traffic distribution.

In networks with multiple links, configuring equal metrics creates ECMP next hops, which may underutilize higher bandwidth links. Native UCMP addresses this by considering bandwidth during load balancing, especially for multi-hop destinations.

  • Local UCMP uses equal metrics and does not consider bandwidth for multi-hop links.

  • Native UCMP matches link metrics with end-to-end bandwidth for optimal load balancing.

Before you begin

Ensure you have access to the device CLI and appropriate privileges to configure static routing. Identify the interfaces and bandwidths for all links involved in the load balancing configuration.

Procedure

1.

Configure UCMP with load metric for IPv4 or IPv6 address family in static routing mode.

Example:

Router# configure
Router(config)# router static 
Router(config-static)# address-family ipv4 unicast
Router(config-static-afi)# 10.10.10.1/32 FourHundredGigE 0/5/0/0 metric 10

For IPv6 address family, use the following sample configuration:

Router(config-static)# address-family ipv6 unicast 
Router(config-static-afi)# 10:10::1/64 FourHundredGigE0/5/0/0 metric 10
2.

Exit the static configuration mode and commit your configuration.

Example:

Router(config-static-afi)# exit
Router(config-static)# exit
Router(config)# commit
ipv4_static[1044]: %ROUTING-IP_STATIC-4-CONFIG_NEXTHOP_ETHER_INTERFACE : 
Route for 10.10.10.1 is configured via ethernet interface 

Repeat this procedure on each router that you want to configure with native UCMP.

Native UCMP is configured for static routing, enabling proportional load balancing across links based on bandwidth. Higher bandwidth links will carry more traffic, optimizing network utilization.

Any static route does not have a default route installed. This example provides the static route configuration without the default metric specified.
router static
address-family ipv4 unicast
198.51.100.0/24 198.51.100.1
203.0.113.0/24 192.0.2.2
203.0.113.0/24 192.0.2.6 metric 100
Specify the metric value explicitly to achieve UCMP load balancing. This static route configuration example includes the default metric value.
router static
address-family ipv4 unicast
198.51.100.0/24 198.51.100.1
203.0.113.0/24 192.0.2.2 metric 1
203.0.113.0/24 192.0.2.6 metric 100

What to do next

  • Verify the routing table to confirm that the correct metrics are used for static routes.

  • Monitor traffic distribution to ensure load balancing is functioning as expected.