IPv4 static route addition or deletion in a VRF

Prerequisites

You must be in the global configuration context, as indicated by the config prompt.

Procedure
To add an IPv4 static route to a VRF, enter the following command.

ip route <dest-ipv4-addr>/<netmask> {<gateway-ip>|<interface>} vrf [<vrf-name>]

Where
<dest-ipv4-addr>/<netmask>

Specifies the route destination IP address and the network mask length for the destination.

<gateway-ip>|<interface>

Specifies the gateway as either an IP address or an interface.

<vrf-name>

Specifies the VRF name. If no <vrf-name> is specified the route is applied to the default VRF.

Use the no form of the command to remove an IPv4 static route from the VRF.

See the following example:
switch(config)# ip route 20.0.0.0/24 10.0.0.1 vrf test
switch(config)# ip route 20.0.0.0/24 1/1/5 vrf test
switch(config)# no ip route 20.0.0.0/24 10.0.0.1 vrf test

Related topic: ip route vrf (command reference)