I'm continuously retrieving data from a remote sensor connected over Ethernet via a switch. I see that about twice per hour, the connection breaks down for a couple of seconds.

I know that the remote sensor doesn't reboot (it would log this), but I can't ping it anymore. Now I need to know if my connection to the Ethernet switch breaks down, or if it's the network connection of the sensor.

Any idea how?

  • 1
    A little script: ping to the sensors with the counter set to 1 (only one ping). If up wait nn seconds and repeat. If ping doesn't answer then ping to a well known and working ip (e.g. If it answers it is down the connection with the sensors, if it doesn't it is down the internet connection.
    – Hastur
    Apr 25, 2016 at 9:44
  • That's a good idea actually. I can just connect something to the switch where i'm rather sure it's stable. Than I run two endless ping commands, one to the sensor, one to the know good device. If I see timeouts in both, it's the PC or the switch. If it's only the sensor, it's the sensor.
    – fschmitt
    Apr 25, 2016 at 10:53
  • 1
    Try with a ping with interval of 1 second. Catch the exit status (in bash $?) or use it directly. In a one line bash while : ; do ping -c 1 ip_sensor || ping -c && echo " Sensor Down" || echo " Internet down" ; sleep 1s; done. Translate it for windows or use a bash under windows (cygwin, native if win 10, virtual machine [ok the last one too much :-) ]).
    – Hastur
    Apr 25, 2016 at 11:08

1 Answer 1


If you suspect the switch, you would really need to swap it out to test, as switches can't be seen in the IP path. That said, its a lot more likely to be a problem with the sensor - maybe a DHCP lease renewal issue ? (If its something like that, can you hard code its IP address ?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.