Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Namorzyny
Last active September 18, 2020 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Namorzyny/640a259459d8daf69aaa0d77074f0910 to your computer and use it in GitHub Desktop.
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
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