Reply to comment

Watchdog: Restarting WiFi on OpenWRT if the Link Goes Away

I put my WRT54G into a noisy electrical environment, and it seems to cause the wifi to fade out a couple times a week, sometimes permanently. (I did this after using a USB adapter on Windows proved too unstable.)

After some experimentation, this script below seems to do a reasonable job of keeping it up. Save it, and put it into the crontab. (You have to install the crond package.) The gateway is at

#! /bin/sh

# Checks if the wifi conn is up.  If not, it tries to restart
# the wifi.  If that fails, then reboot.

if ping -c 1 > /dev/null
        echo nothing > /dev/null
        ifdown wifi
        ifup wifi
        killall wifi
        sleep 30
        if ping -c > /dev/null
                echo nothing > /dev/null
                date >> /reboot.log

(Note that the date in reboot log will be the same, because the clock is not set right after booting.)


The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.

More information about formatting options

8 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.