Network Monitoring  «Prev  Next»

Lesson 2The ping command
ObjectiveUse the ping command to check network status.

Check Network Status using the ping Command

Undoubtedly the single most useful command for checking network status is ping. The ping command uses the Internet Control Message Protocol (ICMP)[1]. This protocol, which operates at the network layer of the TCP/IP[2] protocol stack, is used to pass error information among machines on the Internet.
In its simplest form, ping generates a series of ICMP echo-request packets directed at a particular machine. Upon receipt of such a packet, the target machine is required to generate an ICMP echo-reply packet directed at the sender. If these packets can be successfully exchanged, a network connection between the two machines exists.
View the series of images below to see how ping can be used to test network connectivity.

Note the sequence numbers (icmp_seq=0...), which let you see if packets are being received in the same order in which they are sent, and the time, which is the round-trip time for the packet.
1) Note the sequence numbers (icmp_seq=0...), which let you see if packets are being received in the same order in which they are sent, and the time, which is the round-trip time for the packet.

To see loss statistics, try:
2) To see loss statistics, try:

---acmecorp.com ping statistics--- <br>
1 packets transmitted, 1 packets received, 0% packet loss <br>
round-trip min/avg/max = 1.3/1.3/1.3 ms
3) ---acmecorp.com ping statistics---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 1.3/1.3/1.3 ms


Using ping when the Network is broken

You will often use ping when your network is broken. In particular, name service may not be available. In this case, you should use IP addresses instead of host names, and you should use the appropriate option to ping (usually -n) to tell the ping not to try to look up host names, but rather to report only numbers.

Useful options for the ping command

The table below lists useful options for the Linux version of the ping command.
[1] (ICMP)Internet control message protocol:ICMP is a protocol used to communicate errors or other conditions at the IP layer
[2]TCP/IP: TCP/IP is the network protocol suite used by the Internet and most local area networks.

SEMrush Software 2 SEMrush Banner 2