SUNWcsu
route manually manipulates the network routing tables normally maintained by the system routing daemon, routed(1M) , or through default routes and redirect messages from routers. route allows the super-user to operate directly on the routing table for the specific host or network indicated by destination. default is available for gateways to use after all other routes have been attempted. The gateway argument, if present, indicates the network gateway to which packets should be addressed. The metric argument indicates the number of ‘hops’ to the destination. The metric is required for add commands; it must be 0 if the destination is on a directly attached network, and non-zero if the route utilizes one or more gateways.
A metric of 0 implies that the route does not refer to a gateway, but rather to one of the machine’s interfaces. Destinations matching such a route are sent out on the interface identified by the gateway address. For interfaces using the ARP protocol, a metric of 0 is used to specify all destinations are local, meaning that a host should ARP for all addresses by adding a default route containing a metric of 0, as illustrated in the following example:
route add default <hostname> 0
<hostname> is the name or IP address associated with the network interface all packets should be sent over. On a host with a single network interface, <hostname> is normally the same as the <nodename> returned by uname -n.
The add command instructs route to add a route to destination. delete deletes a route.
Routes to a particular host must be distinguished from those to a network. The optional keywords net and host force the destination to be interpreted as a network or a host, respectively. Otherwise, if the destination has a ‘local address part’ of INADDR_ANY , then the route is assumed to be to a network; otherwise, it is presumed to be a route to a host. If the route is to a destination connected by a gateway, the metric parameter should be greater than 0. If adding a route with metric 0, the gateway given is the address of this host on the common network, indicating the interface to be used directly for transmission. All symbolic names specified for a destination (except default) or gateway are looked up in the hosts database using gethostbyname(3N) . If this lookup fails, then the name is looked up in the networks database using getnetbyname(3N) . default is also a valid destination, which is used for all routes if there is no specific host or network route.
Combining the all destinations are local route with subnet or network routes can lead to unpredictable results: the search order as it relates to the all destinations are local route are undefined and may vary from release to release.