set ip route
set ip route default gateway [metric] [primary]
set ip route destination[/netmask] gateway
Keyword that specifies the entry as a default route.
Variable that specifies the IP address or IP alias of the router.
(Optional) Variable that specifies the value used to indicate the number of hops between the switch and the gateway.
(Optional) Keyword that specifies the primary default route.
Variable that specifies the IP address or IP alias of the network, or IP address, DNS hostname, or IP alias of a specific host to be added.
(Optional) Variable that specifies the subnet mask or mask bits to assign to the interface.
Use the set ip route command to add IP addresses or aliases to the IP routing table.
You can configure up to three default gateways. You can specify a primary default gateway using the primary keyword. If a primary is not designated, the first default gateway you configure is the primary.
The switch forwards all off-network IP traffic generated by the switch itself to the primary default gateway unless the primary is unavailable. The entries in the IP routing table are only used for IP traffic generated by the switch itself (for example, Telnet, ping, or TFTP sessions from the switch CLI), not for IP data traveling through the switch.
On the Catalyst 4000 family switches, the supervisor engine software automatically determines whether a default gateway is reached through the sc0 interface or the me1 interface.
You can enter the destination and gateway as either an IP alias or IP address in dotted format (for example, 172.20.52.7). You can enter the destination network mask in dotted decimal format or you can specify the number of bits in the netmask (for example, 188.8.131.52/24). CIDR IP address and subnet mask values are accepted for the destination network address.
This example shows how to add three default routes to the IP routing table:Console> (enable) set ip route default 172.20.52.35 Route added. Console> (enable) set ip route default 172.20.52.40 Route added. Console> (enable) set ip route default 172.20.52.45 Route added. Console> (enable)
This example shows how to add a route to network 10.10.0.0/16 through gateway 172.20.52.33:Console> (enable) set ip route 10.10.0.0/16 172.20.52.33 Route added. Console> (enable)
This example shows how to add a route to a specific host:Console> (enable) set ip route 172.20.50.2/32 172.20.52.41 Route added. Console> (enable)
� Cisco Systems, Inc. 2001, 2002, 2003
World Wide Education
|Converted from CHM to HTML with chm2web Pro 2.85 (unicode)|