openwrt 用的这种方法,以前也用过一段时间大内网,不确定是否有用。即便 pppoe 方式也曾经换了 5 个 ip 才能正常访问 vps 。所以有些墙在本地 ISP 就存在。
# cat
redial.sh#!/bin/sh
ip1=`ifconfig pppoe-wan | grep addr|cut -d":" -f2|awk '{ print $1}'`;while true;do
echo "`(date +"%m/%d/%Y %T")` pppoe-wan_ipaddr_old_$ip1 dropped_ redial_ " >> /tmp/log1;
killall pppd;sleep 8
ip2=`ifconfig pppoe-wan | grep addr|cut -d":" -f2|awk '{ print $1}'`;
##echo $ip2|grep ^101
##if [ $? -eq 0 ];then
##echo "`(date +"%m/%d/%Y %T")` pppoe-wan_ipaddr_new_101 redial_" >> /tmp/log1;
##elif [ $ip1 != $ip2 ];then
if [ $ip1 != $ip2 ];then
echo "`(date +"%m/%d/%Y %T")` pppoe-wan_ipaddr_new_$ip2 successfully_" >> /tmp/log1;break;fi;done;
# cat /tmp/log1|grep new
10/30/2023 23:30:39 pppoe-wan_ipaddr_new_xxx.xxx.105.232 successfully_
10/31/2023 02:30:08 pppoe-wan_ipaddr_new_xxx.xxx.105.64 successfully_
11/01/2023 02:30:08 pppoe-wan_ipaddr_new_xxx.xxx.108.208 successfully_
11/02/2023 02:30:09 pppoe-wan_ipaddr_new_xxx.xxx.107.231 successfully_
11/03/2023 02:30:08 pppoe-wan_ipaddr_new_xxx.xxx.111.52 successfully_
11/04/2023 02:30:17 pppoe-wan_ipaddr_new_xxx.xxx.106.23 successfully_