Recently I have had the joy of setting up OpenWrt on my shiny new 4G modem, namely a Zyxel NR7101, to replace my old Huawei B818-263 operating in bridge mode.
An old problem that I had with my B818-263 was that every 48 hours my ISP would require a wan IP refresh of sorts, and the B818-263 would drop the connection to NO-CARRIER, and back when I used an Asus router running Merlin this would result in loss of internet connectivity and so I wrote the following script to detect the NO-CARRIER event and force a wan IP refresh:
#!/bin/sh
renew_wan_lease=0
ip monitor link dev eth0 | while read event; do
# logger "maintain-wan-lease detected eth0 event: "$event
case $event in
*'NO-CARRIER'* )
if [ $renew_wan_lease -eq 0 ]; then
logger "maintain-wan-lease detected eth0 state change to: 'NO-CARRIER', so forcing udhcpc to release wan lease."
killall -SIGUSR2 udhcpc
renew_wan_lease=1
fi
;;
*'LOWER_UP'* )
if [ $renew_wan_lease -eq 1 ]; then
logger "maintain-wan-lease detected eth0 state change from: 'NO-CARRIER' to: 'LOWER_UP', so forcing udhcpc to renew wan lease."
killall -SIGUSR1 udhcpc
renew_wan_lease=0
fi
;;
esac
done
Ever since replacing my Asus router with an OpenWrt router this issue went away and I did not need my script for whatever reason and I presumed this related to OpenWrt properly handling the NO-CARRIER event.
Interestingly and annoyingly since getting my Zyxel NR7101 I see that my 48hr loss of internet connectivity issue has come back.
I connect using the 'luci-proto-qmi' utility, which I see @jow and others have had a hand in developing over the years:
And after 48 hours of having been connected I got no connectivity, with log here:
Wed Oct 26 03:16:49 2022 daemon.warn dnsmasq-dhcp[1]: not giving name OpenWrt to the DHCP lease of 192.168.0.2 because the name exists in /tmp/hosts/dhcp.cfg01411c with address 192.168.0.1
Wed Oct 26 03:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 03:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 04:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 04:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 05:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 05:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 06:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 06:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 07:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 07:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 08:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 08:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 09:16:49 2022 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) 192.168.0.2 XX:XX:XX:XX:XX
Wed Oct 26 09:16:49 2022 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.0.2 XX:XX:XX:XX:XX OpenWrt
Wed Oct 26 09:16:49 2022 daemon.warn dnsmasq-dhcp[1]: not giving name OpenWrt to the DHCP lease of 192.168.0.2 because the name exists in /tmp/hosts/dhcp.cfg01411c with address 192.168.0.1
Wed Oct 26 09:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 09:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 10:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 10:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 11:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 11:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 12:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 12:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 13:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 13:16:51 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 14:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
Wed Oct 26 14:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 15:16:49 2022 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) 192.168.0.2 XX:XX:XX:XX:XX
Wed Oct 26 15:16:49 2022 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.0.2 XX:XX:XX:XX:XX OpenWrt
Wed Oct 26 15:16:49 2022 daemon.warn dnsmasq-dhcp[1]: not giving name OpenWrt to the DHCP lease of 192.168.0.2 because the name exists in /tmp/hosts/dhcp.cfg01411c with address 192.168.0.1
Wed Oct 26 15:16:50 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending renew to server 55.66.77.888
*** LOST CONNECTIVITY HERE ***
Wed Oct 26 15:19:07 2022 authpriv.info dropbear[17773]: Child connection from 192.168.1.136:50803
Wed Oct 26 15:19:10 2022 authpriv.notice dropbear[17773]: Password auth succeeded for 'root' from 192.168.1.136:50803
Wed Oct 26 15:19:25 2022 user.info : luci: accepted login on / for root from 192.168.1.136
*** MANUAL WAN RESET HERE ***
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan (20169): Stopping network wan
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan_4 (12250): udhcpc: received SIGTERM
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan_4 (12250): udhcpc: unicasting a release of 11.222.33.444 to 55.66.77.888
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan_4 (12250): udhcpc: sending release
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan_4 (12250): udhcpc: entering released state
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan_4 (12250): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "wan_4" } (Permission denied)
Wed Oct 26 15:26:59 2022 daemon.notice netifd: Interface 'wan_4' is now down
Wed Oct 26 15:26:59 2022 daemon.notice netifd: Network alias '' link is down
Wed Oct 26 15:26:59 2022 daemon.notice netifd: Interface 'wan_4' has link connectivity loss
Wed Oct 26 15:26:59 2022 daemon.notice netifd: Interface 'wan_4' is disabled
Wed Oct 26 15:26:59 2022 daemon.warn dnsmasq[1]: no servers found in /tmp/resolv.conf.d/resolv.conf.auto, will retry
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan (20169): Command failed: ubus call network.interface notify_proto { "action": 0, "link-up": false, "keep": false, "interface": "wan" } (Permission denied)
Wed Oct 26 15:26:59 2022 daemon.notice netifd: Interface 'wan' is now down
Wed Oct 26 15:26:59 2022 daemon.notice netifd: Interface 'wan' is setting up now
Wed Oct 26 15:26:59 2022 daemon.notice netifd: wan (20209): Waiting for SIM initialization
Wed Oct 26 15:27:00 2022 daemon.notice netifd: wan (20209): Failed to parse message data
Wed Oct 26 15:27:00 2022 daemon.notice netifd: wan (20209): PIN verification is disabled
Wed Oct 26 15:27:00 2022 daemon.notice netifd: wan (20209): Device does not support 802.3 mode. Informing driver of raw-ip only for wwan0 ..
Wed Oct 26 15:27:00 2022 daemon.notice netifd: wan (20209): Waiting for network registration
Wed Oct 26 15:27:01 2022 daemon.notice netifd: wan (20209): Starting network wan
Wed Oct 26 15:27:02 2022 daemon.notice netifd: wan (20209): Setting up wwan0
Wed Oct 26 15:27:02 2022 daemon.notice netifd: Interface 'wan' is now up
Wed Oct 26 15:27:02 2022 daemon.notice netifd: Network device 'wwan0' link is up
Wed Oct 26 15:27:02 2022 daemon.notice netifd: Network alias 'wwan0' link is up
Wed Oct 26 15:27:02 2022 daemon.notice netifd: Interface 'wan_4' is enabled
Wed Oct 26 15:27:02 2022 daemon.notice netifd: Interface 'wan_4' has link connectivity
Wed Oct 26 15:27:02 2022 daemon.notice netifd: Interface 'wan_4' is setting up now
Wed Oct 26 15:27:02 2022 daemon.notice netifd: wan_4 (20369): udhcpc: started, v1.35.0
Wed Oct 26 15:27:02 2022 user.notice firewall: Reloading firewall due to ifup of wan (wwan0)
Wed Oct 26 15:27:02 2022 daemon.notice netifd: wan_4 (20369): udhcpc: broadcasting discover
Wed Oct 26 15:27:03 2022 daemon.notice netifd: wan_4 (20369): udhcpc: broadcasting select for 11.222.33.444, server 55.66.77.888
Wed Oct 26 15:27:03 2022 daemon.notice netifd: wan_4 (20369): udhcpc: lease of 11.222.33.444 obtained from 55.66.77.888, lease time 7200
Wed Oct 26 15:27:03 2022 daemon.notice netifd: Interface 'wan_4' is now up
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: reading /tmp/resolv.conf.d/resolv.conf.auto
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using nameserver 10.206.64.1#53
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using nameserver 10.206.64.1#53
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for test
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for local
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Wed Oct 26 15:27:03 2022 daemon.info dnsmasq[1]: using only locally-known addresses for lan
Wed Oct 26 15:27:04 2022 user.notice firewall: Reloading firewall due to ifup of wan_4 (wwan0)
root@OpenWrt:~#
I got this:
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"disconnected"
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-current-settings
"Out of call"
Manual wan reset fixed this. But obviously this is not practical for ordinary use.
How should I properly fix this? @patrakov or @trendy maybe this is one for either of you?