set ip route

Use this command to add a non-forwarding management IP route to the switch‘s IP routing table.

Syntax

set ip route {destination | default} {gateway | interface} [mask]

Parameters

destination Specifies the IPv4 or IPv6 address of the network or host to be added.
default Sets the default gateway.
gateway Specifies the IPv4 or IPv6 address of the next hop router.
interface Specifies an IP interface. For example: vlan.0.1
mask (Optional) Specifies a netmask.

Defaults

If no mask is specified, the specific gateway or interface is used.

Mode

All command modes.

Usage

The set ip route command is used to specify static routes that will not be used to route transit frames. Routed static routes can be configured using ip route in configuration command mode.

If the gateway address is specified, the interface defaults to the host (default) VLAN. If the next-hop resides on a VLAN other than the default VLAN, use the interface option to specify the next hop.

A non-forwarding management route can also be configured using ip route in global configuration command mode, with the underlying routing interface set to non-forwarding using the no ip forwarding command in interface configuration command mode. The ip route command automatically determines the correct VLAN if not specified.

Use show ip route to display routes added to the route table with this command.

Example

This example shows how to add to the routing table an IP route to 192.122.173.42 setting 192.122.168.38 as the gateway:

System(rw)->set ip route 192.122.173.42 192.122.168.38

This example shows how to add to the routing table an IP route to 192.122.173.42 using interface VLAN 50:

System(rw)->set ip route 192.122.173.42 vlan 50

This example shows how to set 192.122.168.38 as the default gateway for this device:

System(rw)->set ip route default 192.122.168.38