I’ve recently observed packet loss on my home Internet connection and suspected that this was occurring on the downstream path. Unfortunately, ping, the tool normally used to measure packet loss doesn’t tell you anything about where the packet was lost – just that either the request to the destination or the reply from the destination was lost.
After a quick bit of Googling I couldn’t find a tool which measured one way packet loss so I fell back to combining a couple of tools. Hopefully the technique outlined here will be useful to others.
Note that the steps below require that you have control of both of the hosts you wish to measure packet loss between. It’s very easy and cheap to get a virtual machine on Amazon EC2 or other services so this shouldn’t be a huge barrier.
To measure packet loss on the path from host A to host B run the following commands.
tcpdump -nni ppp0 udp port 8787 > tmp.file
hping3 -i u100000 --destport 8787 -2 HOSTB
Let some time elapse and then press CTRL-C to stop hping3.
Press CTRL-C to stop tcpdump
cat tmp.file | egrep 8787 | wc -l
Now compare the number of UDP packets transmitted by hping3 to the number of packets captured by tcpdump (output of wc -l). If there is any difference there is packet loss from A to B.
Leave a Reply