OpenWRT: Simple WiFi & OpenVPN watchdog

Some of my OpenWRT routers depend on using a rather unstable wireless connection to reach my OpenVPN server. Although they reconnect very reliably for the most part, sometimes something goes wrong. This is where the watchdog script comes in. It pings the WLAN access point and VPN server every minute. If either one doesn’t respond for a few (configurable) minutes, the watchdog will restart the service. Here’s how it works:


Obsolete!

A new and improved watchping script is available, click here!

Configuration

First create a new configuration file /etc/config/watchping. This tells the watchdog which hosts to ping and configures the timeout for each service.

The scripts

Create the /usr/lib/watchping folder and upload these scripts:


Final touches

The watchdog script requires „fping“ to be installed on the router:

Check your system log and verify the watchdog started correctly:

Tested with OpenWRT 19.07

6 Kommentare

  1. Is it possible to watch an usb device, and reset it with „usbreset“ if it has connection problems?

    or maybe the better version:
    a custom watchdog provider, where I could check for an Exit code, and if it doesn’t match run an other command

  2. Pingback:OpenWRT: Improved Network/OpenVPN/WiFi watchdog – LUANI

  3. Thanks for your work.
    Can you adopt the script to watch out only for the wifi. I don’t need the VPN in my case.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert