Here's my situation: My router, running dd-wrt is set up to connect to my phone's hot-spot.

In general it is working well. The small problem is, obliviously the phone (4G) hot-spot it's not always available. (When hot-spot is not available there is no other wan connection).

When the phone's hot-spot becomes available, (turned on or gets in range) the router does not always connect to it automatically. Sometimes it does, sometimes I have to reboot it.

I did not set the Proxy Watchdog Service to prevent the router interface from hanging or rebooting when the hot-spot is not available. Is there a way to improve the auto-reconnect?

* TP-Link TL-WR841N
** Wireless Physical Interface is set to client mode

  • @Tim_Stewart TP-Link TL-WR841N
    – c0der
    Jun 30 '19 at 3:20
  • @Tim_Stewart I guess it can detect being off - line. I am not sure how it can detect that the hot-spot is available. If it does, can you post the script ?
    – c0der
    Jul 1 '19 at 15:17
  • @Tim_Stewart, thank you. I'll have to learn to use a script. I never had the need yet.
    – c0der
    Jul 1 '19 at 17:09

Unfortunately I could not find the script that I had customized for my buffalo N-finity's. I probably deleted them when i upgraded & gave the routers to a friend.

This is a script that I found on the DD-WRT forums for this purpose.
(You will probably have to tinker with this script for your router model)

A couple of things to note:

  • The router needs to have accurate time, make sure to set it up under the main setup tab, all the way at the bottom. (I use pool.ntp.org) You may have to save apply and reboot for it to take effect.
  • The system logs must be turned on and functioning under services tab -> system log -> syslogd enabled
  • This script checks the /var/log/messages folder to determine time and error messages. telnet or ssh into the router, check the log with tail -25 /var/log/messages and make sure there is output from the router in there. If not a reboot may be required.
  • You need to change the wireless interface in the script to reflect your routers interfaces names. most Broadcom interfaces will be "wl0" and most Atheros interfaces will be "ath0". you can find the names under the wireless tab in the web-GUI, or in the terminal with ifconfig.
  • Change the wait times to reflect the amount of time you actually need for your situation. I would think 2-3 mins would be acceptable in your situation.

By m1st0, 2011 with input from http://www.dd-wrt.com/wiki/index.php/Buffalo_WZR-HP-G300NH

#! /bin/sh

# Or just put it in the nvram startup
#nvram set rc_startup='{The Rest of this script}'

# set up variable to track waiting times
# Check interface every minute
logger "Starting to check wifi status"
while sleep 50; do
  # Check for the most recent message of WiFi dropping out, unsure if it is the same as the other hang below
  test_time=`date  +"%b %e %H:%M" | cut -c1-11`
  test_message=`grep "$test_time" /var/log/messages`
  test_wifi_down=`echo $test_message | fgrep ff:ff:ff:ff:ff:ff`
  test_beacon_issue=`echo $test_message | fgrep "Resetting; Code: 01"`
  if [ -n $test_wifi_down ];
  # If found then restart the WiFi interface
  then   logger "Wifi hang, restarting";
   ifconfig ath0 down;
        sleep 4;
        ifconfig ath0 up;
  # Check for the most recent message of WiFi hang, unser if it is the same as the dropping above
  elif [ -n $test_beacon_issue ];
  # If found then restart the WiFi interface
   logger "Wifi becon issue, restarting";
   ifconfig ath0 down;
        sleep 4;
        ifconfig ath0 up;
  # Wait a long while before we check again since we just restarted
  if [ $restarted_wifi == "true" ]; then
        logger "Will wait 542 seconds before checking wifi again";
        sleep 542;
        logger "Will start to check wifi every 50 seconds again";

Judging by the rep you have over at stack overflow, I think you will have no problems manipulating this script for your purposes. If you run into trouble just shoot me a message.

Some of these scripts may also be useful to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.