route(1M)
NAME
route − manually manipulate the routing tables
SYNOPSIS
/etc/route [-f] [-n] add [net | host] destination gateway [count]
/etc/route [-f] [-n] delete [net | host] destination gateway [count]
/etc/route -f [-n]
route is used to manipulate the network routing tables manually, and accessible only by users who have appropriate privileges. route supports two commands:
add Add a route.
delete delete a route.
When adding a route, if the route already exists, a message is printed and nothing changes.
Other command line arguments are:
net
or
host specifies the type of destination address. If not specified, routes to a particular host are distinguished from those to a network by interpreting the Internet address associated with destination. If the destination has a “local address part” of INADDR_ANY(0), the route is assumed to be to a network; otherwise, it is treated as a route to a host.
destination destination host system where the packets will be routed. destination can be either a host name (the official name or an alias, see gethostbyname(3N)), a network name (the official name or an alias, see getnetbyname(3N)), an Internet address in “dot” notation (see inet(3N)), or the keyword default, which signifies the wildcard gateway route (see routing(7)).
gateway The gateway through which the destination is reached. gateway can be either a host name (the official name or an alias, see gethostbyname(3N)), or an Internet address in “dot” notation.
count An integer that indicates whether the gateway is a remote host or the local host. If the route leads to a destination via a remote gateway, count should be a number greater than 0. If the route leads to destination and the gateway is the local host, count should be 0. The default for count is zero. The result is not defined if count is negative.
All symbolic names specified for a destination or gateway are looked up first as a hostname using gethostbyname(); if the hostname is not found, the destination is searched as a network name using getnetbyname(). destination and gateway can be in dot notation (see inet(3N)). If the -n option is not specified, any host and network addresses are displayed symbolically according to the name returned by gethostbyaddr() and getnetbyaddr(), respectively, except for the default network address (printed as default) and addresses that have unknown names. Addresses with unknown names are printed in Internet dot notation (see inet(3N) for more information regarding this format). If the -n option is specified, any host and network addresses are printed in Internet dot notation except for the default network address which is printed as default.
If the -f option is specified, route deletes all route table entries that specify a remote host for a gateway. If this is used with one of the commands described above, the entries are deleted before the command’s application.
Output
add destination: gateway gateway flags flags
The specified route is being added to the tables.
delete destination: gateway gateway flags flags
The specified route is being deleted from the tables.
Flags
The following truth table can be used to help understand the relationship between count, destination type, flags, and route type.
| Count | Destination Type | Flags | Route Type |
| =0 | network | 1=U | route to a network via a gateway which is the local host itself |
| >0 | network | 3=UG | route to a network via a gateway which is a remote host |
| =0 | host | 5=UH | route to a host via a gateway which is the local host itself |
| >0 | host | 7=UGH | route to a host via a gateway which is a remote host |
| =0 | "default" | 1=U | wildcard route via the local host |
| >0 | "default" | 3=UG | wildcard route via a remote gateway |
DIAGNOSTICS
delete a route that does not exist
The specified route was not in the route table.
add a route that already exists
The specified entry is already in the route table.
add too many routes
The routing table is full.
WARNINGS
Reciprocal route commands must be executed on the local host, the destination host, and all intermediate hosts if routing is to succeed in the cases of virtual circuit connections or bidirectional datagram transfers.
DEPENDENCIES
The HP-UX implementation of route does not presently support a change command argument.
AUTHOR
route was developed by the University of California, Berkeley.
FILES
/etc/networks
/etc/hosts
SEE ALSO
netstat(1), ifconfig(1M), inet(3N), gethostbyname(3N), gethostbyaddr(3N), getnetbyname(3N), getnetbyaddr(3N), routing(7) .
Hewlett-Packard Company — HP-UX Release 9.0: August 1992