ip route
Use this command to create an IPv4 static route.
Use the no form of this command to delete a static route.
Note: ECMP static route with one nexthop in local vrf and the other nexthop in inter vrf is not supported and IVRF static ECMP is not supported.
Command Syntax
ip route A.B.C.D/M (A.B.C.D|IFNAME)
ip route A.B.C.D A.B.C.D (A.B.C.D|IFNAME)
ip route A.B.C.D/M (A.B.C.D|IFNAME){<1-255>|tag <0-4294967295>|description WORD}{<track <1-500>}
ip route A.B.C.D A.B.C.D (A.B.C.D|IFNAME){<1-255>|tag <0-4294967295>|description WORD}{<track <1-500>}
ip route vrf NAME A.B.C.D/M IFNAME
ip route vrf NAME A.B.C.D/M A.B.C.D IFNAME
ip route vrf NAME A.B.C.D/M (A.B.C.D|IFNAME) global {<track <1-500>}
ip route vrf NAME A.B.C.D/M IFNAME {<1-255>|tag <0-4294967295>|description WORD} {<track <1-500>}
ip route vrf NAME A.B.C.D/M A.B.C.D IFNAME {<1-255>|tag <0-4294967295>|description WORD}{<track <1-500>}
no ip route A.B.C.D/M (A.B.C.D|IFNAME|)
no ip route A.B.C.D A.B.C.D (A.B.C.D|IFNAME)
no ip route A.B.C.D/M (A.B.C.D|IFNAME){<1-255>|tag <0-4294967295>|description WORD}{<track <1-500>}
no ip route A.B.C.D A.B.C.D (A.B.C.D|IFNAME){<1-255>|tag <0-4294967295>|description WORD} {<track <1-500>}
no ip route vrf NAME A.B.C.D/M IFNAME
no ip route vrf NAME A.B.C.D/M A.B.C.D IFNAME
no ip route vrf NAME A.B.C.D/M IFNAME {<1-225>|tag <0-4294967295>|description WORD}{<track <1-500>}
no ip route vrf NAME A.B.C.D/M A.B.C.D IFNAME {<1-255>|tag <0-4294967295>|description WORD}{<track <1-500>}
Parameters
A.B.C.D/M
Subnet: IP destination prefix and a mask length
A.B.C.D A.B.C.D
Subnet: IP destination address and mask
A.B.C.D
Gateway nexthop IPv4 address
global
Global table lookup (to support inter-VRF static route leaking)
<1-255>
Administrative distance
IFNAME
Gateway nexthop interface name
track
Tracking-id to ipv4 static route
<1-500>
Identifier for the tracked object
description
Description of the static route maximum 80 character
tag
Tag used as a “match” value to control redistribution via route maps
<0-4294967295>
Tag value
vrf
VRF (Virtual Routing and Forwarding) instance
NAME
VRF name
Default
By default, no static IPv4 route configured
Command Mode
Configure mode
Applicability
This command was introduced before OcNOS version 1.3 and was updated in OcNOS version 1.3.4.
The Track command is introduced in OcNOS version 5.1.
Examples
#configure terminal
(config)#ip route 192.168.3.0 255.255.255.0 2.2.2.2 128
(config)#ip route 1.1.1.0/24 eth0 32
(config)#ip route vrf new 1.1.1.1/1 1.1.1.1 eth1 description new tag 1
(config)# ip route 40.1.1.0/24 eth1 track 10
(config-object-track)#commit
(config)#no ip route 40.1.1.0/24 eth1 track 10
(config)#commit
This example creates VRF static routes with the nexthops belonging to the default VRF. The nexthop gateway address can be the IFNAME network address or any other IP address reachable via IFNAME.
#show ip route vrf
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area,
v - vrf leaked
* - candidate default
IP Route Table for VRF "default"
C 10.12.19.0/24 is directly connected, eth0, 4d23h06m
C 11.1.1.0/24 is directly connected, eth4, 4d23h01m
C 13.13.13.0/31 is directly connected, eth3, 4d23h06m
C 50.5.5.0/24 is directly connected, eth3, 4d23h06m
C 100.100.100.0/24 is directly connected, lo, 4d23h06m
O 101.1.1.1/32 [110/11] via 11.1.1.2, eth4, 19:20:39
C 127.0.0.0/8 is directly connected, lo, 4d23h06m
Gateway of last resort is not set
(config)#ip route vrf vrf1 201.201.201.201/32 11.1.1.11 eth4 global
(config)#ip route vrf vrf1 202.202.202.202/32 101.1.1.1 eth4 global
#show ip route vrf vrf1 static
IP Route Table for VRF "vrf1"
S v201.201.201.201/32 [1/0] via 11.1.1.11, eth4, 00:00:44
S v202.202.202.202/32 [1/0] via 101.1.1.1, eth4 (recursive via 11.1.1.2), 00:00:17
Gateway of last resort is not set
#configure terminal
(config)#ip route vrf vrf1 20.2.2.0/24 xe1 global
(config)#commit
(config)#no ip route vrf vrf1 20.2.2.0/24 xe1 global track 10
(config)#commit