Merge from vendor branch BZIP:
[dragonfly.git] / sbin / route / route.8
1 .\" Copyright (c) 1983, 1991, 1993
2 .\"     The Regents of the University of California.  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     8.3 (Berkeley) 3/19/94
33 .\" $FreeBSD: src/sbin/route/route.8,v 1.17.2.9 2003/02/24 00:56:43 trhodes Exp $
34 .\" $DragonFly: src/sbin/route/route.8,v 1.5 2006/01/19 22:19:30 dillon Exp $
35 .\"
36 .Dd June 8, 2001
37 .Dt ROUTE 8
38 .Os
39 .Sh NAME
40 .Nm route
41 .Nd manually manipulate the routing tables
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl dnqtv
45 .Op Fl c Ar cpu
46 .Ar command
47 .Oo
48 .Op Ar modifiers
49 .Ar args
50 .Oc
51 .Sh DESCRIPTION
52 The
53 .Nm
54 utility is used to manually manipulate the network
55 routing tables.  It normally is not needed, as a
56 system routing table management daemon such as
57 .Xr routed 8 ,
58 should tend to this task.
59 .Pp
60 The
61 .Nm
62 utility supports a limited number of general options,
63 but a rich command language, enabling the user to specify
64 any arbitrary request that could be delivered via the
65 programmatic interface discussed in
66 .Xr route 4 .
67 .Pp
68 The following options are available:
69 .Bl -tag -width indent
70 .It Fl c Ar cpu
71 On SMP systems the route table is replicated.  This option allows the
72 route table for a specific cpu to be accessed and exists primarily
73 for debugging purposes.
74 .It Fl n
75 Bypass attempts to print host and network names symbolically
76 when reporting actions.  (The process of translating between symbolic
77 names and numerical equivalents can be quite time consuming, and
78 may require correct operation of the network; thus it may be expedient
79 to forget this, especially when attempting to repair networking operations).
80 .It Fl v
81 (verbose) Print additional details.
82 .It Fl q
83 Suppress all output from the
84 .Cm add , delete ,
85 and
86 .Cm flush
87 commands.
88 .It Fl w
89 Print the full width of the data being represented even if it would overflow
90 the column.
91 .El
92 .Pp
93 The
94 .Nm
95 utility provides six commands:
96 .Pp
97 .Bl -tag -width Fl -compact
98 .It Cm add
99 Add a route.
100 .It Cm flush
101 Remove all routes.
102 .It Cm delete
103 Delete a specific route.
104 .It Cm change
105 Change aspects of a route (such as its gateway).
106 .It Cm get
107 Lookup and display the route for a destination.
108 .It Cm show
109 Print out the route table similar to "netstat \-r" (see
110 .Xr netstat 1 ) .
111 .It Cm monitor
112 Continuously report any changes to the routing information base,
113 routing lookup misses, or suspected network partitionings.
114 .El
115 .Pp
116 The monitor command has the syntax:
117 .Pp
118 .Bd -ragged -offset indent -compact
119 .Nm
120 .Op Fl n
121 .Cm monitor
122 .Ed
123 .Pp
124 The flush command has the syntax:
125 .Pp
126 .Bd -ragged -offset indent -compact
127 .Nm
128 .Op Fl n
129 .Cm flush
130 .Op Ar family
131 .Ed
132 .Pp
133 If the
134 .Cm flush
135 command is specified,
136 .Nm
137 will ``flush'' the routing tables of all gateway entries.
138 When the address family may is specified by any of the
139 .Fl osi ,
140 .Fl xns ,
141 .Fl atalk ,
142 .Fl inet6 ,
143 or
144 .Fl inet
145 modifiers, only routes having destinations with addresses in the
146 delineated family will be deleted.
147 .Pp
148 The other commands have the following syntax:
149 .Pp
150 .Bd -ragged -offset indent -compact
151 .Nm
152 .Op Fl n
153 .Ar command
154 .Op Fl net No \&| Fl host
155 .Ar destination gateway
156 .Op Ar netmask
157 .Ed
158 .Pp
159 where
160 .Ar destination
161 is the destination host or network,
162 .Ar gateway
163 is the next-hop intermediary via which packets should be routed.
164 Routes to a particular host may be distinguished from those to
165 a network by interpreting the Internet address specified as the
166 .Ar destination
167 argument.
168 The optional modifiers
169 .Fl net
170 and
171 .Fl host
172 force the destination to be interpreted as a network or a host, respectively.
173 Otherwise, if the
174 .Ar destination
175 has a
176 .Dq local address part
177 of
178 INADDR_ANY
179 .Pq Li 0.0.0.0 ,
180 or if the
181 .Ar destination
182 is the symbolic name of a network, then the route is
183 assumed to be to a network; otherwise, it is presumed to be a
184 route to a host.
185 Optionally, the
186 .Ar destination
187 could also be specified in the
188 .Ar net Ns / Ns Ar bits
189 format.
190 .Pp
191 For example,
192 .Li 128.32
193 is interpreted as
194 .Fl host Li 128.0.0.32 ;
195 .Li 128.32.130
196 is interpreted as
197 .Fl host Li 128.32.0.130 ;
198 .Fl net Li 128.32
199 is interpreted as
200 .Li 128.32.0.0;
201 .Fl net Li 128.32.130
202 is interpreted as
203 .Li 128.32.130.0;
204 and
205 .Li 192.168.64/20
206 is interpreted as
207 .Fl net Li 192.168.64 Fl netmask Li 255.255.240.0 .
208 .Pp
209 A
210 .Ar destination
211 of
212 .Ar default
213 is a synonym for
214 .Fl net Li 0.0.0.0 ,
215 which is the default route.
216 .Pp
217 If the destination is directly reachable
218 via an interface requiring
219 no intermediary system to act as a gateway, the
220 .Fl interface
221 modifier should be specified;
222 the gateway given is the address of this host on the common network,
223 indicating the interface to be used for transmission.
224 Alternately, if the interface is point to point the name of the interface
225 itself may be given, in which case the route remains valid even
226 if the local or remote addresses change.
227 .Pp
228 The optional modifiers
229 .Fl xns ,
230 .Fl osi ,
231 .Fl atalk ,
232 and
233 .Fl link
234 specify that all subsequent addresses are in the
235 .Tn XNS ,
236 .Tn OSI ,
237 or
238 .Tn AppleTalk
239 address families,
240 or are specified as link-level addresses,
241 and the names must be numeric specifications rather than
242 symbolic names.
243 .Pp
244 The optional
245 .Fl netmask
246 modifier is intended
247 to achieve the effect of an
248 .Tn OSI
249 .Tn ESIS
250 redirect with the netmask option,
251 or to manually add subnet routes with
252 netmasks different from that of the implied network interface
253 (as would otherwise be communicated using the OSPF or ISIS routing protocols).
254 One specifies an additional ensuing address parameter
255 (to be interpreted as a network mask).
256 The implicit network mask generated in the AF_INET case
257 can be overridden by making sure this option follows the destination parameter.
258 .Pp
259 For
260 .Dv AF_INET6 ,
261 the
262 .Fl prefixlen
263 qualifier
264 is available instead of the
265 .Fl mask
266 qualifier because non-continuous masks are not allowed in IPv6.
267 For example,
268 .Fl prefixlen Li 32
269 specifies network mask of
270 .Li ffff:ffff:0000:0000:0000:0000:0000:0000
271 to be used.
272 The default value of prefixlen is 64 to get along with
273 the aggregatable address.
274 But 0 is assumed if
275 .Cm default
276 is specified.
277 Note that the qualifier works only for
278 .Dv AF_INET6
279 address family.
280 .Pp
281 Routes have associated flags which influence operation of the protocols
282 when sending to destinations matched by the routes.
283 These flags may be set (or sometimes cleared)
284 by indicating the following corresponding modifiers:
285 .Bd -literal
286 -cloning   RTF_CLONING    - generates a new route on use
287 -xresolve  RTF_XRESOLVE   - emit mesg on use (for external lookup)
288 -iface    ~RTF_GATEWAY    - destination is directly reachable
289 -static    RTF_STATIC     - manually added route
290 -nostatic ~RTF_STATIC     - pretend route added by kernel or daemon
291 -reject    RTF_REJECT     - emit an ICMP unreachable when matched
292 -blackhole RTF_BLACKHOLE  - silently discard pkts (during updates)
293 -proto1    RTF_PROTO1     - set protocol specific routing flag #1
294 -proto2    RTF_PROTO2     - set protocol specific routing flag #2
295 -llinfo    RTF_LLINFO     - validly translates proto addr to link addr
296 .Ed
297 .Pp
298 The optional modifiers
299 .Fl rtt ,
300 .Fl rttvar ,
301 .Fl sendpipe ,
302 .Fl recvpipe ,
303 .Fl mtu ,
304 .Fl hopcount ,
305 .Fl expire ,
306 and
307 .Fl ssthresh
308 provide initial values to quantities maintained in the routing entry
309 by transport level protocols, such as TCP or TP4.
310 These may be individually locked by preceding each such modifier to
311 be locked by
312 the
313 .Fl lock
314 meta-modifier, or one can
315 specify that all ensuing metrics may be locked by the
316 .Fl lockrest
317 meta-modifier.
318 .Pp
319 In a
320 .Cm change
321 or
322 .Cm add
323 command where the destination and gateway are not sufficient to specify
324 the route (as in the
325 .Tn ISO
326 case where several interfaces may have the
327 same address), the
328 .Fl ifp
329 or
330 .Fl ifa
331 modifiers may be used to determine the interface or interface address.
332 .Pp
333 The optional
334 .Fl proxy
335 modifier specifies that the
336 .Dv RTF_LLINFO
337 routing table entry is the
338 .Dq published (proxy-only)
339 .Tn ARP
340 entry, as reported by
341 .Xr arp 8 .
342 .Pp
343 All symbolic names specified for a
344 .Ar destination
345 or
346 .Ar gateway
347 are looked up first as a host name using
348 .Xr gethostbyname 3 .
349 If this lookup fails,
350 .Xr getnetbyname 3
351 is then used to interpret the name as that of a network.
352 .Pp
353 The
354 .Nm
355 utility uses a routing socket and the new message types
356 .Dv RTM_ADD , RTM_DELETE , RTM_GET ,
357 and
358 .Dv RTM_CHANGE .
359 As such, only the super-user may modify
360 the routing tables.
361 .Sh DIAGNOSTICS
362 .Bl -diag
363 .It "add [host \&| network ] %s: gateway %s flags %x"
364 The specified route is being added to the tables.  The
365 values printed are from the routing table entry supplied
366 in the
367 .Xr ioctl 2
368 call.
369 If the gateway address used was not the primary address of the gateway
370 (the first one returned by
371 .Xr gethostbyname 3 ) ,
372 the gateway address is printed numerically as well as symbolically.
373 .It "delete [ host \&| network ] %s: gateway %s flags %x"
374 As above, but when deleting an entry.
375 .It "%s %s done"
376 When the
377 .Cm flush
378 command is specified, each routing table entry deleted
379 is indicated with a message of this form.
380 .It "Network is unreachable"
381 An attempt to add a route failed because the gateway listed was not
382 on a directly-connected network.
383 The next-hop gateway must be given.
384 .It "not in table"
385 A delete operation was attempted for an entry which
386 wasn't present in the tables.
387 .It "routing table overflow"
388 An add operation was attempted, but the system was
389 low on resources and was unable to allocate memory
390 to create the new entry.
391 .It "gateway uses the same route"
392 A
393 .Cm change
394 operation resulted in a route whose gateway uses the
395 same route as the one being changed.
396 The next-hop gateway should be reachable through a different route.
397 .El
398 .Pp
399 .Ex -std
400 .Sh SEE ALSO
401 .\".Xr esis 4 ,
402 .Xr netintro 4 ,
403 .Xr route 4 ,
404 .Xr arp 8 ,
405 .Xr IPXrouted 8 ,
406 .Xr routed 8
407 .\".Xr XNSrouted 8
408 .Sh HISTORY
409 The
410 .Nm
411 utility appeared in
412 .Bx 4.2 .
413 .Sh BUGS
414 The first paragraph may have slightly exaggerated
415 .Xr routed 8 Ns 's
416 abilities.