Technical data
ping
ping
Send ICMP ECHO_REQUEST packets to network hosts.
Format
ping [-dfnqruvR] -c count [-i wait] [-l preload] [-p pattern] [-s packetsize] host
Description
The
ping
command uses the ICMP (Internet Control Message Protocol)
mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE
message from the specified host or gateway host. ECHO_REQUEST datagrams
(
ping
) have an IP (Internet Protocol) and ICMP header, followed by a
struct timeval
and then an arbitrary number of pad bytes used to fill out
the packet.
When using
ping
for fault isolation, first run the command on the local host
to verify that the local network interface is up and running. Then, hosts and
gateways further and further away should be sent the
ping
command. Round-trip
times and packet loss statistics are computed. If duplicate packets are received,
they are not included in the packet loss calculations, although the round-trip
time of these packets is used in calculating the minimum, average, and maximum
round-trip time numbers. When the specified number of packets have been sent
(and received), or if the program is terminated with a SIGINT, a brief summary
is displayed.
This program is intended for use in network testing, measurement, and
management. Because of the load it can impose on the network, it is unwise
to use
ping
during normal operations or from automated scripts.
ICMP packet details
An IP header without options is 20 bytes. An ICMP ECHO_REQUEST packet
contains an additional 8 bytes worth of ICMP header followed by an arbitrary
amount of data. When a packetsize is given, this indicates the size of this extra
piece of data (the default is 56). Thus, the amount of data received inside of an
IP packet of type ICMP ECHO_REPLY will always be 8 bytes more than the
requested data space (the ICMP header).
If the data space is at least 8 bytes large,
ping
uses the first 8 bytes of this space
to include a timestamp, which it uses in the computation of round-trip times. If
less than 8 bytes of pad are specified, no round-trip times are given.
Duplicate and damaged packets
The
ping
command will report duplicate and damaged packets. Duplicate
packets should never occur, and seem to be caused by inappropriate link-level
retransmissions. Duplicates can occur in many situations and are rarely (if ever)
a good sign, although the presence of low levels of duplicates can not always be
cause for alarm.
Damaged packets are obviously serious cause for alarm and often indicate broken
hardware somewhere in the
ping
packet’s path (in the network or in the hosts).
Troubleshooting Utilities Reference A–27