Last active
September 18, 2020 20:33
-
-
Save Namorzyny/640a259459d8daf69aaa0d77074f0910 to your computer and use it in GitHub Desktop.
Fix v6 interface does not go up when China Telecom PPPoE reconnection or reassigning v4 address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PATH='/usr/sbin:/usr/bin:/sbin:/bin' | |
ubus call network.interface.wan status | grep '"up": true,' > /dev/null 2>&1 || { | |
echo "PPPoE is down." | |
exit 1 | |
} | |
has_error=0 | |
ubus call network.interface.wan6 status | grep '"code": "NO_DEVICE"' > /dev/null 2>&1 && has_error=1 | |
ubus call network.interface.wan6 status | grep '"up": true,' > /dev/null 2>&1 || has_error=1 | |
if [ $has_error -eq 0 ]; then | |
echo "Nothing to do." | |
exit 0 | |
fi | |
echo "Switching settings..." | |
uci set network.wan6.reqaddress='disabled' | |
uci commit | |
ifdown wan6 | |
ifup wan6 | |
echo "Applying..." | |
sleep 5s | |
echo "Rolling back settings..." | |
uci set network.wan6.reqaddress='try' | |
uci commit | |
ifdown wan6 | |
ifup wan6 | |
echo "Waiting..." | |
sleep 10s | |
ubus call network.interface.wan6 status | grep '"up": true,' > /dev/null 2>&1 || { | |
echo "WAN6 is up." | |
exit 0 | |
} | |
echo "Failed." | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment