i followed this guide:
on a TL-WDR3500 with a freshly installed
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
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 email@example.com) 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