ip route

Adds a static route to the IP routing tables.
Syntax
ip route [ vrf vrf-name ] dest-ip-addr [ next-hop-vrf vrf-name |default-vrf ] next-hop-addr [ metric ] [ bfd ] [ distance distance ] [ name string ] [ tag tag ]
ip route [ vrf vrf-name ] dest-ip-addr { ethernet unit / slot / port | lag lag-id | tunnel tunnel-id | ve vlan-id } [ metric ] [ distance distance ] [ name string ] [ tag tag ]
ip route [ vrf vrf-name ] dest-ip-addr null0 [ distance distance ] [ name string ] [ tag tag ]
no ip route [ vrf vrf-name ] dest-ip-addr [ next-hop-vrf vrf-name |default-vrf ] next-hop-addr [ metric ] [ bfd ] [ distance distance ] [ name string ] [ tag tag ]
no ip route [ vrf vrf-name ] dest-ip-addr { ethernet unit / slot / port | lag lag-id | tunnel tunnel-id | ve vlan-id } [ metric ] [ distance distance ] [ name string ] [ tag tag ]
no ip route [ vrf vrf-name ] dest-ip-addr null0 [ distance distance ] [ name string ] [ tag tag ]
Parameters
vrf vrf-name
Specifies the VRF associated with the destination IPv4 address.
dest-ip-addr
Specifies the destination IPv4 address and mask in the format A.B.C.D/L (where "L" is the prefix-length of the mask) or A.B.C.D P.Q.R.S (where "P.Q.R.S" is the mask value).
next-hop-vrf vrf-name
Specifies the next-hop VRF.
default-vrf
Specifies the next-hop default VRF.
next-hop-addr
Specifies the IPv4 address of the next hop.
metric
Specifies the cost metric of the route. Valid values range from 1 through 16. The default is 1.
bfd
Enables Bidirectional Forwarding Detection (BFD) for the IP static route.
distance distance
Specifies the administrative distance of the route. When comparing otherwise equal routes to a destination, a device prefers lower administrative distances over higher ones. Valid values range from 1 through 255. The default is 1. The value 255 makes the route unusable.
name string
Specifies the static route name. The maximum length of the name is 128 bytes.
tag tag
Specifies the tag value of the route to use for route filtering with a route map. Valid values range from 0 through 4294967295. The default is 0.
ethernet unit/slot/port
Specifies the destination Ethernet port.
lag lag-id
Specifies a LAG interface.
tunnel tunnel-id
Specifies the outgoing interface type as a tunnel.
ve vlan-id
Specifies the outgoing interface type as a VE.
null0
Configures the Layer 3 switch to drop IP packets to a specific network or host address by configuring a "null" (sometimes called "null0") static route for the address.
Modes

Global configuration mode

Usage Guidelines

For a default route, enter 0.0.0.0/0 as the destination IP address followed by the next-hop IP address. Physical or virtual interfaces cannot be used as next hops for a default route.

If you do not want to specify a next-hop IP address, you can instead specify a port or interface number on the device. If you specify an Ethernet port, the device forwards packets destined for the static route’s destination network to the specified interface.

The port or virtual interface you use for the static route’s next hop must have at least one IP address configured on it. The address does not need to be in the same subnet as the destination network.

ICX 7150 and ICX 8100 devices do not support tunnels or VRFs.

When a tunnel is configured as the next hop for a static route, the tunnel must already be configured if the destination is a non-default VRF. In contrast, a tunnel can be designated as the next hop in the default VRF before it is configured. The default VRF is used when no VRF is specified in the command.

Use the ip route bfd command to create a BFD session.

The ip route bfd command is supported for ICX 7850 devices only.

The no form of the command, followed by the route identifier, removes a static route. If the static route includes a name, you must enter the no form of the command twice (once to remove the name, and then to remove the route from the routing table).

Examples

The following example configures inter-VRF route leaking by specifying the next-hop VRF.

device# configure terminal
device(config)# ip route vrf 1 33.1.1.0/24 next-hop-vrf 2 131.1.1.3

The following example configures inter-VRF route leaking by specifying the outgoing interface of another VRF.

device# configure terminal
device(config)# ip route 32.32.32.32 255.255.255.255 ve 100
Info: Outgoing interface vrf red is different from route vrf default-vrf

The following example configures a static route to 10.95.7.0, using 10.95.6.157 as the next-hop gateway.

device# configure terminal
device(config)# ip route vrf 4 10.95.7.0/24 next-hop-vrf 6  10.95.6.157
 

The following example configures a default route through next-hop IP address 10.2.12.1.

device# configure terminal
device(config)# ip route 0.0.0.0/0  next-hop-vrf vrf5  10..2.12.1
 

The following example configures a static route with an Ethernet interface as the destination.

device# configure terminal
device(config)# ip route 10.128.2.69 255.255.255.0 ethernet 1/4/1
 

The following example configures a null static route to drop packets destined for network 10.157.22.x.

device# configure terminal
device(config)# ip route 10.157.22.0 255.255.255.0 null0
 

The following example configures tunnel 1 as the next-hop gateway. The tunnel is configured in the default VRF.

device# configure terminal
device(config)# ip route 10.1.1.0/24 tunnel 1

The following example configures tunnel 5 as the next-hop gateway in a non-default VRF, as long as the tunnel already exists.

device# configure terminal
device(config)# ip route vrf 1 10.1.5.0/24 tunnel 5

The following example configures BFD for an IP static route.

device# configure terminal
device(config)# ip route 10.10.7.0/24 10.10.6.157 bfd
 
History
Release version Command history
08.0.90 This command was modified to add the bfd keyword.
08.0.95 This command was modified to add the next-hop-vrfvrf-name and default-vrf options.