In a previous blog post, I described that I had set up a smart plug that pings a pre-arranged IP address, and if the ping fails, the smart plug will power-cycle our modem and main router in our office.
The world we live in is enriched because there are smart people around us (not only smart plugs!). One of those smart people is alert reader Manuel Fortin, who commented:
Very interesting, but I see a problem with the ping feature. What address will you use? If the address is unreachable for any reason that is unrelated to your modem and router, you will just end up with an endless loop of resets. Pinging an address within your network will not reset the system in case you lose internet access. Pinging an address outside of your network would completely disable your network if that address only, or a subset of the internet, cannot be accessed. It happens that servers, even from the most reputable companies, experience problems, or that problems make some part of the internet impossible to access.
Of course he is exactly right. It is the Goldilocks problem. Ping a host that is too close, and the ping result tells you nothing of interest. Ping a host that is too far away, and the ping result might get overwhelmed with noise from Internet connectivity failures that have nothing to do with any good reason for power-cycling of your own modem or router. It needs to be “just right”. So how to do it “just right”? Continue reading