ip-route

This command manages static routes in the routing table for the VLAN interface.

Syntax

Add a static route
ip-route address next-hop-address [metric]
Delete a static route
no ip-route address next-hop-address

Parameters

address
Specifies the IP address and netmask. The netmask is in CIDR format and is the integer that assigns the prefix length.
  • For version 4, the prefix length can be in the range of 0 through 32.
  • For version 6, the prefix length can be in the range of 0 through 128.
next-hop-address
Specifies the IP address of the next-hop router.
metric
Optionally specifies the preference for the route. The lesser the value, the more preferred the route. For each IP family, the supported range differs.
  • For IPv4, enter a value in the range 0 - 255. The default value is 0.
  • For IPv6, enter a value in the range 0 - 65536. The default value is 512.

Guidelines

The ip-route command manages static routes in the routing table. Issue this command for each static route to add to the routing table.

To delete a static route, use the no ip-route command. Issue this command for each static route to delete from the routing table.

This command is meaningful except when you use the ip-config-mode command for autoconfiguration with DHCP or SLAAC.

Examples

  • Add a static route to the routing table (subnet 10.10.10.224 via next-hop router 192.168.1.100). The metric for the route is 0, the default value for IPv4, which is the most preferred route.
    # ip-route 10.10.10.0/27 192.168.1.100
    
  • Delete a static route from the routing table (subnet 10.10.10.224 via next-hop router 192.168.1.100).
    # no ip-route 10.10.10.0/27 192.168.1.100