Hello,
i followed this guide:
on a TL-WDR3500 with a freshly installed
openwrt-22.03.5-ath79-generic-tplink_tl-wdr3500-v1-squashfs-factory.bin
All works fine after reboots. Then i added this "watchdog", which should reboot the router when something went wrong. But this script / crontab makes the device rebooting about every 1 min. I have checked this with: "tcpdump -Ani eth1 port 4919 and udp"
And to get ssh in failsafe mode to correct this error, I pressed the wps/reset button as soon as “Please press button now to enter failsafe” occur on terminal.
Add a watchdog (optional)
Adding a watchdog will ensure that the router restarts if anything stops working.
Important: Complete this step only after you have confirmed that the router is working properly.
Use SSH to log in to the router and add the file wg-watchdog.sh (provided below) in /root using nano.
First install nano: opkg update && opkg install nano`
Then run the command
nano /root/wg-watchdog.sh
.The wg-watchdog.sh file:
#!/bin/sh
# ping mullvad dns that can only be reached via the VPN tunnel
# if no contact, reboot!
tries=0
while [[ $tries -lt 5 ]]
do
if /bin/ping -c 1 10.64.0.1
then
echo "wg works"
exit 0
fi
echo "wg fail"
tries=$((tries+1))
done
echo "wg failed 5 times - rebooting"
reboot
Make the file executable using the command
chmod +x /root/wg-watchdog.sh
.Afterward, add the following entry in System → Scheduled Tasks in LuCI:
*/10 * * * * /root/wg-watchdog.sh
How to repair this wg-watchdog.sh script, so it only reboots when a real problem occurs? Thank you.
Solution is there:
in root terminal (e.g. ssh root@192.168.1.1) do:
rm /etc/crontabs/root (empty this to make sure the failing mullvad suggested watchdog is removed)
echo '* * * * * /usr/bin/wireguard_watchdog' >> /etc/crontabs/root
reboot