6324 Add an `ndp' tool for manipulating the neighbors table
[illumos-gate.git] / usr / src / man / man1m / ping.1m
bloba5a29be2d607c9d0c6a1d4d888ca1c07428b2baf
1 '\" te
2 .\" Copyright (C) 2006, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" Copyright 2015, Joyent, Inc.
5 .\" 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.
6 .\" 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.
7 .\" 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]
8 .TH PING 1M "May 21, 2015"
9 .SH NAME
10 ping \- send ICMP (ICMP6) ECHO_REQUEST packets to network hosts
11 .SH SYNOPSIS
12 .LP
13 .nf
14 \fB/usr/sbin/ping\fR \fIhost\fR [\fItimeout\fR]
15 .fi
17 .LP
18 .nf
19 \fB/usr/sbin/ping\fR \fB-s\fR [\fB-l\fR | \fB-U\fR] [\fB-abdDLnrRv\fR] [\fB-A\fR \fIaddr_family\fR]
20      [\fB-c\fR \fItraffic_class\fR] [\fB-g\fR \fIgateway\fR [\fB-g\fR \fIgateway\fR...]]
21      [\fB-N\fR \fInext_hop_router\fR] [\fB-F\fR \fIflow_label\fR] [\fB-I\fR \fIinterval\fR]
22      [\fB-i\fR \fIinterface\fR] [\fB-P\fR \fItos\fR] [\fB-p\fR \fIport\fR] [\fB-t\fR \fIttl\fR] \fIhost\fR
23      [\fIdata_size\fR] [\fInpackets\fR]
24 .fi
26 .SH DESCRIPTION
27 .LP
28 The utility \fBping\fR utilizes the \fBICMP\fR (\fBICMP6\fR in IPv6) protocol's
29 \fBECHO_REQUEST\fR datagram to elicit an \fBICMP\fR (\fBICMP6\fR)
30 \fBECHO_RESPONSE\fR from the specified \fIhost\fR or network \fIgateway\fR. If
31 \fIhost\fR responds, \fBping\fR will print:
32 .sp
33 .in +2
34 .nf
35 \fIhost\fR is alive
36 .fi
37 .in -2
38 .sp
40 .sp
41 .LP
42 on the standard output and exit. Otherwise, after \fItimeout\fR seconds, it
43 will write:
44 .sp
45 .in +2
46 .nf
47 no answer from \fIhost\fR
48 .fi
49 .in -2
50 .sp
52 .sp
53 .LP
54 The default value of \fItimeout\fR is \fB20\fR seconds.
55 .sp
56 .LP
57 When you specify the s flag, sends one datagram per second (adjust with
58 \fB-I\fR) and prints one line of output for every \fBECHO_RESPONSE\fR that it
59 receives. \fBping\fR produces no output if there is no response. In this second
60 form, \fBping\fR computes round trip times and packet loss statistics; it
61 displays a summary of this information upon termination or timeout. The default
62 \fIdata_size\fR is \fB56\fR bytes, or you can specify a size with the
63 \fIdata_size\fR command-line argument. If you specify the optional
64 \fInpackets\fR, \fBping\fR sends \fBping\fR requests until it either sends
65 \fInpackets\fR requests or receives \fInpackets\fR replies.
66 .sp
67 .LP
68 When using \fBping\fR for fault isolation, first \fBping\fR the local host to
69 verify that the local network interface is running.
70 .SH OPTIONS
71 .LP
72 The following options are supported:
73 .sp
74 .ne 2
75 .na
76 \fB\fB-A\fR\ \fIaddr_family\fR\fR
77 .ad
78 .RS 24n
79 Specify the address family of the target host. \fIaddr_family\fR can be either
80 \fBinet\fR or \fBinet6\fR. Address family determines which protocol to use. For
81 an argument of \fBinet\fR, IPv4 is used. For \fBinet6\fR, IPv6 is used.
82 .sp
83 By default, if the name of a host is provided, not the literal \fBIP\fR
84 address, and a valid IPv6 address exists in the name service database,
85 \fBping\fR will use this address. Otherwise, if the name service database
86 contains an IPv4 address, it will try the IPv4 address.
87 .sp
88 Specify the address family \fBinet\fR or \fBinet6\fR to override the default
89 behavior. If the argument specified is \fBinet\fR, \fBping\fR will use the IPv4
90 address associated with the host name. If none exists, \fBping\fR will state
91 that the host is unknown and exit. It does not try to determine if an IPv6
92 address exists in the name service database.
93 .sp
94 If the specified argument is \fBinet6\fR, \fBping\fR uses the IPv6 address that
95 is associated with the host name. If none exists, \fBping\fR states that the
96 host is unknown and exits.
97 .RE
99 .sp
100 .ne 2
102 \fB\fB-D\fR\fR
104 .RS 24n
105 Don't allow probe packets to be fragmented. If the packet size exceeds the MTU
106 of a gateway it passes through, the gateway will reject it.
110 .ne 2
112 \fB\fB-F\fR\ \fIflow_label\fR\fR
114 .RS 24n
115 Specify the flow label of probe packets. The value must be an integer in the
116 range from 0 to 1048575. This option is valid only on IPv6.
120 .ne 2
122 \fB\fB-I\fR \fIinterval\fR\fR
124 .RS 24n
125 Turn on the statistics mode and specify the interval between successive
126 transmissions. The default is one second. See the discussion of the \fB-s\fR
127 option. The minimum interval is 0.01 seconds. It is an error to specify
128 a smaller interval.
132 .ne 2
134 \fB\fB-L\fR\fR
136 .RS 24n
137 Turn off loopback of multicast packets. Normally, members are in the host group
138 on the outgoing interface, a copy of the multicast packets will be delivered to
139 the local machine.
143 .ne 2
145 \fB\fB-N\fR \fInext_hop_router\fR\fR
147 .RS 24n
148 Specify a next-hop router so that the probe packet goes through the specified
149 router along its path to the target host. This option essentially bypasses the
150 system routing table and leaves the probe packet header unmodified. Only one
151 next-hop router can be specified.
155 .ne 2
157 \fB\fB-P\fR\ \fItos\fR\fR
159 .RS 24n
160 Set the type of service (\fItos\fR) in probe packets to the specified value.
161 The default is zero. The value must be an integer in the range from 0 to 255.
162 Gateways also in the path can route the probe packet differently, depending
163 upon the value of \fItos\fR that is set in the probe packet. This option is
164 valid only on IPv4.
168 .ne 2
170 \fB\fB-R\fR\fR
172 .RS 24n
173 Record route. Sets the IPv4 record route option, which stores the route of the
174 packet inside the IPv4 header. The contents of the record route are only
175 printed if the \fB-v\fR and \fB-s\fR options are given. They are only set on
176 return packets if the target host preserves the record route option across
177 echos, or the \fB-l\fR option is given. This option is valid only on IPv4.
181 .ne 2
183 \fB\fB-U\fR\fR
185 .RS 24n
186 Send \fBUDP\fR packets instead of \fBICMP\fR (\fBICMP6\fR) packets. \fBping\fR
187 sends \fBUDP\fR packets to consecutive ports expecting to receive back
188 \fBICMP\fR (\fBICMP6\fR) \fBPORT_UNREACHABLE\fR from the target host.
192 .ne 2
194 \fB\fB-a\fR\fR
196 .RS 24n
197 \fBping\fR all addresses, both IPv4 and IPv6, of the multihomed destination.
198 The output appears as if \fBping\fR has been run once for each \fBIP\fR address
199 of the destination. If this option is used together with \fB-A\fR, \fBping\fR
200 probes only the addresses that are of the specified address family. When used
201 with the \fB-s\fR option and \fInpackets\fR is not specified, \fBping\fR
202 continuously probes the destination addresses in a round robin fashion. If
203 \fInpackets\fR is specified, \fBping\fR sends \fInpackets\fR number of probes
204 to each \fBIP\fR address of the destination and then exits.
208 .ne 2
210 \fB\fB-b\fR\fR
212 .RS 24n
213 Bypass the global IPsec policy and send and receive packets in the clear for
214 this connection only. This option can be used to troubleshoot network
215 connectivity independent of IPsec. Because this option bypasses system-wide
216 policy for this connection, it can only be used by superuser or a user granted
217 the sys_net_config privilege.
221 .ne 2
223 \fB\fB-c\fR\ \fItraffic_class\fR\fR
225 .RS 24n
226 Specify the traffic class of probe packets. The value must be an integer in the
227 range from 0 to 255. Gateways along the path can route the probe packet
228 differently, depending upon the value of \fItraffic_class\fR set in the probe
229 packet. This option is valid only on IPv6.
233 .ne 2
235 \fB\fB-d\fR\fR
237 .RS 24n
238 Set the \fBSO_DEBUG\fR socket option.
242 .ne 2
244 \fB\fB-g\fR\ \fIgateway\fR\fR
246 .RS 24n
247 Specify a loose source route gateway so that the probe packet goes through the
248 specified host along the path to the target host. The maximum number of
249 gateways is 8 for IPv4 and 127 for IPv6. Note that some factors such as the
250 link \fBMTU\fR can further limit the number of gateways for IPv6.
254 .ne 2
256 \fB\fB-i\fR \fIinterface_address\fR\fR
258 .RS 24n
259 Specify the outgoing interface address to use for multicast packets for IPv4
260 and both multicast and unicast packets for IPv6. The default interface address
261 for multicast packets is determined from the (unicast) routing tables.
262 \fIinterface_address\fR can be a literal \fBIP\fR address, for example,
263 \fB10.123.100.99\fR, or an interface name, for example, \fBeri0\fR, or an
264 interface index, for example \fB2\fR.
268 .ne 2
270 \fB\fB-l\fR\fR
272 .RS 24n
273 Use to send the probe packet to the given host and back again using loose
274 source routing. Usually specified with the \fB-R\fR option. If any gateways are
275 specified using \fB-g\fR, they are visited twice, both to and from the
276 destination. This option is ignored if the \fB-U\fR option is used.
280 .ne 2
282 \fB\fB-n\fR\fR
284 .RS 24n
285 Show network addresses as numbers. \fBping\fR normally does a reverse name
286 lookup on the IP addresses it extracts from the packets received. The \fB-n\fR
287 option blocks the reverse lookup, so \fBping\fR prints IP addresses instead of
288 host names.
292 .ne 2
294 \fB\fB-p\fR\ \fIport\fR\fR
296 .RS 24n
297 Set the base \fBUDP\fR \fIport\fR number used in probes. This option is used
298 with the \fB-U\fR option. The default base \fIport\fR number is 33434. The
299 \fBping\fR utility starts setting the destination port number of \fBUDP\fR
300 packets to this base and increments it by one at each probe.
304 .ne 2
306 \fB\fB-r\fR\fR
308 .RS 24n
309 Bypass the normal routing tables and send directly to a host on an attached
310 network. If the host is not on a directly attached network, an error is
311 returned. This option can be used to \fBping\fR a local host through an
312 interface that has been dropped by the router daemon. See \fBin.routed\fR(1M).
316 .ne 2
318 \fB\fB-s\fR\fR
320 .RS 24n
321 Send one datagram per second and collect statistics.
325 .ne 2
327 \fB\fB-t\fR\ \fIttl\fR\fR
329 .RS 24n
330 Specify the IPv4 time to live, or IPv6 hop limit, for unicast and multicast
331 packets. The default time to live (hop limit) for unicast packets can be set
332 with the \fBndd\fR module, \fB/dev/icmp\fR, using the \fBicmp_ipv4_ttl\fR
333 variable for IPv4 and the \fBicmp_ipv6_hoplimit\fR variable for IPv6. The
334 default time to live (hop limit) for multicast is one hop. See \fBEXAMPLES\fR.
335 For further information, see\fBndd\fR(1M).
339 .ne 2
341 \fB\fB-v\fR\fR
343 .RS 24n
344 Verbose output. List any \fBICMP\fR (\fBICMP6\fR) packets, other than replies
345 from the target host.
348 .SH OPERANDS
349 .ne 2
351 \fB\fIhost\fR\fR
353 .RS 8n
354 The network host
357 .SH EXAMPLES
359 \fBExample 1 \fRUsing \fBping\fR With IPv6
362 This example shows \fBping\fR sending probe packets to all the IPv6 addresses
363 of the host \fBxyz\fR, one at a time. It sends an \fBICMP6\fR
364 \fBECHO_REQUEST\fR every second until the user interrupts it.
367 .in +2
369 istanbul% \fBping -s -A inet6 -a xyz\fR
370 PING xyz: 56 data bytes
371 64 bytes from xyz (4::114:a00:20ff:ab3d:83ed): icmp_seq=0. time=0.479 ms
372 64 bytes from xyz (fec0::114:a00:20ff:ab3d:83ed): icmp_seq=1. time=0.843 ms
373 64 bytes from xyz (4::114:a00:20ff:ab3d:83ed): icmp_seq=2. time=0.516 ms
374 64 bytes from xyz (fec0::114:a00:20ff:ab3d:83ed): icmp_seq=3. time=4.943 ms
375 64 bytes from xyz (4::114:a00:20ff:ab3d:83ed): icmp_seq=4. time=0.485 ms
376 64 bytes from xyz (fec0::114:a00:20ff:ab3d:83ed): icmp_seq=5. time=2.201 ms
378 ----xyz PING Statistics----
379 6 packets transmitted, 6 packets received, 0% packet loss
380 round-trip (ms)  min/avg/stddev = 0.479/1.583/4.943/1.823
382 .in -2
386 \fBExample 2 \fRUsing \fBndd\fR to Set the \fBicmp_ipv6_hoplimit\fR
389 This example shows the \fBndd\fR module, \fB/dev/icmp\fR, used to set the
390 \fBicmp_ipv6_hoplimit\fR.
393 .in +2
395 # ndd -set /dev/icmp icmp_ipv6_hoplimit 100
397 .in -2
400 .SH EXIT STATUS
402 The following exit values are returned:
404 .ne 2
406 \fB\fB0\fR\fR
408 .RS 12n
409 Successful operation; the machine is alive.
413 .ne 2
415 \fBnon-zero\fR
417 .RS 12n
418 An error has occurred. Either a malformed argument has been specified, or the
419 machine was not alive.
422 .SH SEE ALSO
424 \fBifconfig\fR(1M), \fBin.routed\fR(1M), \fBndd\fR(1M), \fBnetstat\fR(1M),
425 \fBrpcinfo\fR(1M), \fBtraceroute\fR(1M), \fBattributes\fR(5), \fBicmp\fR(7P),
426 \fBicmp6\fR(7P)
428 .SH DIAGNOSTICS
429 .ne 2
431 \fB\fBping: warning: ICMP responses received, but name service lookups
432 are taking a while. Use ping -n to disable name service lookups.\fB\fB
434 .sp .6
435 .RS 4n
436 When the
437 .B -n
438 flag is not specified,
439 .B ping
440 tries to lookup the name corresponding to the IP address that it
441 received via name services. If name services are unavailable, it may
442 take time before the system properly times out the name service lookups.
443 As a result, it may appear that no ICMP replies are being received when
444 they in fact are. This diagnostic indicates that this has occurred and
445 indicates that there are valid responses and that using the
446 .B -n
447 flag will stop this from occurring.
451 .ne 2
453 \fB\fBping: warning: timing accuracy diminished -- setsockopt
454 SO_TIMESTAMP failed\fR\fR
456 .sp .6
457 .RS 4n
458 By default, the system attempts to use the
459 .B SO_TIMESTAMP
460 socket option to allow for more accurate time stamps that reflect when
461 the ICMP echo replies were received by the system as opposed to when
462 they were received by the
463 .B ping
464 command. These differences may occur because an operator stopped the
465 process or because
466 .B ping
467 was blocked up behind a name service look up. When this diagnostic is
468 emitted, the
469 .B ping
470 command will continue to function, but it will be doing the time
471 stamping itself, which may cause the timing intervals reported to be
472 longer than they actually are.