Posted: Tue Aug 10, 2021 14:42 Post subject: How EXACTLY does the "WDS/Connection Watchdog" set
I know in general that the "WDS/Connection Watchdog" setting on the Administration>Keep Alive page of DD-WRT can be used to automatically ping a specified IP address at a preset interval, and automatically reboot the router in the event it does not respond.
However, what is not explained in the help files is exactly HOW this setting functions. I.E. does it trigger a reboot immediately after a single failed ping response, or does it require a certain number of consecutive failed ping responses to trigger the reboot? I ask because I do not want this setting to be randomly rebooting the router due to brief packet loss/network interruptions caused by non-serious momentary problems (high network usage, brief less-than-a-few-seconds connection drops, etc).
WDS_WATCHDOG_INTERVAL_SEC=$(nvram get wds_watchdog_interval_sec)
WDS_WATCHDOG_IPS=$(nvram get wds_watchdog_ips)
while sleep $WDS_WATCHDOG_INTERVAL_SEC
do
for ip in $WDS_WATCHDOG_IPS
do
if ping -c 1 $ip > /tmp/null
then
echo "$ip ok"
else
echo "$ip dropped one"
sleep 10
if ! ping -c 1 $ip > /tmp/null
then
echo "$ip dropped two"
sleep 10
if ! ping -c 1 $ip > /tmp/null
then
echo "$ip dropped three, Restarting Router"
/usr/sbin/nvram commit
/sbin/reboot &
fi
fi
fi
done
done 2>&1
As stated previously, it checks up to three (3) times, waiting 10 seconds between each check. Only on the third failure does it reboot. The process loops, waiting the amount of time specified in the GUI between passes. Notice you can check multiple IPs as well.