How to Troubleshoot Packet Loss with Ping Command
Packet loss is a common problem in the IP networks. Ping, although simple, is an excellent tool in order to troubleshoot packet loss issues. This post describes how we can detect packet loss in a network using the ping command.
One good way to troubleshoot packet loss issues is to define a large number of ping counts (for example 500) when using the ping command. In this way, it is more possible to catch random packet loss and its pattern will be clearly distinguished by the dots among the exclamation marks. An example of a ping output with packet loss in a Cisco router is shown in the picture below:
You can see in the picture that the ping count is set to 300, and 81% packet loss is detected in the network.
You can even stress the network further by defining a different ICMP packet size close to the MTU size (for example 1300 bytes). This could be helpful in some cases of network congestion or rate limiting implementations since more processing in needed for larger packets.
When ICMP rate limiting is configured in the network, then there is usually a symmetric pattern of packet loss in the ping output -since there is a fixed rate of accepted ICMP packets configured-, so this should give you a hint.
Now if there is indeed packet loss, how can we detect where in the network it happens, especially if there are a lot of router hops in between? There are different ways to do this. For example, a traceroute can help to see if there is some strange behavior between hops in the path, e.g. latency. One other way would be to try to investigate the connectivity hop-by-hop, for example try to ping from the source router to each router (hop) in the path separately and check in that way towards which router packet loss appears when pinging.
However, in cases of asymmetric routing (where the path from source to destination is different from the path from destination back to the source) the packet loss can be caused because of some problem in the path on the way back (from the destination to the source). In these cases, you probably also need to check the other path too.
This post described some tips on how to troubleshoot packet loss in the network by using the ping command. Later posts will provide further information and details on how to troubleshoot packet loss or other network issues with ping command.