IPv4/IPv6 static routes configuration
ip route
This command creates a static IP route to the specified subnet.
The use of a negative form (no) of the command removes a specified route.
Syntax
ip route [ vrf <VRF> ] <SUBNET> { { <NEXTHOP> [ resolve ] [ bfd ] | interface <IF> | tunnel <TUN> | blackhole | unreachable | prohibit } [ track <TRACK-ID> ] [ name <NAME>] } | wan load-balance rule <RULE> } [ <METRIC> ] no ip route [ vrf <VRF> ] <SUBNET> [ <METRIC> ]
Parameters
<VRF> – VRF name, set by the string of up to 31 characters.
<SUBNET> – destination address, can be specified in the following formats:
- BBB.CCC.DDD – host IP address, where each part takes values of [0..255].
- BBB.CCC.DDD/NN – network IP address with prefix mask, where AAA-DDD take values of [0..255] and NN takes values of [1..32].
<NEXTHOP> – gateway IP address, defined as AAA.BBB.CCC.DDD where each part takes values of [0..255].
resolve – when specifying this parameter, gateway IP address will be recursively calculated through the routing table. If the recursive calculation fails to find a gateway from a directly connected subnet, then this route will not be installed into the system.
<IF> – an IP interface name specified in the form described in Section Types and naming order of router interfaces.
<TUN> – the name of the tunnel is specified as described in section Types and naming order of router tunnels.
<RULE> – wan rule number, set in the range of [1..50].
blackhole – when specifying the command, the packets to this subnet will be removed by the device without sending notifications to a sender;
unreachable – when specifying the command, the packets to this subnet will be removed by the device, a sender will receive in response ICMP Destination unreachable (Host unreachable, code 1);
prohibit – when specifying the command, the packets to this subnet will be removed by the device, a sender will receive in response ICMP Destination unreachable (Communication administratively prohibited, code 13);
<METRIC> – route metric, takes values of [0..255].
<TRACK-ID> – Tracking object identifier. If the router is bound to the Tracking object, it will appear in the system only after meeting all requirements specified in the object.
<NAME> – name (description) of the route, text variable up to 31 characters long.
bfd – when specifying this key, the removal of static route in case of next-hop unavailability is activated. For operation of this mechanism, the BFD mechanism must be running with the IP address of the next-hop (see section ip bfd neighbor).
next-hop check using bfd protocol. If next-hop is unavailable, the route is deleted.
If 0.0.0.0/0 is specified as the subnet, then the default route will be set.
Required privilege level
10
Command mode
CONFIG
Example 1
Set the route to the subnet 192.165.3.0/24 with metric 6 through the gateway 192.165.56.65:
esr(config)# ip route 192.165.3.0/24 192.165.56.65 6
Example 2
Set the route to the subnet 192.165.3.0/24 with metric 6 through the GigabitEthernet 1/0/5 interface:
esr(config)# ip route 192.165.3.0/24 interface gigabitethernet 1/0/5 6
Example 3
Set the route to the subnet 192.165.3.0/24 through the tunnel interface vti 1:
esr(config)# ip route 192.165.3.0/24 interface vti 1
ipv6 route
This command creates a static IPv6 route to the specified subnet.
The use of a negative form (no) of the command removes a specified route.
Syntax
ipv6 route [ vrf <VRF> ] <SUBNET> { { <NEXTHOP> [ resolve ] [bfd] | interface <IF> | blackhole | unreachable | prohibit [ <METRIC> ] [ name <NAME>] } | wan load-balance rule <RULE> [ <METRIC> ] }
no ipv6 route [ vrf <VRF> ] <SUBNET> [ <METRIC> ]
Parameters
<VRF> – VRF name, set by the string of up to 31 characters.
<SUBNET> – destination address, can be specified in the following formats:
- The addresses are defined as X:X:X:X::X where each part takes values in hexadecimal format [0..FFFF].
- <IPV6-ADDR/LEN> – IP address and mask of a subnet, defined as X:X:X:X::X/EE where each X part takes values in hexadecimal format [0..FFFF] and EE takes values of [1..128].
<IPV6-ADDR> – client IPv6 address, defined as X:X:X:X::X where each part takes values in hexadecimal format [0..FFFF].
resolve – when specifying this parameter, gateway IPv6 address will be recursively calculated through the routing table. If the recursive calculation fails to find a gateway from a directly connected subnet, then this route will not be installed into the system.
<IF> – an IP interface name specified in the form described in Section Types and naming order of router interfaces.
blackhole – when specifying the command, the packets to this subnet will be removed by the device without sending notifications to a sender.
unreachable – when specifying the command, the packets to this subnet will be removed by the device, a sender will receive in response ICMP Destination unreachable (Host unreachable, code 1).
prohibit – when specifying the command, the packets to this subnet will be removed by the device, a sender will receive in response ICMP Destination unreachable (Communication administratively prohibited, code 13).
<METRIC> – route metric, takes values of [0..255].
<NAME> – name (description) of the route, text variable up to 31 characters long.
bfd - when specifying this key, the next-hop check is activated using the bfd protocol. If next-hop is unavailable, the route is deleted.
If ::/0 is specified as the subnet, then the default route will be set.
Required privilege level
10
Command mode
CONFIG
Example 1
Set the route to the subnet 2001:/120 with metric 6 through the gateway fc00::1:
esr(config)# ipv6 route 2001::/120 fc00::1 6
Example 2
Set the route to the subnet 2001::/120 with metric 6 through the GigabitEthernet 1/0/5 interface:
esr(config)# ipv6 route 2001::/120 interface gigabitethernet 1/0/5 6
Example 3
Set the route to the subnet 2001::/120 through the tunnel interface vti 1:
esr(config)# ipv6 route 2001::/120 interface vti 1