1 .\" Copyright (c) 1983, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)route.8 8.3 (Berkeley) 3/19/94
29 .\" $FreeBSD: src/sbin/route/route.8,v 1.17.2.9 2003/02/24 00:56:43 trhodes Exp $
36 .Nd manually manipulate the routing tables
49 utility is used to manually manipulate the network
50 routing tables. It normally is not needed, as a
51 system routing table management daemon such as
53 should tend to this task.
57 utility supports a limited number of general options,
58 but a rich command language, enabling the user to specify
59 any arbitrary request that could be delivered via the
60 programmatic interface discussed in
63 The following options are available:
64 .Bl -tag -width indent
66 On SMP systems the route table is replicated. This option allows the
67 route table for a specific cpu to be accessed and exists primarily
68 for debugging purposes.
70 (debug) Print additional details for monitor and rtmsg commands.
72 Bypass attempts to print host and network names symbolically
73 when reporting actions. (The process of translating between symbolic
74 names and numerical equivalents can be quite time consuming, and
75 may require correct operation of the network; thus it may be expedient
76 to forget this, especially when attempting to repair networking operations).
78 (verbose) Print additional details.
80 Suppress all output from the
86 Print the full width of the data being represented even if it would overflow
92 utility provides six commands:
94 .Bl -tag -width Fl -compact
100 Delete a specific route.
102 Change aspects of a route (such as its gateway).
104 Lookup and display the route for a destination.
106 Print out the route table similar to
111 Continuously report any changes to the routing information base,
112 routing lookup misses, or suspected network partitionings.
115 The monitor command has the syntax:
117 .Bd -ragged -offset indent -compact
123 The flush command has the syntax:
125 .Bd -ragged -offset indent -compact
134 command is specified,
138 the routing tables of all gateway entries.
139 When the address family may is specified by any of the
143 modifiers, only routes having destinations with addresses in the
144 delineated family will be deleted.
146 The other commands have the following syntax:
148 .Bd -ragged -offset indent -compact
152 .Op Fl net No \&| Fl host
153 .Ar destination gateway
159 is the destination host or network,
161 is the next-hop intermediary via which packets should be routed.
162 Routes to a particular host may be distinguished from those to
163 a network by interpreting the Internet address specified as the
166 The optional modifiers
170 force the destination to be interpreted as a network or a host, respectively.
174 .Dq local address part
180 is the symbolic name of a network, then the route is
181 assumed to be to a network; otherwise, it is presumed to be a
185 could also be specified in the
186 .Ar net Ns / Ns Ar bits
192 .Fl host Li 128.0.0.32 ;
195 .Fl host Li 128.32.0.130 ;
199 .Fl net Li 128.32.130
205 .Fl net Li 192.168.64 Fl netmask Li 255.255.240.0 .
213 which is the default route.
215 If the destination is directly reachable
216 via an interface requiring
217 no intermediary system to act as a gateway, the
219 modifier should be specified;
220 the gateway given is the address of this host on the common network,
221 indicating the interface to be used for transmission.
222 Alternately, if the interface is point-to-point, the name of the interface
223 itself may be given, in which case the route remains valid even
224 if the local or remote addresses change.
226 The optional modifiers
230 specify that all subsequent addresses are in the
233 or are specified as link-level addresses,
234 and the names must be numeric specifications rather than
239 modifier is intended to manually add subnet routes with
240 netmasks different from that of the implied network interface.
241 One specifies an additional ensuing address parameter
242 (to be interpreted as a network mask).
243 The implicit network mask generated in the AF_INET case
244 can be overridden by making sure this option follows the destination parameter.
251 is available instead of the
253 qualifier because non-continuous masks are not allowed in IPv6.
256 specifies network mask of
257 .Li ffff:ffff:0000:0000:0000:0000:0000:0000
259 The default value of prefixlen is 64 to get along with
260 the aggregatable address.
264 Note that the qualifier works only for
268 Routes have associated flags which influence operation of the protocols
269 when sending to destinations matched by the routes.
270 These flags may be set (or sometimes cleared)
271 by indicating the following corresponding modifiers:
273 -cloning RTF_CLONING - generates a new route on use
274 -xresolve RTF_XRESOLVE - emit mesg on use (for external lookup)
275 -iface ~RTF_GATEWAY - destination is directly reachable
276 -static RTF_STATIC - manually added route
277 -nostatic ~RTF_STATIC - pretend route added by kernel or daemon
278 -reject RTF_REJECT - emit an ICMP unreachable when matched
279 -blackhole RTF_BLACKHOLE - silently discard pkts (during updates)
280 -proto1 RTF_PROTO1 - set protocol specific routing flag #1
281 -proto2 RTF_PROTO2 - set protocol specific routing flag #2
282 -llinfo RTF_LLINFO - validly translates proto addr to link addr
285 The optional modifiers
298 provide initial values to quantities maintained in the routing entry
299 by transport level protocols, such as TCP or TP4.
300 These may be individually locked by preceding each such modifier to
304 meta-modifier, or one can
305 specify that all ensuing metrics may be locked by the
313 command where the destination and gateway are not sufficient to specify
316 case where several interfaces may have the
321 modifiers may be used to determine the interface or interface address.
325 modifier specifies that the
327 routing table entry is the
328 .Dq published (proxy-only)
330 entry, as reported by
333 All symbolic names specified for a
337 are looked up first as a host name using
338 .Xr gethostbyname 3 .
339 If this lookup fails,
341 is then used to interpret the name as that of a network.
348 modifiers may be used to specify the desired MPLS label
349 operations for the route. Each route may have up to 3
350 label operations assigned to it. The label operations
351 may be combined between them, but specifically the
355 operations may be repeated if the intent is to push or pop
356 more than one label at once. The
358 operation always swaps the outer label and may not be
360 Here are some MPLS route examples:
362 Add an normal inet route, but push an MPLS
366 .Bd -ragged -offset indent -compact
369 .Ar destination gateway
374 Add an normal inet route, but double-push an MPLS
380 .Bd -ragged -offset indent -compact
383 .Ar destination gateway
390 Add an MPLS route for an
394 and swap that label with
397 .Bd -ragged -offset indent -compact
410 utility uses a routing socket and the new message types
411 .Dv RTM_ADD , RTM_DELETE , RTM_GET ,
414 As such, only the super-user may modify
419 .Bl -tag -width indent
420 .It Sy "add [host \&| network ] %s: gateway %s flags %x"
421 The specified route is being added to the tables. The
422 values printed are from the routing table entry supplied
426 If the gateway address used was not the primary address of the gateway
427 (the first one returned by
428 .Xr gethostbyname 3 ) ,
429 the gateway address is printed numerically as well as symbolically.
430 .It Sy "delete [ host \&| network ] %s: gateway %s flags %x"
431 As above, but when deleting an entry.
435 command is specified, each routing table entry deleted
436 is indicated with a message of this form.
437 .It Sy "Network is unreachable"
438 An attempt to add a route failed because the gateway listed was not
439 on a directly-connected network.
440 The next-hop gateway must be given.
441 .It Sy "not in table"
442 A delete operation was attempted for an entry which
443 wasn't present in the tables.
444 .It Sy "routing table overflow"
445 An add operation was attempted, but the system was
446 low on resources and was unable to allocate memory
447 to create the new entry.
448 .It Sy "gateway uses the same route"
451 operation resulted in a route whose gateway uses the
452 same route as the one being changed.
453 The next-hop gateway should be reachable through a different route.
467 The first paragraph may have slightly exaggerated