ip route ip address
This command configures routing rules.
Syntax
ip route <ip address> <ip destination mask> [next-hop ip address] <interface> <interface ID> [<metric value>] [track <track id>] [bfd-neighbor <neighbor ID>] [output-vrf <vrf_id>] [description <string>]
Command |
Description |
---|---|
ip address |
Defines IP Destination prefix in the format of a.b.c.d. |
ip destination mask |
Defines the IP Destination prefix mask. |
interface |
Defines source interface name and id. |
metric |
Defines the metric (priority) value for this route (0-255). |
next-hop |
Defines the next hop for routing |
track |
Defines the track to be used for this route. Up to two tracking objects can be configured (track <first track number> track <second track number>) and in this scenario, the route will only be active if both tracking objects are in "up" state. |
output-vrf |
Defines the output vrf name for route leaking between vrfs. |
bfd-neighbor |
Defines the ID of a BFD neighbor to attach the route to. |
desciption |
Define a description name for this route |
Interface Type (ifname) |
Interface ID |
|
---|---|---|
gigabitethernet |
GigabitEthernet interface slot and port (VLAN ID is optional) |
[SLOT/PORT.VLANID] |
cellular |
Cellular interface ID |
0/0 |
gre |
Tunnel GRE ID |
[1-255] |
ipip |
Tunnel IPIP ID |
[1-255] |
l2tp |
L2TP ID |
[0-99] |
pppoe |
PPPoE interface ID |
[1-3] |
pptp |
PPTP ID |
[0-99] |
vlan |
Vlan ID |
[1-3999] |
loopback |
Loopback ID |
[1-5] |
bvi |
Bridge interface |
[1-255] |
Default
NA
Command Mode
Privileged User
Example
This example adds a route to 10.20.0.0/16 through gateway 10.10.0.1 and interface vlan 1:
(config-data)# ip route 10.20.0.0 255.255.0.0 10.10.0.1 vlan 1
This example adds a track dependent route:
(config-data)# ip route 10.30.5.0 255.255.255.0 10.8.0.1 vlan 4 track 2