Configuring Static Routes

Before you begin

  • Ensure no black hole static route exists.

About this task

Configure a static route when you want to manually create a route to a destination IP address.

Note

Note

When you configure a static route with a next-hop-vrf context, you can specify a next-hop IP address that is a locally owned VRRP IP address of the system itself. However, this is not a supported configuration. The best practice is to implement an alternative method of inter-vrf route sharing, such as route redistribution or ISIS accept polices.

If a black hole route is enabled, you must first delete or disable it before you can add a regular static route to that destination.

For route scaling information and for information on the maximum number of static routes supported on your hardware platform, see Release Notes for VOSS.

Note

Note

As a best practice, do not configure static routes on a DvR Leaf node unless the configuration is for reachability to a management network using a Brouter port.

You cannot configure the preference of static routes on a Leaf node.

Procedure

  1. Enter either Global Configuration mode or VRF Router Configuration mode for a specific VRF context:

    enable

    configure terminal

    Optional: router vrf WORD<1-16>

  2. Create an IP static route:

    ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> weight <1–65535>

  3. Enable an IP static route:

    ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> enable

  4. Use the following variable definitions table to configure other static route parameters as required.
  5. View existing IP static routes for the device, or for a specific network or subnet:

    show ip route static

  6. Delete a static route:

    no ip route <A.B.C.D> <A.B.C.D> <A.B.C.D>

Example

Create an IP static route, enable a static route, and view the existing IP static routes for the device, or for a specific network or subnet.

Switch:1>enable
Switch:1#configure terminal
Switch:1(config)#ip route 192.0.2.2 255.255.0.0 198.51.100.24 weight 20 name ExtSer 10 preference 1
Switch:1(config)#ip route 192.0.2.2 255.255.0.0 198.51.100.24 enable
Switch:1(config)#show ip route static
=================================================================================================
                          IP Static Route - GlobalRouter
=================================================================================================

DEST       MASK          NEXT           NH-VRF      COST PREF LCLNHOP STATUS ENABLE NAME
-------------------------------------------------------------------------------------------------

192.0.2.2  255.255.255.0 198.51.100.24  GlobalRouter 20   1   TRUE    ACTIVE TRUE   ExtSer 10

Variable definitions

Use the data in the following table to use the ip route command.

Table 1. Variable definitions

Variable

Value

<A.B.C.D> <A.B.C.D> <A.B.C.D>

The first and second <A.B.C.D> specify the IP address and mask for the route destination. The third <A.B.C.D> specifies the IP address of the next-hop router (the next router at which packets must arrive on this route). When you create a black hole static route, configure this parameter to 255.255.255.255 as the IP address of the router through which the specified route is accessible.

disable

Disables a route to the router or VRF.

enable

Adds a static route to the router or VRF.

The no form of this command is no ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> enable.

The default form of this command is default ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> enable.

local-next-hop enable

Enables the local next hop for this static route. The default form of this command is default ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> local-next-hop enable.

The no form of this command is no ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> local-next-hop enable.

next-hop-vrf <WORD 0-16>

Specifies the next-hop VRF instance by name.

After you configure the next-hop-vrf parameter, the static route is created in the local VRF, and the next-hop route is resolved in the next-hop VRF instance (next-hop-vrf).

The default form of this command is default ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> next-hop-vrf <WORD 0-16>.

The no form of this command is no ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> next-hop-vrf <WORD 0-16>.

weight <1-65535>

Specifies the static route cost.

The default form of this command is default ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> weight.

Note:

Do not configure a static interface subnet route with a weight of 1.

name <1-64>

Specifies the name of the static route. You can name the route before or after it is created.

Only 32 characters display. The tilde (~) symbol indicates that the name is truncated.

preference <1-255>

Specifies the route preference.

The default form of this command is default ip route <A.B.C.D> <A.B.C.D> <A.B.C.D> preference.

Use the data in the following table to use the show ip route static command.

Table 2. Variable definitions

Variable

Value

<A.B.C.D>

Specifies the route by IP address.

-s { <A.B.C.D> <A.B.C.D> | default}

Specifies the route by IP address and subnet mask.

vrf WORD<0-16>

Specifies a VRF by name.

vrfids WORD<0-512>

Specifies a range of VRF IDs.

name <1-64>

Specifies the name of the static route. You can name the route before or after it is created.

Only 32 characters display. The tilde (~) symbol indicates that the name is truncated.