Add a Cost Metric or Administrative Distance to an IPv4 Static Route

You can influence route preference by adding a cost metric or an administrative distance to a static route.

About this task

The device replaces a static route if it receives a route to the same destination with a lower administrative distance.

Procedure

  1. Access global configuration mode.
    device# configure terminal
    
  2. Designate the route destination, the next hop, and the route priority.
    OptionDescription
    Cost metric The value is compared to the metric for other static routes in the IPv4 route table to the same destination. Two or more routes to the same destination with the same metric load share traffic to the destination. The value may range from 1 through 16. The default is 1. A route with a cost of 16 is considered unreachable.
    Administrative distance This value is compared to the administrative distance of all routes to the same destination. Static routes by default take precedence over learned protocol routes. However, to give a static route a lower priority than a dynamic route, give the static route the higher administrative distance. The value is preceded by the keyword distance and can range from 1 to 254. The default is 1. A value of 255 is considered unreachable.
    device(config)# ip route 10.128.2.71/24 10.111.10.1 distance 10
    
    This example configures a static route with an administrative distance of 10.

Example

This example configures a static route with an administrative distance of 3.

device(config)# ip route 10.0.0.0/24 10.111.10.1 distance 3

Example

This example configures a static route with a cost metric of 2.

device(config)# ip route 10.128.2.69/24 10.111.10.1 2