Friday, August 31, 2018

False Linux ping command results

I'm sorry if this is not the right subreddit to post this question but I couldn't think of a better place.

I have a Python script that pings an array of IPv4 addresses. It uses the Linux ping command to do so. This script is called by a cronjob on a fixed interval. It usually works, but every now and then the script falsely reports that a host is unreachable when I know for a fact that it's not. I also have a Node.js script that does the same and it has the same problem. I've tried running the scripts on different machines in different countries and the problem still persists.

When the script fails to ping a particular host, it retries 2 times, for a total of 3 attempts. If the 3rd attempt fails then it reports that the host cannot be reached.

At first the scripts pinged 5 hosts asynchronously at a time but I've tried lowering that number down to 1.

The two ping commands I've tried are "ping -c 5 <ip\_address>" and "ping -A -n -c 4 -w 2 <ip\_address>".

I've run out of ideas. Does anyone have any suggestions as to what the problem could be? I'm desperate.



No comments:

Post a Comment