Openwrt_命令行计划测试网络以及重启

用以解决由于公网IP改变,导致Openwrt拨号无法上网的问题。以下仅供参考

首先,确认WAN口名称为”WAN”

/sbin/reboot
/sbin/wifi down && /sbin/wifi/up
/etc/init.d/network restart

note:

/sbin/ifup wan

这个命令不会影响ssh连接,立刻就能返回结果。
如果执行正常的话,稍等几秒后 WAN口 IP、及其对应的 WAN6 口IP都会改变
note:

ubus call network.interface down '{"interface":"wan"}' + ubus call network.interface up '{"interface":"wan"}'
ifdown wan;sleep 2;ifup wan

web-interfaces图形化界面中一些button映射的方法

/sbin/ifup wan
/sbin/ifdown wan

楼主你好,我深圳也办了这个套餐,但是使用过程发现如果玩PT一直高速上传,过一段时间就会重新拨号。导致外网IP变化,连接会中断一会。
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:a5f281fb-c3c1-456e-b8c9-4b4afac61963

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:b07c2f78-6373-4042-b081-e0376381fc3d

深空 发表于 2018-3-8 21:15
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:cda3243d-747e-462c-8752-8f6c462e2f6c

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:c8b9a784-f568-4ae0-977c-5f8c8c747eee

谢谢解答。
我换了路由器解决了。
原来的lede 软路由器重连原因也找到了,是由于LEDE 的pppoe拨号参数里面有一个 lcp响应 阈值bug导致的,参数为0 ,实际生效是5。
引用:
lcp响应设置存在bug.. 这个需要你检查PPPOE日志来判断 如果日志出现
No response to 5(可能为其他值) echo-requests
Serial link appears to be disconnected.

就说明是LCP响应设置问题 LEDE的bug在于你在页面设置LCP响应超时次数为0时候 为默认5次超时
所以基本更新后就是默认5s LCP不响应 LEDE认为PPPOE断线,重播,秒断.

国内的ISP商很少提供LCP全程响应的. 所以将LCP检测时间间隔跟次数设置为一个很大很大的值可以解决这个问题

0 5 * * * /sbin/ifup wan

note:
1.用 wget ping 指定网站,判断返回值就可以知道访问是否成功。
2.wget 需要自行设置timeout参数 ,原参数太长;重试次数需要设置大于2次,留足冗余

e.g.

*/10 * * * * /bin/sh
/root/chk_net_redail.sh

chk_net_redail.sh :

#!/bin/sh
filename: /root/chk_net_redail.sh
4=network error/refused/timeout/dns err/
need "opkg install wget ca-bundle"

count=0
URLs='http://baidu.com  http://163.com  http://www.qq.com  http://sogou.com'
for host in $URLs ; do
    #echo $host
    # wget -t2 这个参数要>=2, 防止第一次访问dns解析超时,而导致失败
    wget -q -T3 -t3 --method=HEAD --max-redirect=0 "$host"
    if [ 4 -eq $? ]; then
        echo $(date +%F_%T%z) $host 'error.' >> /root/log.redail
        count=$((count+1))
    else
        break
    fi
done
URL_cnt=$(echo $URLs|wc -w)
if [ $count -ge $URL_cnt ]; then
    echo $(date +%F_%T%z) redail >> /root/log.redail
    ifdown wan; sleep 1; ifup wan
fi

Original: https://www.cnblogs.com/unknownshangke/p/16463541.html
Author: Unknown尚可
Title: Openwrt_命令行计划测试网络以及重启

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/562553/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球