DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

route(ADMN)


route -- manually manipulate the routing tables

Syntax

add

/etc/route [ -nqv ] add [ -interface ] [ -netmask new_mask ]
[ [ lock_mod ] metrics ] [ [ -ifa|-ifp ] interface_spec ] [ -host|-net ]
destination gateway

change

/etc/route [ -nqv ] change [ -interface ] [ -netmask new_mask ]
[ [ lock_mod ] metrics ] [ [ -ifa|-ifp ] interface_spec ] [ -host|-net ]
destination gateway new_gateway

delete

/etc/route [ -nqv ] delete [ -interface ] [ -netmask new_mask ]
[ [ lock_mod ] metrics ] [ -host|-net ] destination gateway

flush

/etc/route [ -nqv ] flush [ family ]

get

/etc/route [ -nqv ] get [ -interface ] [ -netmask new_mask ]
[ [ lock_mod ] metrics ] [ -host|-net ] destination gateway

monitor

/etc/route [ -n ] monitor

Description

The route command manually manipulates the network routing tables.

Options supported by route:


-n
Prevents attempts to print host and network names symbolically when reporting actions.

-q
Suppresses all output.

-v
Displays additional details (Verbose mode).

Commands accepted by route:

add
Adds a route.

change
Changes aspects of a route (such as its gateway).

delete
Deletes a specific route.

flush
Removes all gateway entries from the routing tables.

get
Looks up and displays the route for a destination.

monitor
Continuously reports any changes to the routing information base, routing lookup misses, or suspected network partionings.
Parameters accepted by route:

destination
Specifies the destination host or network. See the gateway option for acceptable formats. For those destinations that do not require a unique routing table entry, use default as the destination parameter. For example:

route add default gator

In this example, gator is the hostname of the machine functioning as the gateway.


gateway
Specifies the next-hop gateway to which packets should be addressed. The gateway and destination can be Internet addresses or names. All symbolic names specified for a destination or gateway are looked up first as a host name using gethostbyname(SLIB). If this lookup fails, getnetbyname(SLIB) is then used to interpret the name as that of a network.
Modifiers accepted by route:

family
Flushes only those routes whose destinations are of the specified address family. Currently, inet is the only supported address family.

-host
Forces the destination to be interpreted as a host. For more information on -net and -host, see the paragraph following this list of options.

-interface
Specifies that the route uses an interface rather than a gateway. The specified gateway is the address of this host on the common network, indicating the interface to be used for transmission.

interface_spec
Specifies the interface name or interface address. This option is needed only when the destination and gateway are not sufficient to identify the route for add or change commands.

-ifa
Tells route to interpret the interface_spec option as an interface address.

-ifp
Tells route to interpret the interface_spec option as an interface name.

lock_mod
Locks the initial value provided by the metrics option. Available lock meta-modifiers are -lock, which can be used to lock metric options individually by preceding each metric to be locked, or -lockrest, whick locks all ensuing metrics.

metrics
Provides initial values for metrics maintained in the routing entry. Available metric options are:

-expire
Specify the expiry time of the route in seconds. An expiry time of 0 implies that the route will not expire.

-hopcount
Specify the number of hops.

-mtu
Specify the maximum transmission unit in bytes.

-recvpipe
Specify the bandwidth of the receive pipe in bytes.

-rtt
Specify the round-trip time in milliseconds.

-rttvar
Specify the variance in round-trip time in milliseconds.

-sendpipe
Specify the bandwidth of the send pipe in bytes.

-ssthresh
Specify the slow start threshold size in bytes.

-tos
Specify the type of service as defined in RFC 1349.

The option should be followed by a number specifying the desired value.

Note that most routing protocols only use or calculate a subset of these metrics, and so route get may display their values as 0. For example, RIP uses the hop count metric.

These values may be locked by specifying a lock_mod.


-net
Forces the destination to be interpreted as a network. For more information on -net and -host, see the paragraph following this list of options.

-netmask
Overrides the implicit network mask with the one specified in new_mask.

new_mask
Specifies the replacement network mask.

new_gateway
Specifies the new gateway.
If one of the optional keywords -host or -net does not follow the command, 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 or if the destination is the symbolic name of a network, 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
-net 128.32.130 is interpreted as ``128.32.130.0''.

route uses a routing stream and the new message types RTM_ADD, RTM_DELETE, RTM_GET, and RTM_CHANGE. Therefore, only root may modify the routing tables.

The kernel variables ipforwarding and ipsendredirects are pertinent to systems set up as routers. For details on these kernel variables, see ``Internet Protocol (IP) parameters'' in the Performance Guide.

Diagnostics

Error messages


network is 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 tables.

routing table overflow
An add operation was attempted, but the system was low on resources and was unable to allocate memory to create the new entry.

Confirmation messages


add host destination: gateway gateway flags hex-flags
The specified route to a host is being added to the tables. The values printed are from the routing table entry supplied in the ioctl call. If the gateway address used was not the primary address of the gateway (i.e., the first one returned by gethostbyname), the gateway address is printed numerically as well as symbolically.

add net destination: gateway gateway flags hex-flags
As above, but when adding a network entry.

delete host destination: gateway gateway flags hex-flags
As above, but when deleting a host entry.

delete net destination: gateway gateway flags hex-flags
As above, but when deleting a network entry.

destination gateway done
When the flush command is specified, each routing table entry deleted is indicated with a message of this form.

See also

Intro(ADMP), Intro(SFF), gated(ADMN), hosts(SFF), networks(SFF), route(ADMP), routed(ADMN)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003