The add command adds the specified route for the given destination to the routing table. The delete command deletes the specified route from the routing table.
Routes to a particular host are distinguished from those to a network by interpreting the Internet address associated with destination. 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 (i.e., 0), or if the destination is the symbolic name of a network, 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 via a gateway, the metric parameter should be greater than 0. If metric is set to 0, the gateway given is the address of this host on the common network, indicating the interface to be used for transmission.
All symbolic names specified for a destination or gateway are looked up first as a host name in the /etc/hosts database. If this lookup fails, then the name is looked up as a network name in the /etc/networks database. "default" is also a valid destination, which is used if there is no specific host or network route.
-f Remove all gateway entries in the routing table. If this is used in conjunction with one of the commands, route removes the entries before performing the command.
-n Prevent attempts to print host and network names symbolically when reporting actions.
add [ host|net] destination:gateway
The specified route is being added to the table.
delete [ host|net] destination:gateway
The specified route is being deleted.
destination gateway done
When the -f flag is specified, each routing table entry deleted is
indicated with a message of this form.
network unreachable
An attempt to add a route failed because the gateway listed was not on
a directly-connected network. The next-hop gateway must be given.
not in table
A delete operation was attempted for an entry which wasn't present in
the table.
entry already exists
An add operation was attempted for an existing route entry.
routing table overflow
An add operation was attempted, but the system was unable to allocate
memory to create the new entry.