NAME | SYNOPSIS | DESCRIPTION | DIAGNOSTICS | ATTRIBUTES | SEE ALSO
The route command is a C_INIT(1M) built-in command. The route command is a utility used to manually manipulate the network routing tables. It is normally not needed, as a system routing management daemon should tend to this task.
The route command supports a limited number of general options, but a rich command language, enabling the user to specify any arbitrary request that could be delivered via the programmatic interface discussed in route(7P).
The following options are available:
Bypass attempts to print host and network names symbolically when reporting actions. (The process of translating between symbolic names and numerical equivalents can be time-consuming, and requires correct operation of the network; thus it may be expedient to forget this, especially when attempting to repair networking operations).
Suppress all output.
(verbose) Print additional details.
The route utility provides six commands:
Add a route.
Remove all routes.
Delete a specific route.
Change aspects of a route, such as its gateway.
Lookup and display the route for a destination.
Continuously report any changes to the routing information base, routing lookup misses, or suspected network partitionings.
This command is not available in the C_INIT
built-in route utility.
The monitor command has the syntax:
route [-n] monitorThe flush command has the syntax:
route [-n] flush [family]If the flush command is specified, route will "flush" the routing tables of all gateway entries. When the address family may is specified by any of the -inet6 or -inet modifiers, only routes having destinations with addresses in the delineated family will be deleted.
The other commands have the following syntax:
route [-n] command [-net|-host] destination gatewaywhere destination is the destination
host or network, gateway is the next-hop intermediary
via which packets should be routed. Routes to a particular host may be distinguished
from those to a network by interpreting the Internet address specified as
the destination argument. The optional modifiers -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
(0.0.0.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.
For example, 128.32 is interpreted as -host 128.0.0.32; 128.32.130 is interpreted as -host 128.32.0.130; -net 128.32 is interpreted as 128.32.0.0; and -net128.32.130 is interpreted as 128.32.130.0.
A destination of default is a synonym for -net 0.0.0.0, which is the default route.
If the destination is directly reachable via an interface requiring no intermediary system to act as a gateway, the -interface modifier should be specified; the gateway given is the address of this host on the common network, indicating the interface to be used for transmission. Alternately, if the interface is point-to-point the name of the interface itself may be given, in which case the route remains valid even if the local or remote addresses change.
The optional -netmask modifier is intended to achieve the effect of an OSI ESIS redirect with the netmask option, or manually to add subnet routes with netmasks different from that of the implied network interface (otherwise communicated using the OSPF or ISIS routing protocols). One specifies an additional ensuing address parameter (to be interpreted as a network mask). The implicit network mask generated in the AF_INET case can be overridden by ensuring that this option follows the destination parameter.
For AF_INET6, the --prefixlen qualifier is available instead of the --mask qualifier because non-continuous masks are not allowed in IPv6. For example, --prefixlen 32 specifies network mask of ffff:ffff:0000:0000:0000:0000:0000:0000 to be used. The default value of prefixlen is 64 to get along with the aggregatable address. But 0 is assumed if default is specified. Note that the qualifier works only for AF_INET6 address family.
Routes have associated flags which influence operation of the protocols when sending to destinations matched by the routes. These flags can be set (or sometimes cleared) by indicating the following corresponding modifiers:
RTF_CLONING; generates a new route on use
RTF_XRESOLVE; emit message on use (for external lookup)
~RTF_GATEWAY; destination is directly reachable
RTF_STATIC; manually added route
~RTF_STATIC; pretend route added by microkernel or daemon
RTF_REJECT; emit an ICMP unreachable when matched
RTF_BLACKHOLE; silently discard packets (during updates)
RTF_PROTO1; set protocol specific routing flag number 1
RTF_PROTO2; set protocol specific routing flag number 2
RTF_LLINFO; validly translates proto address to link address
The optional modifiers -rtt, -rttvar, -sendpipe, -recvpipe, -mtu, -hopcount, -expire, and -ssthresh provide initial values to quantities maintained in the routing entry by transport level protocols, such as TCP or TP4. These may be individually locked by preceding each such modifier to be locked by the -lock meta-modifier, or one can specify that all ensuing metrics may be locked by the -lockrest meta-modifier.
In a change or add command where the destination and gateway are not sufficient to specify the route (as in the ISO case where several interfaces may have the same address), the -ifp or -ifa modifiers may be used to determine the interface or interface address.
All symbolic names specified for a destination or gateway are looked up first as a host name using gethostbyname(3STDC). If this lookup fails, getnetbyname(3POSIX) is then used to interpret the name as that of a network.
route uses a routing socket and the new message types RTM_ADD
, RTM_DELETE
, RTM_GET
, and RTM_CHANGE
. As such, only the
super-user can modify the routing tables.
The specified route is being added to the tables. The values printed are from the routing table entry supplied in the ioctl(2POSIX) call. If the gateway address used was not the primary address of the gateway (the first one returned by gethostbyname(3STDC)), the gateway address is printed numerically as well as symbolically.
As above, but when deleting an entry.
When the flush command is specified, each routing table entry deleted is indicated with a message of this form.
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.
A delete operation was attempted for an entry that was not present in the tables.
An add operation was attempted, but the system was low on resources and was unable to allocate memory to create the new entry.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | DESCRIPTION | DIAGNOSTICS | ATTRIBUTES | SEE ALSO