8980 BIOS clock is sometimes one hour fast
[unleashed.git] / usr / src / man / man1m / route.1m
blob3cafaee41a455a9c7c4e58bb48dc39eea3cf5062
1 '\" te
2 .\" Copyright (C) 2009, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ROUTE 1M "May 13, 2017"
7 .SH NAME
8 route \- manually manipulate the routing tables
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBroute\fR [\fB-fnvq\fR] \fIsub-command\fR [ [\fImodifiers\fR] \fIargs\fR]
13 .fi
15 .LP
16 .nf
17 \fBroute\fR [\fB-fnvq\fR] [\fB-p\fR [\fB-R\fR \fIroot-dir\fR]] add | delete [\fImodifiers\fR] \fIdestination\fR \fIgateway\fR
18      [\fIargs\fR]
19 .fi
21 .LP
22 .nf
23 \fBroute\fR [\fB-fnvq\fR] change | get [\fImodifiers\fR] \fIdestination\fR
24      [\fIgateway\fR [\fIargs\fR]]
25 .fi
27 .LP
28 .nf
29 \fBroute\fR [\fB-fn\fR] monitor [\fImodifiers\fR]
30 .fi
32 .LP
33 .nf
34 \fBroute\fR [\fB-fnvq\fR] flush [\fImodifiers\fR]
35 .fi
37 .LP
38 .nf
39 \fBroute\fR \fB-p\fR [\fB-R\fR \fIroot-dir\fR] show
40 .fi
42 .SH DESCRIPTION
43 .LP
44 \fBroute\fR manually manipulates the network routing tables. These tables are
45 normally maintained by the system routing daemon, such as \fBin.routed\fR(1M)
46 and \fBin.ripngd\fR(1M).
47 .sp
48 .LP
49 \fBroute\fR supports a limited number of general options, but a rich command
50 language. Users can specify an arbitrary request that can be delivered by means
51 of the programmatic interface discussed in \fBroute\fR(7P).
52 .sp
53 .LP
54 \fBroute\fR uses a routing socket and the new message types \fBRTM_ADD\fR,
55 \fBRTM_DELETE\fR, \fBRTM_GET\fR, and \fBRTM_CHANGE\fR. While only superusers
56 can modify routing tables, the \fBRTM_GET\fR operation is allowed for
57 non-privileged users.
58 .SH OPTIONS
59 .ne 2
60 .na
61 \fB\fB-f\fR\fR
62 .ad
63 .RS 15n
64 Flush the routing tables of all gateway entries. If you use the \fB-f\fR option
65 in conjunction with any of the \fBroute\fR subcommands, \fBroute\fR flushes
66 the gateways before performing the subcommand. Specify the table to flush by
67 placing the \fBinet\fR or \fBinet6\fR modifier immediately after the \fB-f\fR
68 option. If unspecified, flushing IPv4 (\fBinet\fR) routes is the default.
69 .RE
71 .sp
72 .ne 2
73 .na
74 \fB\fB-n\fR\fR
75 .ad
76 .RS 15n
77 Prevent attempts to print host and network names symbolically when reporting
78 actions. This option is useful when name servers are unavailable.
79 .RE
81 .sp
82 .ne 2
83 .na
84 \fB\fB-p\fR\fR
85 .ad
86 .RS 15n
87 Make changes to the network route tables persistent across system restarts. The
88 operation is applied to the network routing tables first and, if successful, is
89 then applied to the list of saved routes used at system startup. In determining
90 whether an operation was successful, a failure to add a route that already
91 exists or to delete a route that is not in the routing table is ignored.
92 Particular care should be taken when using host or network names in persistent
93 routes, as network-based name resolution services are not available at the time
94 routes are added at startup.
95 .RE
97 .sp
98 .ne 2
99 .na
100 \fB\fB-q\fR\fR
102 .RS 15n
103 Suppress all output.
107 .ne 2
109 \fB\fB-R\fR \fIroot-dir\fR\fR
111 .RS 15n
112 Specify an alternate root directory where \fBroute\fR applies changes. This
113 option is ignored unless used in conjunction with the \fB-p\fR option. When
114 \fB-R\fR is specified, route changes are applied only to the list of saved
115 routes to be used at startup, \fBnot\fR to the network routing tables. In
116 addition, certain checks, such as the existence of network interfaces used with
117 \fB-ifp\fR, are skipped.
121 .ne 2
123 \fB\fB-v\fR\fR
125 .RS 15n
126 Print additional details in verbose mode.
129 .SS "Subcommands"
131 The following subcommands are supported:
133 .ne 2
135 \fB\fBadd\fR\fR
137 .RS 11n
138 Add a route.
142 .ne 2
144 \fB\fBchange\fR\fR
146 .RS 11n
147 Change aspects of a route (such as its gateway).
151 .ne 2
153 \fB\fBdelete\fR\fR
155 .RS 11n
156 Delete a specific route.
160 .ne 2
162 \fB\fBflush\fR\fR
164 .RS 11n
165 Remove all gateway entries from the routing table.
169 .ne 2
171 \fB\fBget\fR\fR
173 .RS 11n
174 Look up and display the route for a destination.
178 .ne 2
180 \fB\fBmonitor\fR\fR
182 .RS 11n
183 Continuously report any changes to the routing information base, routing lookup
184 misses, or suspected network partitionings.
188 .ne 2
190 \fB\fBshow\fR\fR
192 .RS 11n
193 Display the list of routes to be applied at system startup. Can be used only in
194 conjunction with the \fB-p\fR option.
199 The \fBadd\fR and \fBdelete\fR subcommands have the following syntax:
201 .in +2
203 route [ -fnvq ] cmd \fIdestination\fR \fIgateway\fR [metric/netmask]
205 .in -2
210 where \fIcmd\fR is \fBadd\fR or \fBdelete\fR, \fIdestination\fR is the
211 destination host or network, and \fIgateway\fR is the next-hop intermediary
212 through which packets should be routed. Modifiers described in \fBOPERANDS\fR
213 can be placed anywhere on the command line.
216 The \fBget\fR and \fBchange\fR subcommands have the following syntax:
218 .in +2
220 route [ -fnvq ] \fIcmd\fR \fIdestination\fR [\fIgateway\fR [metric/netmask]]
222 .in -2
227 where \fIcmd\fR is \fBget\fR or \fBchange\fR, \fIdestination\fR is the
228 destination host or network, and \fIgateway\fR is the next-hop intermediary
229 through which packets should be routed. Modifiers described in \fBOPERANDS\fR
230 can be placed anywhere on the command line.
233 The \fBmonitor\fR subcommand has the following syntax:
235 .in +2
237 route monitor [ -inet | -inet6 ]
239 .in -2
242 .SH OPERANDS
244 \fBroute\fR executes its subcommands on routes to destinations by way of
245 gateways.
246 .SS "Destinations and Gateways"
248 By default, destination and gateway addresses are interpreted as IPv4
249 addresses. All symbolic names are tried first as a host name, using
250 \fBgetipnodebyname\fR(3SOCKET). If this lookup fails in the AF_INET case,
251 \fBgetnetbyname\fR(3SOCKET) interprets the name as that of a network.
254 Including an optional modifier on the command line before the address changes
255 how the \fBroute\fR subcommand interprets it.
258 The following modifiers are supported:
260 .ne 2
262 \fB\fB-inet\fR\fR
264 .RS 10n
265 Force the address to be interpreted as an IPv4 address, that is, under the
266 \fBAF_INET\fR address family.
270 .ne 2
272 \fB\fB-inet6\fR\fR
274 .RS 10n
275 Force the address to be interpreted as an IPv6 address, that is, under the
276 \fBAF_INET6\fR address family.
281 For IPv4 addresses, routes to a particular host are by default distinguished
282 from those to a network by interpreting the Internet address specified as the
283 destination. If the destination has a \fBlocal address part\fR (that is, the
284 portion not covered by the netmask) of \fB0\fR, or if the destination is
285 resolved as the symbolic name of a network, then the route is assumed to be to
286 a network; otherwise, it is presumed to be a route to a host.
289 You can force this selection by using one of the following modifiers:
291 .ne 2
293 \fB\fB-host\fR\fR
295 .RS 9n
296 Force the destination to be interpreted as a host.
300 .ne 2
302 \fB\fB-net\fR\fR
304 .RS 9n
305 Force the destination to be interpreted as a network.
310 For example:
315 c c
316 l l .
317 Destination     Destination Equivalent
319 \fB128.32\fR    \fB-host\fR \fB128.0.0.32\fR
320 \fB128.32.130\fR        \fB-host\fR \fB128.32.0.130\fR
321 \fB-net\fR \fB128.32\fR \fB128.32.0.0\fR
322 \fB-net\fR \fB128.32.130\fR     \fB\fR\fB128.32.130.0\fR
327 Two modifiers avoid confusion between addresses and keywords (for example.,
328 \fBhost\fR used as a symbolic host name). You can distinguish a
329 \fIdestination\fR by preceding it with the \fB-dst\fR modifier. You can
330 distinguish a gateway address by using the \fB-gateway\fR modifier. If the
331 destination is directly reachable by way of an interface requiring no
332 intermediary IP router to act as a gateway, this can be indicated by using the
333 \fB-interface\fR or \fB-iface\fR modifier.
336 In the following example, the route does not refer to an external gateway
337 (router), but rather to one of the machine's interfaces. Packets with IP
338 destination addresses matching the destination and mask on such a route are
339 sent out on the interface identified by the gateway address. For interfaces
340 using the ARP protocol, this type of route is used to specify that all matching
341 destinations are local to the physical link. That is, a host could be
342 configured to ARP for all addresses, without regard to the configured interface
343 netmask, by adding a default route using this command. For example:
345 .in +2
347 example# route add default \fIhostname\fR -interface
349 .in -2
354 where gateway address \fIhostname\fR is the name or IP address associated with
355 the network interface over which all matching packets should be sent. On a host
356 with a single network interface, \fIhostname\fR is usually the same as the
357 \fInodename\fR returned by the \fBuname -n\fR command. See \fBuname\fR(1).
360 For backward compatibility with older systems, directly reachable routes can
361 also be specified by placing a \fB0\fR after the gateway address:
363 .in +2
365 example# route add default \fIhostname\fR 0
367 .in -2
372 This value was once a route metric, but this metric is no longer used. If the
373 value is specified as \fB0\fR, then the destination is directly reachable
374 (equivalent to specifying \fB-\fR\fBinterface\fR). If it is non-zero but cannot
375 be interpreted as a subnet mask, then a gateway is used (default).
378 With the \fBAF_INET\fR address family or an IPv4 address, a separate subnet
379 mask can be specified. This can be specified in one of the following ways:
380 .RS +4
382 .ie t \(bu
383 .el o
384 IP address following the gateway address . This is typically specified in
385 \fIdecimal dot\fR notation as for \fBinet_addr\fR(3SOCKET) rather than in
386 symbolic form.
388 .RS +4
390 .ie t \(bu
391 .el o
392 IP address following the \fB-netmask\fR qualifier.
394 .RS +4
396 .ie t \(bu
397 .el o
398 Slash character and a decimal length appended to the destination address.
402 If a subnet mask is not specified, the mask used is the subnet mask of the
403 output interface selected by the gateway address, if the classful network of
404 the destination is the same as the classful network of the interface.
405 Otherwise, the classful network mask for the destination address is used.
408 Each of the following examples creates an IPv4 route to the destination
409 \fB192.0.2.32\fR subnet with a subnet mask of \fB255.255.255.224\fR:
411 .in +2
413 example# route add 192.0.2.32/27 somegateway
414 example# route add 192.0.2.32 -netmask 255.255.255.224 somegateway
415 example# route add 192.0.2.32 somegateway 255.255.255.224
417 .in -2
422 For IPv6, only the slash format is accepted. The following example creates an
423 IPv6 route to the destination \fB33fe::\fR with a netmask of \fB16\fR one-bits
424 followed by 112 zero-bits.
426 .in +2
428 example# route add -inet6 3ffe::/16 somegateway
430 .in -2
435 In cases where the gateway does not uniquely identify the output interface (for
436 example, when several interfaces have the same address), you can use the
437 \fB-ifp\fR \fIifname\fR modifier to specify the interface by name.  For
438 example, \fB\fR\fB-ifp\fR \fBlo0\fR associates the route with the \fBlo0\fR
439 interface. If the named interface is an underlying interface in an IPMP (IP
440 multipathing) group, then requests to add a route will automatically be
441 translated to the corresponding IPMP IP interface, and requests to delete or
442 change a route on an underlying interface will fail.
443 .SS "Routing Flags"
445 Routes have associated flags that influence operation of the protocols when
446 sending to destinations matched by the routes. These flags can be set (and in
447 some cases cleared, indicated by \fB~\fR) by including the following modifiers
448 on the command line:
453 c c c
454 l l l .
455 Modifier        Flag    Description
457 \fB-interface\fR        \fB~RTF_GATEWAY\fR      Destination is directly reachable
458 \fB-iface\fR    \fB~RTF_GATEWAY\fR      Alias for interface modifier
459 \fB-static\fR   \fBRTF_STATIC\fR        Manually added route
460 \fB-nostatic\fR \fB~RTF_STATIC\fR       T{
461 Pretend route was added by kernel or routing daemon
463 \fB-reject\fR   \fBRTF_REJECT\fR        Emit an ICMP unreachable when matched
464 \fB-blackhole\fR        \fBRTF_BLACKHOLE\fR     Silently discard packets duing updates
465 \fB-proto1\fR   \fBRTF_PROTO1\fR        Set protocol specific routing flag #1
466 \fB-proto2\fR   \fBRTF_PROTO2\fR        Set protocol specific routing flag #2
467 \fB-private\fR  \fBRTF_PRIVATE\fR       Do not advertise this route
468 \fB-multirt\fR  \fBRTF_MULTIRT\fR       Creates the specified redundant route
469 \fB-setsrc\fR   \fBRTF_SETSRC\fR        Assigns the default source address
474 The optional modifiers \fB-rtt\fR, \fB-rttvar\fR, \fB-sendpipe\fR,
475 \fB-recvpipe\fR, \fB-mtu\fR, \fB-hopcount\fR, \fB-expire\fR, and
476 \fB-ssthresh\fR provide initial values to quantities maintained in the routing
477 entry by transport level protocols, such as \fBTCP\fR. These can be
478 individually locked either by preceding each modifier to be locked by the
479 \fB-lock\fR meta-modifier, or by specifying that all ensuing metrics can be
480 locked by the \fB-lockrest\fR meta-modifier.
483 Some transport layer protocols can support only some of these metrics. The
484 following optional modifiers are supported:
486 .ne 2
488 \fB\fB-expire\fR\fR
490 .RS 13n
491 Lifetime for the entry. This optional modifier is not currently supported.
495 .ne 2
497 \fB\fB-hopcount\fR\fR
499 .RS 13n
500 Maximum hop count. This optional modifier is not currently supported.
504 .ne 2
506 \fB\fB-mtu\fR\fR
508 .RS 13n
509 Maximum MTU in bytes.
513 .ne 2
515 \fB\fB-recvpipe\fR\fR
517 .RS 13n
518 Receive pipe size in bytes.
522 .ne 2
524 \fB\fB-rtt\fR\fR
526 .RS 13n
527 Round trip time in microseconds.
531 .ne 2
533 \fB\fB-rttvar\fR\fR
535 .RS 13n
536 Round trip time variance in microseconds.
540 .ne 2
542 \fB\fB-sendpipe\fR\fR
544 .RS 13n
545 Send pipe size in bytes.
549 .ne 2
551 \fB\fB-ssthresh\fR\fR
553 .RS 13n
554 Send pipe size threshold in bytes.
558 .ne 2
560 \fB\fB-secattr\fR\fR
562 .RS 13n
563 Security attributes of the route. This modifier is available only if the system
564 is configured with the Solaris Trusted Extensions feature.
566 The \fB-secattr\fR modifier has the following format:
568 .in +2
570 min_sl=\fIval\fR,max_sl=\fIval\fR,doi=\fIval\fR,cipso
572 .in -2
576 .in +2
578 sl=VAL,doi=VAL,cipso
580 .in -2
582 In the first form, above, the \fIval\fR for \fBmin_sl\fR and \fBmax_sl\fR is a
583 sensitivity label in either hex or string form. The \fIval\fR for \fBdoi\fR is
584 a non-negative integer. The route will apply only for packets with the same
585 domain of interpretation as defined by the \fBdoi\fR value and within the
586 accreditation range defined by the \fBmin_sl\fR and \fBmax_sl\fR values. The
587 \fBcipso\fR keyword is optional and set by default. Valid \fBmin_sl\fR,
588 \fBmax_sl\fR and \fBdoi\fR keyword/value pairs are mandatory. Note that if
589 \fIval\fR contains a space, it must be protected by double quotes.
591 The second form, above, is equivalent to specifying the first form with the
592 same \fBVAL\fR for \fBmin_sl\fR and \fBmax_sl\fR. The second form should be
593 used for the \fBget\fR command, because \fBget\fR uses only a single
594 sensitivity label.
597 .SS "Compatibility"
599 The modifiers \fBhost\fR and \fBnet\fR are taken to be equivalent to
600 \fB-\fR\fBhost\fR and \fB-net\fR\fB\fR. To specify a symbolic address that
601 matches one of these names, use the \fBdst\fR or \fBgateway\fR keyword to
602 distinguish it. For example: \fB\fR\fB-dst\fR \fBhost\fR
605 The following two flags are also accepted for compatibility with older systems,
606 but have no effect.
611 c c
612 l l .
613 Modifier        Flag
615 \fB-cloning\fR  RTF_CLONING
616 \fB-xresolve\fR RTF_XRESOLVE
621 The \fB\fR\fB-ifa\fR \fBhostname\fR modifier is also accepted, but has no
622 effect.
623 .SH FILES
624 .ne 2
626 \fB\fB/etc/defaultrouter\fR\fR
628 .RS 22n
629 List of default routers
633 .ne 2
635 \fB\fB/etc/hosts\fR\fR
637 .RS 22n
638 List of host names and net addresses
642 .ne 2
644 \fB\fB/etc/networks\fR\fR
646 .RS 22n
647 List of network names and addresses
650 .SH SEE ALSO
652 \fBuname\fR(1), \fBin.ripngd\fR(1M), \fBin.routed\fR(1M), \fBnetstat\fR(1M),
653 \fBrouted\fR(1M), \fBioctl\fR(2), \fBgetipnodebyname\fR(3SOCKET),
654 \fBgetnetbyname\fR(3SOCKET), \fBinet_addr\fR(3SOCKET), \fBdefaultrouter\fR(4),
655 \fBhosts\fR(4), \fBnetworks\fR(4), \fBattributes\fR(5), \fBARP\fR(7P),
656 \fBip\fR(7P), \fBroute\fR(7P), \fBrouting\fR(7P)
657 .SH DIAGNOSTICS
658 .ne 2
660 \fB\fBadd\fR [ \fBhost\fR\||\ \fBnetwork\|]\fR \fIdestination\fR:\fIgateway\fR
661 \fIflags\fR\fR
663 .sp .6
664 .RS 4n
665 The specified route is being added to the tables. The values printed are from
666 the routing table entry supplied in the \fBioctl\fR(2) call. If the gateway
667 address used was not the primary address of the gateway (the first one returned
668 by \fBgetipnodebyname\fR(3SOCKET)) the gateway address is printed numerically
669 as well as symbolically.
673 .ne 2
675 \fB\fBdelete\fR [ \fBhost\fR\||\ \fBnetwork\fR\|]
676 \fIdestination\fR:\fIgateway\fR \fIflags\fR\fR
680 \fB\fBchange\fR [ \fBhost\fR\||\ \fBnetwork\fR\|]
681 \fIdestination\fR:\fIgateway\fR \fIflags\fR\fR
683 .sp .6
684 .RS 4n
685 As \fBadd\fR, but when deleting or changing an entry.
689 .ne 2
691 \fB\fIdestination\fR \fBdone\fR\fR
693 .sp .6
694 .RS 4n
695 When the \fB-f\fR flag is specified, or the \fBflush\fR subcommand is used,
696 each routing table entry deleted is indicated with a message of this form.
700 .ne 2
702 \fB\fBNetwork is unreachable\fR\fR
704 .sp .6
705 .RS 4n
706 An attempt to add a route failed because the gateway listed was not on a
707 directly-connected network. Give the next-hop gateway instead.
711 .ne 2
713 \fB\fBnot in table\fR\fR
715 .sp .6
716 .RS 4n
717 A \fBdelete\fR operation was attempted for an entry that is not in the table.
721 .ne 2
723 \fB\fBentry exists\fR\fR
725 .sp .6
726 .RS 4n
727 An \fBadd\fR operation was attempted for a route that already exists in the
728 kernel.
732 .ne 2
734 \fB\fBrouting table overflow\fR\fR
736 .sp .6
737 .RS 4n
738 An operation was attempted, but the system was unable to allocate memory to
739 create the new entry.
743 .ne 2
745 \fB\fBinsufficient privileges\fR\fR
747 .sp .6
748 .RS 4n
749 An attempt to add, delete, change, or flush a route failed because the calling
750 process does not have appropriate privileges.
753 .SH NOTES
755 Specifying that destinations are local (with the \fB-interface\fRmodifier)
756 assumes that the routers implement \fBproxy ARP\fR, meaning that they respond
757 to ARP queries for all reachable destinations. Normally, using either router
758 discovery or RIP is more reliable and scalable than using proxy ARP. See
759 \fBin.routed\fR(1M) for information related to RIP.
762 Combining the all destinations are local route with subnet or network routes
763 can lead to unpredictable results. The search order as it relates to the all
764 destinations are local route are undefined and can vary from release to
765 release.