Cisco Command Christmas Calendar #22: ping

The ping command is a very common and powerful tool for diagnosing basic network connectivity. The ping command sends a series of ICMP echo request packets to the destination address and waits for a reply. The ping is successful only if the echo request reaches the destination and the destination is able to send an echo reply back to the source before the timeout expires (two seconds by default). This guarantees IP reachability in both directions. The ping command uses different codes to signify specific condition:
  • ! = receipt of a reply
  • . = timeout while waiting for a reply
  • U = a destination unreachable error was received
  • Q = source quench (destination too busy)
  • M = could not fragment
  • ? = unknown packet type
  • & = packet lifetime exceeded

Example:

Router1#ping 12.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/8 ms

Issuing the ping command in user EXEC mode will generally offer fewer syntax options than issuing the ping command in privileged EXEC mode. If you enter the ping command without any keywords or argument values, an interactive system dialog prompts you for the additional syntax appropriate to the protocol you specify. This is called an extended ping. The extended ping is used to perform a more advanced check of host reachability and network connectivity. There is a multitude of options that can be set with the extended ping. For example, when a normal ping command is sent from a router, the source address of the ping is the IP address of the interface that the packet uses to exit the router. If an extended ping command is used, the source IP address can be changed to any IP address on the router. The extended ping can also specify the number of packets sent, the size of the packets, change the timeout, set the DF bit (do not fragment) to find the MTU size on the path, and so on. 

Router A#ping
Protocol [ip]:
Target IP address: 192.168.40.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.16.23.2
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 162.108.21.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/97/132 ms



Comments