PING (1M)PING

NAME

ping send ICMP ECHO_REQUEST packets

SYNOPSIS

ping [-r][-v]host [packetsize [count]]

DESCRIPTION

Ping is intended for use in network testing, measurement, and management, primarily for manual fault isolation. The DARPA Internet is a large and complex aggregation of network hardware connected by gateways. Tracking a single-point hardware or software failure can often be difficult. Ping uses the Internet Control Message Protocol (ICMP) mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. Because of the load it could impose on the network, it is unwise to use ping during normal operations or from automated scripts.

When using ping for fault isolation, first ping the local host to verify that the local network interface is up and running. Then, ping hosts and gateways farther and farther away to determine where a fault occurs.

ECHO_REQUEST datagrams (pings) consist of IP and ICMP headers followed by a struct timeval and an arbitrary number of bytes to fill out the packet. The default packet size is 64 bytes; this may be changed by specifying an alternate packetsize on the command line. The maximum packet size can be calculated by subtracting 48 bytes (for the UDP and IP headers with options) from the value of the tuneable parameter SOMOD_MSGSZ. Ping sends one datagram per second, and prints one line of output showing the round-trip time for every ECHO_RESPONSE returned. No output is produced if there is no response.

By default, ping continues to send packets until it is killed. If count is specified on the command line, ping will send the specified number of ECHO_REQUESTS, and exit when all responses have been either received or assumed lost. Summary round-trip time and packet loss statistics are displayed just before ping exits.

The -roption causes ping to bypass the normal routing tables and send datagrams directly to a host. An error will be returned if the host is not on a directly attached network. This option can be used to ping a local host through an interface that has no route (for example, after the interface was dropped by routed(1M)).

The -voption causes ping to display a message any time an ICMP packet other than an ECHO_RESPONSE is received.

DIAGNOSTICS

Exit status is zero for normal termination, a positive number for error termination.

SEE ALSO

netstat(1)

ifconfig(1M)

E-34

Issue 3