Technical data

route
route
Manually manipulates the routing tables.
Format
route [-nqvC] add [-net | -host] [family] destination[/bitmask] gateway [-link] [modifiers [args]]
route [-nqv] change [-net | -host] [family] destination gateway [-link] [modifiers args]
route [-n] monitor
route [-nqvC] delete [-net | -host] [family] destination[/bitmask] [-link] gateway [modifiers args]
route [-nqvC] flush [family]
Description
The
route
command allows you to manually manipulate the network routing
tables. It normally is not needed, since a system-routing table management
daemon, such as GATED or ROUTED, should tend to this task.
The
route
command accepts five commands:
add
Adds a route.
flush
Removes all routes.
delete
Deletes a specific route.
change
Changes aspects of a route (such as its gateway).
monitor
Reports any changes to the routing information base, r‘ lookup misses,
or suspected network partitions.
The
flush
command has the following format:
route [-n] flush [family]
In this format, the address family can be specified by the
-inet
keyword.
The other commands have the following format:
route [-n] command [-net |-host] destination[/bitmask] gateway modifier [-netmask mask]
Unless the net or the host parameter is specified on the command line, route
creates a host route or a network route by interpreting the Internet address
associated with destination parameter. If the destination has a local address
part of INADDR_ANY, or if the destination is the symbolic name of a network, a
network route is created; otherwise, a host route is created.
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
-net 128.32.130
is interpreted as
128.32.130.0
.
All symbolic names specified for a destination or gateway are looked up first as a
host name using
gethostbyname( )
. If this lookup fails,
getnetbyname( )
is then
used to interpret the name as that of a network.
Routes added with the route command are marked as RTF_STATIC to
differentiate them from routes added by the routing daemons (GATED or
ROUTED). The GATED daemon does not remove the RTF_STATIC routes when
it is shut down.
Troubleshooting Utilities Reference A–31