Syntax ADD IP ROUte=ipadd INTerface=interface NEXThop=ipadd [MASK=ipadd] [METric=1..16] [METRIC1=1..16]
[METRIC2=1..65535] [POLIcy=0..7] [PREFerence=0..65535]
[TAG=1..65535]
ADD IP ROUte=ipadd BLAckhole [MASK=ipadd] [METric=1..16]
[PREFerence=0..65535]
where:
■ ipadd is an IP address in dotted decimal notation.
■ interface is an interface name formed by concatenating a Layer 2 interface type, an interface instance, and optionally a hyphen followed by a logical interface number from 0 to 15. If a logical interface is not specified, 0 is assumed.
Description This command adds a static route to the IP route table. Static routes can be used to define default routes to external routers or networks. A default route is one with a network address of 0.0.0.0. When the switch receives data and cannot find a route for it, it sends the data to the default route. To define a default route, route is set to 0.0.0.0 and nexthop points to the network (switch) where default packets are to be directed. The static route must not already exist.
However, if the route exists as a dynamic route (such as RIP-derived), the static route can still be added. A recommended limit of 300 static routes applies to devices with 16MB of DRAM or less.
This command also defines subnets. Multiple routes can be defined for a single interface (usually a LAN). This is useful for configuring more than one
network or subnet on a particular interface. A common problem is when hosts exceed the capacity of a single subnet. Additional subnets can be assigned by adding static routes. In this case route is set to the new subnet, nexthop is set to 0.0.0.0, and metric set to 1.
The route parameter specifies the IP address of the static route.
The interface parameter specifies the IP interface with which the route is associated. The interface must already exist and be assigned to the IP module.
Valid interfaces are:
■ PPP (such as ppp0, ppp1-1)
■ VLAN (such as vlan1, vlan1-1)
To see a list of interfaces currently available, use the show interface command on page 10-51 of Chapter 10, Interfaces. The interface parameter is not valid with blackhole. If a logical interface is specified, the route is only added to the specified logical interface. If a logical interface is not specified, 0 is assumed and the route is only added to logical interface 0. The interface cannot be a local interface.
The nexthop parameter specifies the IP address of the next hop (switch) for the route. The default is the IP address of the interface specified by the interface parameter. For a PPP link, nexthop should be the IP address of the remote end of the PPP link. The nexthop parameter is not valid with blackhole.
Software Version 2.9.1/3.2.1
The blackhole parameter specifies that the route is a blackhole route. A blackhole route silently drops packets that are destined for the route’s IP address. It is a low priority route, so only becomes active if the switch’s normal route to the IP address goes down. For more information, see “Blackhole Routing” on page 13-21. The blackhole parameter is not valid with interface, nexthop, metric1, metric2, policy or tag.
The mask parameter specifies the subnet mask for the route. The default mask is determined using the following:
1. If mask is specified, use the specified mask.
2. If the route is the default route, use a mask of 0.0.0.0.
3. If the route is for a network to which the switch is not attached, use the unsubnetted mask for the network class (A, B or C).
4. Otherwise, use the subnet mask of the specified interface. The subnet mask does not need to be specified in most cases.
In all cases a check is performed on the route and mask to verify that the route is the same before and after masking. This ensures that a static route is not specified to more than its subnet mask.
The metric1 parameter specifies the cost of traversing the route for RIP. The default is 1. The normal range is from 2 to 16. A metric of 1 should be used if adding a subnet to an interface. The metric parameter is also accepted for backwards compatibility. The metric1 parameter is not valid with blackhole;
use metric instead.
The metric2 parameter specifies the cost of traversing the route. The default is 1. The metric2 parameter is not valid with blackhole.
If static routes are redistributed into OSPF, metric1 and metric2 may be used as metric values for the redistributed routes. If metric2 is configured, the route is redistributed into OSPF as a Type-2 route. For more information see the add ospf redistribute command on page 19-33 of Chapter 19, Open Shortest Path First (OSPF).
The policy parameter specifies the type of service for the route. The default is 0.
The policy parameter is not valid with blackhole.
The preference parameter specifies the preference for the route. When more than one route in the route table matches the destination address in an IP packet, the route with the lowest preference value is used to route the packet. If two or more routes have the same preference, the route with the lowest metric is used.
Interface routes have a preference of 0 and RIP routes have a preference of 100.
The default preference for static routes other than 0.0.0.0 is 60. The default for the default static route 0.0.0.0 is 360. The default for a blackhole route is 5, which ensures that the blackhole route is preferred over a matching static route but is not preferred over a matching interface route.
The tag parameter specifies an integer to tag the route with. You can then match against this number in a route map and only import the appropriately-tagged routes into BGP or OSPF. The tag parameter is not valid with blackhole.
Examples To create a default route that points to a router at the remote end of a PPP link attached to interface ppp0 with the IP address 172.16.8.82, use the command:
add ip rou=0.0.0.0 mask=0.0.0.0 int=ppp0 next=172.16.8.82 met=1
To add the subnet 172.16.9.0 to the existing routes on interface vlan1, use the command:
add ip rou=172.16.9.0 mask=255.255.255.0 int=vlan1 next=172.16.8.82 met=1
Adding static routes to get more local address space can cause problems with PC-based TCP/IP software. You may need to change the subnet mask on the PC so that it recognises hosts on other subnets.
To add a blackhole route for the subnet 172.16.8.128/25, use the command:
add ip rou=172.16.8.128 blackhole mask=255.255.255.128 Related Commands delete ip route
set ip route show ip route
Software Version 2.9.1/3.2.1