惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
Spread Privacy
Spread Privacy
Scott Helme
Scott Helme
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
量子位
Security Latest
Security Latest
P
Proofpoint News Feed
P
Privacy International News Feed
P
Palo Alto Networks Blog
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google Online Security Blog
Google Online Security Blog
Webroot Blog
Webroot Blog
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
Vercel News
Vercel News
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客
Hacker News - Newest:
Hacker News - Newest: "LLM"
K
Kaspersky official blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Stack Overflow Blog
Stack Overflow Blog
AWS News Blog
AWS News Blog
博客园 - Franky
爱范儿
爱范儿
T
Tor Project blog
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
小众软件
小众软件
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
W
WeLiveSecurity
SecWiki News
SecWiki News
L
LangChain Blog
I
InfoQ

羽毛の家

百樂滿回水器PH-2568EFF添加到HASS – 羽毛の家 百樂滿回水器PH-2568EFF添加到HASS – 羽毛の家 EC20模塊獲取設置IMEI – 羽毛の家 EC20模塊獲取設置IMEI – 羽毛の家 OpenWRT PPPoE重連之後無網絡的解決 – 羽毛の家 Ubuntu Use An Entire Disk And Set Up LVM 空間沒使用全的解決方案 – 羽毛の家 Ubuntu Use An Entire Disk And Set Up LVM 空間沒使用全的解決方案 – 羽毛の家 OpenWRT部署SpeedTest-X供測速使用 – 羽毛の家 OpenWRT部署SpeedTest-X供測速使用 – 羽毛の家 微信開發者工具小程序真機調試提示房間已在調試中 – 羽毛の家 微信開發者工具小程序真機調試提示房間已在調試中 – 羽毛の家 OpenWRT下使用藍牙共享網絡 – 羽毛の家 OpenWRT下使用藍牙共享網絡 – 羽毛の家 移遠RM500Q-GL在NSA組網下鎖5G – 羽毛の家 移遠RM500Q-GL在NSA組網下鎖5G – 羽毛の家 OpenWRT多網關情況下MiniUpnpd添加映射失敗501 – 羽毛の家 OpenWRT多網關情況下MiniUpnpd添加映射失敗501 – 羽毛の家 OpenWRT多WAN情況下 數據包哪裏進哪裏出 – 羽毛の家 OpenWRT多WAN情況下 數據包哪裏進哪裏出 – 羽毛の家
OpenWRT PPPoE重連之後無網絡的解決 – 羽毛の家
yumao · 2021-03-07 · via 羽毛の家

Welcome to Yumao′s Blog.

OpenWRT PPPoE重連之後無網絡的解決

, 2021年03月07日 , Linux , 评论 在〈OpenWRT PPPoE重連之後無網絡的解決〉中留言功能已關閉 ,

自動更新了OP1907之後
經常發生PPPoE連接5760分鍾的自動重連後
發現沒有網絡可用
接口顯示已經獲取到IP地址
然後查詢路由表發現默認路由未添加
只添加了網關的路由
那就直接加一個cron狗來保證網絡正常

> nano /root/pppdog.sh
#!/bin/sh
. /lib/netifd/netifd-proto.sh

INTERFACE=wan
DEFAULTROUTE=`route -n |grep ^0.0.0.0 |grep pppoe-$INTERFACE$`
PINGIP=1.2.4.8

if [ -z "$DEFAULTROUTE" ]
then
        if [ -n "$GATEWAYIP" ]
        then
                echo "`date '+%Y-%m-%d %H:%M:%S'` - PPPDog No Route Reload Route" >> /root/pppdog.log
                # IPv4 Route
                ip route add `ifstatus wan |jsonfilter -e '@["route"][0].nexthop'` dev pppoe-$INTERFACE
                ip route add default via $GATEWAYIP dev pppoe-$INTERFACE
                # IPv6 Init
                json_init
                json_add_string name "${INTERFACE}_6"
                json_add_string ifname "@${INTERFACE}"
                json_add_string proto dhcpv6
                json_add_string zone "wan"
                json_close_object
                ubus call network add_dynamic "$(json_dump)"
                sleep 10s
                # IPv6 Route
                ip -6 route add `ifstatus wan_6 |jsonfilter -e '@["route"][0].target'`/`ifstatus wan_6 |jsonfilter -e '@["route"][0].mask'` dev pppoe-$INTERFACE proto static metric `ifstatus wan_6 |jsonfilter -e '@["route"][0].metric'` pref medium
                ip -6 route add default from `ifstatus wan_6 |jsonfilter -e '@["route"][1].source'` via `ifstatus wan_6 |jsonfilter -e '@["route"][1].nexthop'` dev pppoe-$INTERFACE proto static metric `ifstatus wan_6 |jsonfilter -e '@["route"][1].metric'` pref medium
                ip -6 route add default from `ifstatus wan_6 |jsonfilter -e '@["route"][2].source'` via `ifstatus wan_6 |jsonfilter -e '@["route"][2].nexthop'` dev pppoe-$INTERFACE proto static metric `ifstatus wan_6 |jsonfilter -e '@["route"][2].metric'` pref medium
        else
                echo "`date '+%Y-%m-%d %H:%M:%S'` - PPPDog No Route Reset Interface" >> /root/pppdog.log
                ifdown $INTERFACE
                ifup $INTERFACE
        fi
else
        PINGTEST=`ping $PINGIP -c 1`
        PINGEXIT="$?"
        if [ "$PINGEXIT" == "1" ]
        then
                echo "`date '+%Y-%m-%d %H:%M:%S'` - PPPDog Ping Error Reset Interface" >> /root/pppdog.log
                ifdown $INTERFACE
                ifup $INTERFACE
        else
                PINGLOSS=`ping $PINGIP -c 4 |grep 100%`
                if [ -n "$PINGLOSS" ]
                then
                        echo "`date '+%Y-%m-%d %H:%M:%S'` - PPPDog Ping Loss Reset Interface" >> /root/pppdog.log
                        ifdown $INTERFACE
                        ifup $INTERFACE
                fi
        fi
fi

exit 0

> nano /etc/crontabs/root
0 * * * * /root/pppdog.sh

> /etc/init.d/cron restart

每小時檢測一次網關是否存在
不存在的話添加
存在的話測試網絡(Ping)是否通暢
不通暢則重啓目標接口