Use the set ip route command to add IP addresses or aliases to the IP routing table.
set ip route destination gateway [metric] [primary]
Syntax Description
destination IP address or IP alias of the network or specific host to be added. Use default as the destination to set the new entry as the default route. gateway IP address or IP alias of the router. metric (Optional) Value used to indicate the number of hops between the switch and the gateway. primary (Optional) Keyword used with the Multiple Default IP Gateways feature to specify the default IP gateway with the highest priority. Default
The default configuration routes the local network through the sc0 interface with metric 0 as soon as sc0 is configured.
Command Type
Switch command.
Command Mode
Privileged.
Usage Guideline
You can configure up to three default gateways. The primary is the highest priority. If a primary is not designated, priority is based on the order of input. If two primary definitions are entered, the second definition becomes the primary and the first definition is now the secondary default IP gateway.
Examples
This example shows how to add three default routes to the IP routing table, checking after each addition using the show ip route command:
Console> (enable) set ip route default 192.122.173.42 1 primary Route added. Console> (enable) Console> (enable) show ip route Fragmentation Redirect Unreachable ------------- -------- ----------- enabled enabled enabled Destination Gateway Flags Use Interface --------------- --------------- ------ ---------- --------- default 192.122.173.42 UG 59444 sc0 192.22.74.0 192.22.74.223 U 5 sc0 Console> (enable) Console> (enable) set ip route default 192.122.173.43 1 Route added. Console> (enable) Console> (enable) show ip route Fragmentation Redirect Unreachable ------------- -------- ----------- enabled enabled enabled Destination Gateway Flags Use Interface --------------- --------------- ------ ---------- --------- default 192.122.173.43 G 0 sc0 default 192.122.173.42 UG 59444 sc0 192.22.74.0 192.22.74.223 U 5 sc0 Console> (enable) Console> (enable) set ip route default 192.122.173.44 1 Route added. Console> (enable) Console> (enable) show ip route Fragmentation Redirect Unreachable ------------- -------- ----------- enabled enabled enabled Destination Gateway Flags Use Interface --------------- --------------- ------ ---------- --------- default 192.122.173.44 G 0 sc0 default 192.122.173.43 G 0 sc0 default 192.122.173.42 UG 59444 sc0 192.22.74.0 192.22.74.223 U 5 sc0 Console> (enable)Related Commands
clear ip route
show ip route