1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man1m / route.1m
blob711eea36373d5a927cabdab14b7298635cf2d4ad
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 "Feb 3, 2009"
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 .sp
44 .LP
45 \fBroute\fR manually manipulates the network routing tables. These tables are
46 normally maintained by the system routing daemon, such as \fBin.routed\fR(1M)
47 and \fBin.ripngd\fR(1M).
48 .sp
49 .LP
50 \fBroute\fR supports a limited number of general options, but a rich command
51 language. Users can specify an arbitrary request that can be delivered by means
52 of the programmatic interface discussed in \fBroute\fR(7P).
53 .sp
54 .LP
55 \fBroute\fR uses a routing socket and the new message types \fBRTM_ADD\fR,
56 \fBRTM_DELETE\fR, \fBRTM_GET\fR, and \fBRTM_CHANGE\fR. While only superusers
57 can modify routing tables, the \fBRTM_GET\fR operation is allowed for
58 non-privileged users.
59 .SH OPTIONS
60 .sp
61 .ne 2
62 .na
63 \fB\fB-f\fR\fR
64 .ad
65 .RS 15n
66 Flush the routing tables of all gateway entries. If you use the \fB-f\fR option
67 in conjunction with any of the \fBroute\fR sub-commands, \fBroute\fR flushes
68 the gateways before performing the sub-command. Specify the table to flush by
69 placing the \fBinet\fR or \fBinet6\fR modifier immediately after the \fB-f\fR
70 option. If unspecified, flushing IPv4 (\fBinet\fR) routes is the default.
71 .RE
73 .sp
74 .ne 2
75 .na
76 \fB\fB-n\fR\fR
77 .ad
78 .RS 15n
79 Prevent attempts to print host and network names symbolically when reporting
80 actions. This option is useful when name servers are unavailable.
81 .RE
83 .sp
84 .ne 2
85 .na
86 \fB\fB-p\fR\fR
87 .ad
88 .RS 15n
89 Make changes to the network route tables persistent across system restarts. The
90 operation is applied to the network routing tables first and, if successful, is
91 then applied to the list of saved routes used at system startup. In determining
92 whether an operation was successful, a failure to add a route that already
93 exists or to delete a route that is not in the routing table is ignored.
94 Particular care should be taken when using host or network names in persistent
95 routes, as network-based name resolution services are not available at the time
96 routes are added at startup.
97 .RE
99 .sp
100 .ne 2
102 \fB\fB-q\fR\fR
104 .RS 15n
105 Suppress all output.
109 .ne 2
111 \fB\fB-R\fR \fIroot-dir\fR\fR
113 .RS 15n
114 Specify an alternate root directory where \fBroute\fR applies changes. This
115 option is ignored unless used in conjunction with the \fB-p\fR option. When
116 \fB-R\fR is specified, route changes are applied only to the list of saved
117 routes to be used at startup, \fBnot\fR to the network routing tables. In
118 addition, certain checks, such as the existence of network interfaces used with
119 \fB-ifp\fR, are skipped. This can be useful from within JumpStart scripts,
120 where the root directory of the system being modified is in a location other
121 than \fB/\fR.
125 .ne 2
127 \fB\fB-v\fR\fR
129 .RS 15n
130 Print additional details in verbose mode.
133 .SS "Subcommands"
136 The following subcommands are supported:
138 .ne 2
140 \fB\fBadd\fR\fR
142 .RS 11n
143 Add a route.
147 .ne 2
149 \fB\fBchange\fR\fR
151 .RS 11n
152 Change aspects of a route (such as its gateway).
156 .ne 2
158 \fB\fBdelete\fR\fR
160 .RS 11n
161 Delete a specific route.
165 .ne 2
167 \fB\fBflush\fR\fR
169 .RS 11n
170 Remove all gateway entries from the routing table.
174 .ne 2
176 \fB\fBget\fR\fR
178 .RS 11n
179 Look up and display the route for a destination.
183 .ne 2
185 \fB\fBmonitor\fR\fR
187 .RS 11n
188 Continuously report any changes to the routing information base, routing lookup
189 misses, or suspected network partitionings.
193 .ne 2
195 \fB\fBshow\fR\fR
197 .RS 11n
198 Display the list of routes to be applied at system startup. Can be used only in
199 conjunction with the \fB-p\fR option.
204 The \fBadd\fR and \fBdelete\fR sub-commands have the following syntax:
206 .in +2
208 route [ -fnvq ] cmd \fIdestination\fR \fIgateway\fR [metric/netmask]
210 .in -2
215 where \fIcmd\fR is \fBadd\fR or \fBdelete\fR, \fIdestination\fR is the
216 destination host or network, and \fIgateway\fR is the next-hop intermediary
217 through which packets should be routed. Modifiers described in \fBOPERANDS\fR
218 can be placed anywhere on the command line.
221 The \fBget\fR and \fBchange\fR sub-commands have the following syntax:
223 .in +2
225 route [ -fnvq ] \fIcmd\fR \fIdestination\fR [\fIgateway\fR [metric/netmask]]
227 .in -2
232 where \fIcmd\fR is \fBget\fR or \fBchange\fR, \fIdestination\fR is the
233 destination host or network, and \fIgateway\fR is the next-hop intermediary
234 through which packets should be routed. Modifiers described in \fBOPERANDS\fR
235 can be placed anywhere on the command line.
238 The \fBmonitor\fR sub-command has the following syntax:
240 .in +2
242 route monitor [ -inet | -inet6 ]
244 .in -2
247 .SH OPERANDS
250 \fBroute\fR executes its sub-commands on routes to destinations by way of
251 gateways.
252 .SS "Destinations and Gateways"
255 By default, destination and gateway addresses are interpreted as IPv4
256 addresses. All symbolic names are tried first as a host name, using
257 \fBgetipnodebyname\fR(3SOCKET). If this lookup fails in the AF_INET case,
258 \fBgetnetbyname\fR(3SOCKET) interprets the name as that of a network.
261 Including an optional modifier on the command line before the address changes
262 how the \fBroute\fR sub-command interprets it.
265 The following modifiers are supported:
267 .ne 2
269 \fB\fB-inet\fR\fR
271 .RS 10n
272 Force the address to be interpreted as an IPv4 address, that is, under the
273 \fBAF_INET\fR address family.
277 .ne 2
279 \fB\fB-inet6\fR\fR
281 .RS 10n
282 Force the address to be interpreted as an IPv6 address, that is, under the
283 \fBAF_INET6\fR address family.
288 For IPv4 addresses, routes to a particular host are by default distinguished
289 from those to a network by interpreting the Internet address specified as the
290 destination. If the destination has a \fBlocal address part\fR (that is, the
291 portion not covered by the netmask) of \fB0\fR, or if the destination is
292 resolved as the symbolic name of a network, then the route is assumed to be to
293 a network; otherwise, it is presumed to be a route to a host.
296 You can force this selection by using one of the following modifiers:
298 .ne 2
300 \fB\fB-host\fR\fR
302 .RS 9n
303 Force the destination to be interpreted as a host.
307 .ne 2
309 \fB\fB-net\fR\fR
311 .RS 9n
312 Force the destination to be interpreted as a network.
317 For example:
322 c c
323 l l .
324 Destination     Destination Equivalent
326 \fB128.32\fR    \fB-host\fR \fB128.0.0.32\fR
327 \fB128.32.130\fR        \fB-host\fR \fB128.32.0.130\fR
328 \fB-net\fR \fB128.32\fR \fB128.32.0.0\fR
329 \fB-net\fR \fB128.32.130\fR     \fB\fR\fB128.32.130.0\fR
334 Two modifiers avoid confusion between addresses and keywords (for example.,
335 \fBhost\fR used as a symbolic host name). You can distinguish a
336 \fIdestination\fR by preceding it with the \fB-dst\fR modifier. You can
337 distinguish a gateway address by using the \fB-gateway\fR modifier. If the
338 destination is directly reachable by way of an interface requiring no
339 intermediary IP router to act as a gateway, this can be indicated by using the
340 \fB-interface\fR or \fB-iface\fR modifier.
343 In the following example, the route does not refer to an external gateway
344 (router), but rather to one of the machine's interfaces. Packets with IP
345 destination addresses matching the destination and mask on such a route are
346 sent out on the interface identified by the gateway address. For interfaces
347 using the ARP protocol, this type of route is used to specify that all matching
348 destinations are local to the physical link. That is, a host could be
349 configured to ARP for all addresses, without regard to the configured interface
350 netmask, by adding a default route using this command. For example:
352 .in +2
354 example# route add default \fIhostname\fR -interface
356 .in -2
361 where gateway address \fIhostname\fR is the name or IP address associated with
362 the network interface over which all matching packets should be sent. On a host
363 with a single network interface, \fIhostname\fR is usually the same as the
364 \fInodename\fR returned by the \fBuname -n\fR command. See \fBuname\fR(1).
367 For backward compatibility with older systems, directly reachable routes can
368 also be specified by placing a \fB0\fR after the gateway address:
370 .in +2
372 example# route add default \fIhostname\fR 0
374 .in -2
379 This value was once a route metric, but this metric is no longer used. If the
380 value is specified as \fB0\fR, then the destination is directly reachable
381 (equivalent to specifying \fB-\fR\fBinterface\fR). If it is non-zero but cannot
382 be interpreted as a subnet mask, then a gateway is used (default).
385 With the \fBAF_INET\fR address family or an IPv4 address, a separate subnet
386 mask can be specified. This can be specified in one of the following ways:
387 .RS +4
389 .ie t \(bu
390 .el o
391 IP address following the gateway address . This is typically specified in
392 \fIdecimal dot\fR notation as for \fBinet_addr\fR(3SOCKET) rather than in
393 symbolic form.
395 .RS +4
397 .ie t \(bu
398 .el o
399 IP address following the \fB-netmask\fR qualifier.
401 .RS +4
403 .ie t \(bu
404 .el o
405 Slash character and a decimal length appended to the destination address.
409 If a subnet mask is not specified, the mask used is the subnet mask of the
410 output interface selected by the gateway address, if the classful network of
411 the destination is the same as the classful network of the interface.
412 Otherwise, the classful network mask for the destination address is used.
415 Each of the following examples creates an IPv4 route to the destination
416 \fB192.0.2.32\fR subnet with a subnet mask of \fB255.255.255.224\fR:
418 .in +2
420 example# route add 192.0.2.32/27 somegateway
421 example# route add 192.0.2.32 -netmask 255.255.255.224 somegateway
422 example# route add 192.0.2.32 somegateway 255.255.255.224
424 .in -2
429 For IPv6, only the slash format is accepted. The following example creates an
430 IPv6 route to the destination \fB33fe::\fR with a netmask of \fB16\fR one-bits
431 followed by 112 zero-bits.
433 .in +2
435 example# route add -inet6 3ffe::/16 somegateway
437 .in -2
442 In cases where the gateway does not uniquely identify the output interface (for
443 example, when several interfaces have the same address), you can use the
444 \fB-ifp\fR \fIifname\fR modifier to specify the interface by name.  For
445 example, \fB\fR\fB-ifp\fR \fBlo0\fR associates the route with the \fBlo0\fR
446 interface. If the named interface is an underlying interface in an IPMP (IP
447 multipathing) group, then requests to add a route will automatically be
448 translated to the corresponding IPMP IP interface, and requests to delete or
449 change a route on an underlying interface will fail.
450 .SS "Routing Flags"
453 Routes have associated flags that influence operation of the protocols when
454 sending to destinations matched by the routes. These flags can be set (and in
455 some cases cleared, indicated by \fB~\fR) by including the following modifiers
456 on the command line:
461 c c c
462 l l l .
463 Modifier        Flag    Description
465 \fB-interface\fR        \fB~RTF_GATEWAY\fR      Destination is directly reachable
466 \fB-iface\fR    \fB~RTF_GATEWAY\fR      Alias for interface modifier
467 \fB-static\fR   \fBRTF_STATIC\fR        Manually added route
468 \fB-nostatic\fR \fB~RTF_STATIC\fR       T{
469 Pretend route was added by kernel or routing daemon
471 \fB-reject\fR   \fBRTF_REJECT\fR        Emit an ICMP unreachable when matched
472 \fB-blackhole\fR        \fBRTF_BLACKHOLE\fR     Silently discard packets duing updates
473 \fB-proto1\fR   \fBRTF_PROTO1\fR        Set protocol specific routing flag #1
474 \fB-proto2\fR   \fBRTF_PROTO2\fR        Set protocol specific routing flag #2
475 \fB-private\fR  \fBRTF_PRIVATE\fR       Do not advertise this route
476 \fB-multirt\fR  \fBRTF_MULTIRT\fR       Creates the specified redundant route
477 \fB-setsrc\fR   \fBRTF_SETSRC\fR        Assigns the default source address
482 The optional modifiers \fB-rtt\fR, \fB-rttvar\fR, \fB-sendpipe\fR,
483 \fB-recvpipe\fR, \fB-mtu\fR, \fB-hopcount\fR, \fB-expire\fR, and
484 \fB-ssthresh\fR provide initial values to quantities maintained in the routing
485 entry by transport level protocols, such as \fBTCP\fR. These can be
486 individually locked either by preceding each modifier to be locked by the
487 \fB-lock\fR meta-modifier, or by specifying that all ensuing metrics can be
488 locked by the \fB-lockrest\fR meta-modifier.
491 Some transport layer protocols can support only some of these metrics. The
492 following optional modifiers are supported:
494 .ne 2
496 \fB\fB-expire\fR\fR
498 .RS 13n
499 Lifetime for the entry. This optional modifier is not currently supported.
503 .ne 2
505 \fB\fB-hopcount\fR\fR
507 .RS 13n
508 Maximum hop count. This optional modifier is not currently supported.
512 .ne 2
514 \fB\fB-mtu\fR\fR
516 .RS 13n
517 Maximum MTU in bytes.
521 .ne 2
523 \fB\fB-recvpipe\fR\fR
525 .RS 13n
526 Receive pipe size in bytes.
530 .ne 2
532 \fB\fB-rtt\fR\fR
534 .RS 13n
535 Round trip time in microseconds.
539 .ne 2
541 \fB\fB-rttvar\fR\fR
543 .RS 13n
544 Round trip time variance in microseconds.
548 .ne 2
550 \fB\fB-sendpipe\fR\fR
552 .RS 13n
553 Send pipe size in bytes.
557 .ne 2
559 \fB\fB-ssthresh\fR\fR
561 .RS 13n
562 Send pipe size threshold in bytes.
566 .ne 2
568 \fB\fB-secattr\fR\fR
570 .RS 13n
571 Security attributes of the route. This modifier is available only if the system
572 is configured with the Solaris Trusted Extensions feature.
574 The \fB-secattr\fR modifier has the following format:
576 .in +2
578 min_sl=\fIval\fR,max_sl=\fIval\fR,doi=\fIval\fR,cipso
580 .in -2
584 .in +2
586 sl=VAL,doi=VAL,cipso
588 .in -2
590 In the first form, above, the \fIval\fR for \fBmin_sl\fR and \fBmax_sl\fR is a
591 sensitivity label in either hex or string form. The \fIval\fR for \fBdoi\fR is
592 a non-negative integer. The route will apply only for packets with the same
593 domain of interpretation as defined by the \fBdoi\fR value and within the
594 accreditation range defined by the \fBmin_sl\fR and \fBmax_sl\fR values. The
595 \fBcipso\fR keyword is optional and set by default. Valid \fBmin_sl\fR,
596 \fBmax_sl\fR and \fBdoi\fR keyword/value pairs are mandatory. Note that if
597 \fIval\fR contains a space, it must be protected by double quotes.
599 The second form, above, is equivalent to specifying the first form with the
600 same \fBVAL\fR for \fBmin_sl\fR and \fBmax_sl\fR. The second form should be
601 used for the \fBget\fR command, because \fBget\fR uses only a single
602 sensitivity label.
605 .SS "Compatibility"
608 The modifiers \fBhost\fR and \fBnet\fR are taken to be equivalent to
609 \fB-\fR\fBhost\fR and \fB-net\fR\fB\fR. To specify a symbolic address that
610 matches one of these names, use the \fBdst\fR or \fBgateway\fR keyword to
611 distinguish it. For example: \fB\fR\fB-dst\fR \fBhost\fR
614 The following two flags are also accepted for compatibility with older systems,
615 but have no effect.
620 c c
621 l l .
622 Modifier        Flag
624 \fB-cloning\fR  RTF_CLONING
625 \fB-xresolve\fR RTF_XRESOLVE
630 The \fB\fR\fB-ifa\fR \fBhostname\fR modifier is also accepted, but has no
631 effect.
632 .SH FILES
634 .ne 2
636 \fB\fB/etc/defaultrouter\fR\fR
638 .RS 22n
639 List of default routers
643 .ne 2
645 \fB\fB/etc/hosts\fR\fR
647 .RS 22n
648 List of host names and net addresses
652 .ne 2
654 \fB\fB/etc/networks\fR\fR
656 .RS 22n
657 List of network names and addresses
660 .SH SEE ALSO
663 \fBuname\fR(1), \fBin.ripngd\fR(1M), \fBin.routed\fR(1M), \fBnetstat\fR(1M),
664 \fBrouted\fR(1M), \fBioctl\fR(2), \fBgetipnodebyname\fR(3SOCKET),
665 \fBgetnetbyname\fR(3SOCKET), \fBinet_addr\fR(3SOCKET), \fBdefaultrouter\fR(4),
666 \fBhosts\fR(4), \fBnetworks\fR(4), \fBattributes\fR(5), \fBARP\fR(7P),
667 \fBip\fR(7P), \fBroute\fR(7P), \fBrouting\fR(7P)
668 .SH DIAGNOSTICS
670 .ne 2
672 \fB\fBadd\fR [ \fBhost\fR\||\ \fBnetwork\|]\fR \fIdestination\fR:\fIgateway\fR
673 \fIflags\fR\fR
675 .sp .6
676 .RS 4n
677 The specified route is being added to the tables. The values printed are from
678 the routing table entry supplied in the \fBioctl\fR(2) call. If the gateway
679 address used was not the primary address of the gateway (the first one returned
680 by \fBgetipnodebyname\fR(3SOCKET)) the gateway address is printed numerically
681 as well as symbolically.
685 .ne 2
687 \fB\fBdelete\fR [ \fBhost\fR\||\ \fBnetwork\fR\|]
688 \fIdestination\fR:\fIgateway\fR \fIflags\fR\fR
692 \fB\fBchange\fR [ \fBhost\fR\||\ \fBnetwork\fR\|]
693 \fIdestination\fR:\fIgateway\fR \fIflags\fR\fR
695 .sp .6
696 .RS 4n
697 As \fBadd\fR, but when deleting or changing an entry.
701 .ne 2
703 \fB\fIdestination\fR \fBdone\fR\fR
705 .sp .6
706 .RS 4n
707 When the \fB-f\fR flag is specified, or the \fBflush\fR sub-command is used,
708 each routing table entry deleted is indicated with a message of this form.
712 .ne 2
714 \fB\fBNetwork is unreachable\fR\fR
716 .sp .6
717 .RS 4n
718 An attempt to add a route failed because the gateway listed was not on a
719 directly-connected network. Give the next-hop gateway instead.
723 .ne 2
725 \fB\fBnot in table\fR\fR
727 .sp .6
728 .RS 4n
729 A \fBdelete\fR operation was attempted for an entry that is not in the table.
733 .ne 2
735 \fB\fBentry exists\fR\fR
737 .sp .6
738 .RS 4n
739 An \fBadd\fR operation was attempted for a route that already exists in the
740 kernel.
744 .ne 2
746 \fB\fBrouting table overflow\fR\fR
748 .sp .6
749 .RS 4n
750 An operation was attempted, but the system was unable to allocate memory to
751 create the new entry.
755 .ne 2
757 \fB\fBinsufficient privileges\fR\fR
759 .sp .6
760 .RS 4n
761 An attempt to add, delete, change, or flush a route failed because the calling
762 process does not have appropriate privileges.
765 .SH NOTES
768 Specifying that destinations are local (with the \fB-interface\fRmodifier)
769 assumes that the routers implement \fBproxy ARP\fR, meaning that they respond
770 to ARP queries for all reachable destinations. Normally, using either router
771 discovery or RIP is more reliable and scalable than using proxy ARP. See
772 \fBin.routed\fR(1M) for information related to RIP.
775 Combining the all destinations are local route with subnet or network routes
776 can lead to unpredictable results. The search order as it relates to the all
777 destinations are local route are undefined and can vary from release to
778 release.