xref: /netbsd-src/sbin/route/route.8 (revision 76dfffe33547c37f8bdd446e3e4ab0f3c16cea4b)
1.\"	$NetBSD: route.8,v 1.7 1996/11/15 18:01:39 gwr Exp $
2.\"
3.\" Copyright (c) 1983, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)route.8	8.3 (Berkeley) 3/19/94
35.\"
36.Dd March 19, 1994
37.Dt ROUTE 8
38.Os BSD 4.4
39.Sh NAME
40.Nm route
41.Nd manually manipulate the routing tables.
42.Sh SYNOPSIS
43.Nm route
44.Op Fl nqv
45.Ar command
46.Oo
47.Op Ar modifiers
48.Ar args
49.Oc
50.Sh DESCRIPTION
51.Nm Route
52is a utility used to manually manipulate the network
53routing tables.  It normally is not needed, as a
54system routing table management daemon such as
55.Xr routed 8 ,
56should tend to this task.
57.Pp
58The
59.Nm route :
60utility supports a limited number of general options,
61but a rich command language, enabling the user to specify
62any arbitrary request that could be delivered via the
63programmatic interface discussed in
64.Xr route 4 .
65.Pp
66.Bl -tag -width Ds
67.It Fl n
68Bypasses attempts to print host and network names symbolically
69when reporting actions.  (The process of translating between symbolic
70names and numerical equivalents can be quite time consuming, and
71may require correct operation of the network; thus it may be expedient
72to forgo this, especially when attempting to repair networking operations),
73.It Fl v
74(verbose) Print additional details.
75.It Fl q
76Suppress all output.
77.El
78.Pp
79The
80.Nm route :
81utility provides several commands:
82.Pp
83.Bl -tag -width Fl -compact
84.It Cm add
85Add a route.
86.It Cm flush
87Remove all routes.
88.It Cm delete
89Delete a specific route.
90.It Cm change
91Change aspects of a route (such as its gateway).
92.It Cm get
93Lookup and display the route for a destination.
94.It Cm show
95Print out the route table similar to "netstat \-r" (see
96.Xr netstat 8 ).
97.It Cm monitor
98Continuously report any changes to the routing information base,
99routing lookup misses, or suspected network partitionings.
100.El
101.Pp
102The monitor command has the syntax
103.Pp
104.Bd -filled -offset indent -compact
105.Nm route Op Fl n
106.Cm monitor
107.Ed
108.Pp
109The flush command has the syntax
110.Pp
111.Bd -filled -offset indent -compact
112.Nm route Op Fl n
113.Cm flush
114.Op Ar family
115.Ed
116.Pp
117If the
118.Cm flush
119command is specified,
120.Nm route
121will ``flush'' the routing tables of all gateway entries.
122When the address family may is specified by any of the
123.Fl osi ,
124.Fl xns ,
125or
126.Fl inet
127modifiers, only routes having destinations with addresses in the
128delineated family will be deleted.
129.Pp
130The other commands have the following syntax:
131.Pp
132.Bd -filled -offset indent -compact
133.Nm route Op Fl n
134.Ar command
135.Op Fl net No \&| Fl host
136.Ar destination gateway
137.Ed
138.Pp
139where
140.Ar destination
141is the destination host or network,
142.Ar gateway
143is the next-hop intermediary via which packets should be routed.
144Routes to a particular host may be distinguished from those to
145a network by interpreting the Internet address specified as the
146.Ar destination argument.
147The optional modifiers
148.Fl net
149and
150.Fl host
151force the destination to be interpreted as a network or a host, respectively.
152Otherwise, if the
153.Ar destination
154has a ``local address part'' of
155INADDR_ANY ,
156or if the
157.Ar destination
158is the symbolic name of a network, then the route is
159assumed to be to a network; otherwise, it is presumed to be a
160route to a host.
161.Pp
162For example,
163.Li 128.32
164is interpreted as
165.Fl host Li 128.0.0.32 ;
166.Li 128.32.130
167is interpreted as
168.Fl host Li 128.32.0.130 ;
169.Fl net Li 128.32
170is interpreted as
171.Li 128.32.0.0;
172and
173.Fl net Li 128.32.130
174is interpreted as
175.Li 128.32.130.0 .
176.Pp
177If the destination is directly reachable
178via an interface requiring
179no intermediary system to act as a gateway, the
180.Fl interface
181modifier should be specified;
182the gateway given is the address of this host on the common network,
183indicating the interface to be used for transmission.
184.Pp
185The optional modifiers
186.Fl xns ,
187.Fl osi ,
188and
189.Fl link
190specify that all subsequent addresses are in the
191.Tn XNS
192.Tn OSI
193address families,
194or are specified as link-level addresses,
195and the names must be numeric specifications rather than
196symbolic names.
197.Pp
198The optional
199.Fl netmask
200qualifier is intended
201to achieve the effect of an
202.Tn OSI
203.Tn ESIS
204redirect with the netmask option,
205or to manually add subnet routes with
206netmasks different from that of the implied network interface
207(as would otherwise be communicated using the OSPF or ISIS routing protocols).
208One specifies an additional ensuing address parameter
209(to be interpreted as a network mask).
210The implicit network mask generated in the AF_INET case
211can be overridden by making sure this option follows the destination parameter.
212.Pp
213Routes have associated flags which influence operation of the protocols
214when sending to destinations matched by the routes.
215These flags may be set (or sometimes cleared)
216by indicating the following corresponding modifiers:
217.Bd -literal
218-cloning   RTF_CLONING    - generates a new route on use
219-xresolve  RTF_XRESOLVE   - emit mesg on use (for external lookup)
220-iface    ~RTF_GATEWAY    - destination is directly reachable
221-static    RTF_STATIC     - manually added route
222-nostatic ~RTF_STATIC     - pretend route added by kernel or daemon
223-reject    RTF_REJECT     - emit an ICMP unreachable when matched
224-blackhole RTF_BLACKHOLE  - silently discard pkts (during updates)
225-proto1    RTF_PROTO1     - set protocol specific routing flag #1
226-proto2    RTF_PROTO2     - set protocol specific routing flag #2
227-llinfo    RTF_LLINFO     - validly translates proto addr to link addr
228.Ed
229.Pp
230The optional modifiers
231.Fl rtt ,
232.Fl rttvar ,
233.Fl sendpipe ,
234.Fl recvpipe ,
235.Fl mtu ,
236.Fl hopcount ,
237.Fl expire ,
238and
239.Fl ssthresh
240provide initial values to quantities maintained in the routing entry
241by transport level protocols, such as TCP or TP4.
242These may be individually locked by preceding each such modifier to
243be locked by
244the
245.Fl lock
246meta-modifier, or one can
247specify that all ensuing metrics may be locked by the
248.Fl lockrest
249meta-modifier.
250.Pp
251In a
252.Cm change
253or
254.Cm add
255command where the destination and gateway are not sufficient to specify
256the route (as in the
257.Tn ISO
258case where several interfaces may have the
259same address), the
260.Fl ifp
261or
262.Fl ifa
263modifiers may be used to determine the interface or interface address.
264.Pp
265All symbolic names specified for a
266.Ar destination
267or
268.Ar gateway
269are looked up first as a host name using
270.Xr gethostbyname 3 .
271If this lookup fails,
272.Xr getnetbyname 3
273is then used to interpret the name as that of a network.
274.Pp
275.Nm Route
276uses a routing socket and the new message types
277RTM_ADD,
278RTM_DELETE,
279RTM_GET,
280and
281RTM_CHANGE.
282As such, only the super-user may modify
283the routing tables.
284.Sh DIAGNOSTICS
285.Bl -tag -width Ds
286.It Sy "add [host \&| network ] %s: gateway %s flags %x"
287The specified route is being added to the tables.  The
288values printed are from the routing table entry supplied
289in the
290.Xr ioctl 2
291call.
292If the gateway address used was not the primary address of the gateway
293(the first one returned by
294.Xr gethostbyname 3 ) ,
295the gateway address is printed numerically as well as symbolically.
296.It Sy "delete [ host &| network ] %s: gateway %s flags %x"
297As above, but when deleting an entry.
298.It Sy "%s %s done"
299When the
300.Cm flush
301command is specified, each routing table entry deleted
302is indicated with a message of this form.
303.It Sy "Network is unreachable"
304An attempt to add a route failed because the gateway listed was not
305on a directly-connected network.
306The next-hop gateway must be given.
307.It Sy "not in table"
308A delete operation was attempted for an entry which
309wasn't present in the tables.
310.It Sy "routing table overflow"
311An add operation was attempted, but the system was
312low on resources and was unable to allocate memory
313to create the new entry.
314.El
315.Sh SEE ALSO
316.Xr netintro 4 ,
317.Xr route 4 ,
318.Xr esis 4 ,
319.Xr routed 8 ,
320.Xr XNSrouted 8
321.Sh HISTORY
322The
323.Nm
324command appeared in
325.Bx 4.2 .
326.Sh BUGS
327The first paragraph may have slightly exaggerated
328.Xr routed Ns 's
329abilities.
330