NAME
rroouuttee - manually manipulate the routing tables
SYNOPSIS
rroouuttee [-ddnnqqttvv] command [[modifiers] args]
DESCRIPTION
RRoouuttee is a utility used to manually manipulate the network routing tables. It normally is not needed, as a system routing table managementdaemon such as routed(8), should tend to this task.
The rroouuttee utility 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 inroute(4).
The following options are available:-nn Bypass attempts to print host and network names symbolically when
reporting actions. (The process of translating between symbolic names and numerical equivalents can be quite time consuming, and may require correct operation of the network; thus it may be expedient to forget this, especially when attempting to repair networking operations).-vv (verbose) Print additional details.
-qq Suppress all output.
The rroouuttee utility provides six commands:aadddd Add a route.
fflluusshh Remove all routes.
ddeelleettee Delete a specific route.
cchhaannggee Change aspects of a route (such as its gateway).
ggeett Lookup and display the route for a destination.
mmoonniittoorr Continuously report any changes to the routing informationbase, routing lookup misses, or suspected network partition-
ings. The monitor command has the syntax:rroouuttee [-nn] mmoonniittoorr
The flush command has the syntax:rroouuttee [-nn] fflluusshh [family]
If the fflluusshh command is specified, rroouuttee will ``flush'' the routing tables of all gateway entries. When the address family may is specifiedby any of the -oossii, -xxnnss, -aattaallkk, -iinneett66, or -iinneett modifiers, only routes
having destinations with addresses in the delineated family will be deleted. The other commands have the following syntax:rroouuttee [-nn] command [-nneett | -hhoosstt] destination gateway [netmask]
where destination is the destination host or network, gateway is thenext-hop intermediary via which packets should be routed. Routes to a
particular host may be distinguished from those to a network by inter-
preting the Internet address specified as the destination argument. Theoptional modifiers -nneett and -hhoosstt force the destination to be interpreted
as a network or a host, respectively. Otherwise, if the destination has a ``local address part'' of INADDRANY (0.0.0.0), or if the destinationis 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. Optionally,
the destination could also be specified in the net/bits format.For example, 128.32 is interpreted as -hhoosstt 128.0.0.32; 128.32.130 is
interpreted as -hhoosstt 128.32.0.130; -nneett 128.32 is interpreted as
128.32.0.0; -nneett 128.32.130 is interpreted as 128.32.130.0; and
192.168.64/20 is interpreted as -nneett 192.168.64 -nneettmmaasskk 255.255.240.0.
A destination of default is a synonym for -nneett 0.0.0.0, which is the
default route.
If the destination is directly reachable via an interface requiring nointermediary system to act as a gateway, the -iinntteerrffaaccee modifier should
be specified; the gateway given is the address of this host on the commonnetwork, indicating the interface to be used for transmission. Alter-
nately, if the interface is point to point the name of the interfaceitself may be given, in which case the route remains valid even if the
local or remote addresses change.The optional modifiers -xxnnss, -oossii, and -lliinnkk specify that all subsequent
addresses are in the XNS, OSI, or AppleTalk address families, or arespecified as link-level addresses, and the names must be numeric specifi-
cations rather than symbolic names.The optional -nneettmmaasskk modifier is intended to achieve the effect of an
OSI ESIS redirect with the netmask option, or to manually add subnetroutes with netmasks different from that of the implied network interface
(as would otherwise be communicated using the OSPF or ISIS routing proto-
cols). One specifies an additional ensuing address parameter (to be interpreted as a network mask). The implicit network mask generated in the AFINET case can be overridden by making sure this option follows the destination parameter.For AFINET6, the -pprreeffiixxlleenn qualifier is available instead of the -mmaasskk
qualifier because non-continuous masks are not allowed in IPv6. For
example, -pprreeffiixxlleenn 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 ddeeffaauulltt is specified. Note that the qualifier works only for AFINET6 address family. Routes have associated flags which influence operation of the protocolswhen sending to destinations matched by the routes. These flags may be
set (or sometimes cleared) by indicating the following corresponding mod-
ifiers:-cloning RTFCLONING - generates a new route on use
-xresolve RTFXRESOLVE - emit mesg on use (for external lookup)
-iface ~RTFGATEWAY - destination is directly reachable
-static RTFSTATIC - manually added route
-nostatic ~RTFSTATIC - pretend route added by kernel or daemon
-reject RTFREJECT - emit an ICMP unreachable when matched
-blackhole RTFBLACKHOLE - silently discard pkts (during updates)
-proto1 RTFPROTO1 - set protocol specific routing flag #1
-proto2 RTFPROTO2 - set protocol specific routing flag #2
-llinfo RTFLLINFO - validly translates proto addr to link addr
The optional modifiers -rrtttt, -rrttttvvaarr, -sseennddppiippee, -rreeccvvppiippee, -mmttuu,
-hhooppccoouunntt, -eexxppiirree, and -sssstthhrreesshh 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 modifierto be locked by the -lloocckk meta-modifier, or one can specify that all
ensuing metrics may be locked by the -lloocckkrreesstt meta-modifier.
In a cchhaannggee or aadddd command where the destination and gateway are not suf-
ficient to specify the route (as in the ISO case where several interfaces
may have the same address), the -iiffpp or -iiffaa modifiers may be used to
determine the interface or interface address.The optional -pprrooxxyy modifier specifies that the RTFLLINFO routing table
entry is the ``published (proxy-only)'' ARP entry, as reported by arp(8).
All symbolic names specified for a destination or gateway are looked up first as a host name using gethostbyname(3). If this lookup fails, getnetbyname(3) is then used to interpret the name as that of a network. RRoouuttee uses a routing socket and the new message types RTMADD,RTMDELETE, RTMGET, and RTMCHANGE. As such, only the super-user may
modify the routing tables. DIAGNOSTICSaadddd [[hhoosstt || nneettwwoorrkk ]] %%ss:: ggaatteewwaayy %%ss ffllaaggss %%xx The specified route is
being added to the tables. The values printed are from the routing table entry supplied in the ioctl(2) call. If the gateway address used was not the primary address of the gateway (the first one returned by gethostbyname(3)), the gateway address is printed numerically as well as symbolically.ddeelleettee [[ hhoosstt || nneettwwoorrkk ]] %%ss:: ggaatteewwaayy %%ss ffllaaggss %%xx As above, but when
deleting an entry.%%ss %%ss ddoonnee When the fflluusshh command is specified, each routing table entry
deleted is indicated with a message of this form.NNeettwwoorrkk iiss uunnrreeaacchhaabbllee 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. nnoott iinn ttaabbllee A delete operation was attempted for an entry which wasn't present in the tables. rroouuttiinngg ttaabbllee oovveerrffllooww An add operation was attempted, but the system was low on resources and was unable to allocate memory to create the new entry.ggaatteewwaayy uusseess tthhee ssaammee rroouuttee A cchhaannggee operation resulted in a route whose
gateway uses the same route as the one being changed. The next-hop gate-
way should be reachable through a different route.
The rroouuttee utility exits 0 on success, and >0 if an error occurs.SEE ALSO
netintro(4), route(4), arp(8), routed(8)
HISTORY The rroouuttee command appeared in 4.2BSD.BUGS
The first paragraph may have slightly exaggerated routed(8)'s abilities.
4.4BSD June 8, 2001 4.4BSD