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