What is ping?

Ping(Packet InterNet Groper) is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer and back.

Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP echo reply. It measures the round-trip time from transmission to reception, reporting errors and packet loss.

Unix/Linux ping command and parameters

$ ping -help
Usage: ping [-LRUbdfnqrvVaAD] [-c count] [-i interval] [-w deadline]
            [-p pattern] [-s packetsize] [-t ttl] [-I interface]
            [-M pmtudisc-hint] [-m mark] [-S sndbuf]
            [-T tstamp-options] [-Q tos] [hop1 ...] destination

Many systems provide a companion utility ping6, for similar testing on Internet Protocol version 6 (IPv6) networks.

$ ping6 -help
Usage: ping6 [-LUdfnqrvVaAD] [-c count] [-i interval] [-w deadline]
             [-p pattern] [-s packetsize] [-t ttl] [-I interface]
             [-M pmtudisc-hint] [-S sndbuf] [-F flowlabel] [-Q tclass]
             [[-N nodeinfo-option] ...]
             [hop1 ...] destination

Windows ping command and parameters

C:\>ping /?

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
            [-r count] [-s count] [[-j host-list] | [-k host-list]]
            [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name

    -t             Ping the specified host until stopped.
                   To see statistics and continue - type Control-Break;
                   To stop - type Control-C.
    -a             Resolve addresses to hostnames.
    -n count       Number of echo requests to send.
    -l size        Send buffer size.
    -f             Set Don't Fragment flag in packet (IPv4-only).
    -i TTL         Time To Live.
    -v TOS         Type Of Service (IPv4-only. This setting has been deprecated
                   and has no effect on the type of service field in the IP Header).
    -r count       Record route for count hops (IPv4-only).
    -s count       Timestamp for count hops (IPv4-only).
    -j host-list   Loose source route along host-list (IPv4-only).
    -k host-list   Strict source route along host-list (IPv4-only).
    -w timeout     Timeout in milliseconds to wait for each reply.
    -R             Use routing header to test reverse route also (IPv6-only).
    -S srcaddr     Source address to use.
    -4             Force using IPv4.
    -6             Force using IPv6.

Sample ping test

The following is the output of running ping under Linux for sending five probes to the target host www.yahoo.com.

$ ping -c 5 www.yahoo.com
PING www.yahoo.com ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=47 time=22.8 ms
64 bytes from icmp_req=2 ttl=47 time=22.3 ms
64 bytes from icmp_req=3 ttl=47 time=22.8 ms
64 bytes from icmp_req=4 ttl=47 time=22.2 ms
64 bytes from icmp_req=5 ttl=47 time=22.2 ms

--- www.yahoo.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 22.228/22.503/22.853/0.316 ms

The utility summarizes its results after completing the ping probes. The shortest round trip time(RTT) was 22.228 ms, the average was 22.503 ms, and the maximum value was 22.853 ms. The measurement had a standard deviation of 0.316 ms.

Other resources about ping