Ping (Packet Internet Grouper[groper] or Packet Inter-Network Groper) is a network utility used to check the IP connectivity between the host computer or device to a destination device. This can almost be said of as the starting point any network troubleshooting.
Ping utility sends Internet Control Message Protocol (ICMP) requests to the target device and confirms connectivity with a ICMP response or reply from the target host.
The Ping utility displays the ICMP response message and the Round Trip Time (RTT).
The possible messages or response include
"Reply from" , "Request Timed Out", "Destination Unreacheable", "TTL expired in Transit", "Network Unreacheable"
Example:
C:\>ping 192.168.0.1
Pinging 192.168.0.1 with 32 bytes of data:
Reply from 192.168.0.1: bytes=32 time=20ms TTL=64
Reply from 192.168.0.1: bytes=32 time=1ms TTL=64
Reply from 192.168.0.1: bytes=32 time=14ms TTL=64
Reply from 192.168.0.1: bytes=32 time=18ms TTL=64
Ping statistics for 192.168.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 20ms, Average = 13ms
C:\>ping 192.168.0.3
Pinging 192.168.0.3 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.0.3:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Ping in Windows by default sends 4 packets however this can be altered accordingly. The following are the most commonly used switches with PING in Windows:
-t : Ping continously until stopped by Ctrl+C sequence. Ctrl+Break shows statistics and continue to ping the host
-n : Number of ICMP echo requeests to be sent
-a : Resolve addresses to hostnames.
Advanced switches include,
-l size : Send buffer size.
-f : Set Don't Fragment flag in packet.
-i TTL: Time To Live.
-v TOS : Type Of Service.
-r count : Record route for count hops.
-s count : Timestamp for count hops.
-j host-list : Loose source route along host-list.
-k host-list : Strict source route along host-list.
-w timeout : Timeout in milliseconds to wait for each reply.
Ping in UNIX and LINUX versions use the following switches:
-n : Numeric output only. No NS lookup
-c count : Number of ICMP echo requests to be sent
-v : Verbose output. ICMP packets other than ECHO_RESPONSE that are
received are listed.
More advanced switches are as follws:
-f : Flood ping. Outputs packets as fast as they come back or one hundred times per second, whichever is more. For every Echo Request [ECHO_REQUEST] sent a period “.'' is printed, while for ever Echo Reply [ECHO_REPLY] received a backspace is printed. This provides a rapid display of how many packets are being dropped.
-d : Set the SO_DEBUG option on the socket being used.
-i wait : Wait time between packets. Incompatible with the -f option.
-l preload : If preload is specified, ping sends that many packets as fast as possible before falling into its normal mode of behavior.
-p pattern : You may specify up to 16 “pad'' bytes to fill out the packet you
send. This is useful for diagnosing data-dependent problems in a network.
-q : Quiet output. Nothing is displayed except the summary lines at startup time and when finished.
-R : Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets. Note that the IP header is only large enough for nine such routes. Many hosts ignore or discard this option.
-r : Bypass the normal routing tables and send directly to a host on an attached network. If the host is not on a directly-attached network, an error is returned. This option can be used to ping a local host through an interface that has no route through it
-s packetsize : Specifies the number of data bytes to be sent. The default is
56, which translates into 64 ICMP data bytes when combined with
the 8 bytes of ICMP header data.
A more detailed WIKI article can be found here