DD-WRT 在可用時自動連接到手機熱點

DD-WRT 在可用時自動連接到手機熱點

這是我的情況:我的路由器,運行 dd-wrt ​​已設定為連接到我手機的熱點

總的來說,它運作良好。小問題是,顯然手機(4G)熱點並不總是可用。 (當熱點不可用時,就沒有其他 WAN 連線)。

當手機的熱點可用時(開啟或進入範圍內),路由器並不總是自動連接到它。有時會這樣,有時我必須重新啟動它。

我沒有設定代理看門狗服務以防止在熱點不可用時路由器介面掛起或重新啟動。有沒有辦法改善自動重新連線?


* TP-Link TL-WR841N
** 無線實體介面設定為客戶端模式

答案1

不幸的是,我找不到為我的 buffalo N-finity 定制的腳本。當我升級並將路由器送給朋友時,我可能刪除了它們。

這是我在 DD-WRT 論壇上找到的用於此目的的腳本。
您可能需要針對您的路由器模型修改此腳本

有幾點要注意:

  • 路由器需要有準確的時間,請確保在主設定標籤下進行設置,一直在底部。 (我使用 pool.ntp.org)您可能需要儲存應用程式並重新啟動才能生效。
  • 系統日誌必須打開並在以下情況下運行服務標籤 -> 系統日誌 -> syslogd 已啟用
  • 此腳本檢查 /var/log/messages 資料夾以確定時間和錯誤訊息。 telnet 或 ssh 進入路由器,檢查日誌tail -25 /var/log/messages並確保其中有路由器的輸出。如果不是,可能需要重新啟動。
  • 您需要變更腳本中的無線介面以反映您的路由器介面名稱。大多數 Broadcom 介面將是“維0“並且大多數 Atheros 介面將是”th0「。您可以在 Web-GUI 的無線標籤下找到名稱,或在終端機中使用如果配置
  • 更改等待時間以反映您的情況實際需要的時間。我認為根據您的情況,2-3 分鐘是可以接受的。

截至 2011 年 m1st0,輸入來自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
restarted_wifi=false
# Check interface every minute
logger "Starting to check wifi status"
while sleep 50; do
  restarted_wifi=false
  # 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;
        restarted_wifi=true
        test_wifi_down=""
  # 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
  then
   logger "Wifi becon issue, restarting";
   ifconfig ath0 down;
        sleep 4;
        ifconfig ath0 up;
        restarted_wifi=true
        test_beacon_issue=""
  fi;
  # 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;
        restarted_wifi=false;
        logger "Will start to check wifi every 50 seconds again";
  fi
done 

根據您在堆疊溢出時的代表來看,我認為您在操作此腳本以達到您的目的時不會有任何問題。如果您遇到麻煩,請給我留言。

一些這些腳本可能對你也有用。

相關內容