How to restart 3G interface only

Hi everyone, I have an application where the 3G connection is a way too instable, and sometimes the LTE device just got stucked and I have to reboot it. I'm using the AT+CFUN=1,1 cmd to reboot the LTE device and, after that, the 3G interface doesn't get up unless I restart all interfaces with "/etc/init.d/network restart" cmd. I tried the following cmd to restart just the 3g interface (named pci0):

ifup pci0
ifconfig 3g-pci0 up
ubus call network.interface.pci0 up

Nome of them worked. ifconfig also gives an error. It was suppose to work the ubus cmd, but nothing happens, no error message are displayed. If someone have any way to restart ONLY the 3G interface, without restart any other interface, I would appreciate it.

Following is some information about Openwrt version, device version, and network config.

  • Openwrt v18.02.6 (compiled with glibc)
  • Architecture x86/64
  • Device: APU 3
  • LTE Module: Quectel EC25-AU
  • 3g network config:
    config interface 'pci0'
    option proto '3g'
    option device '/dev/ttyUSB2'
    option service 'umts'
    option dialnumber '99**1#'

Best regards.

In this post @yousong helped me on a similar problem for wireguard. It should be the same for your situation
ifdown pci0 && ifup pci0

1 Like

It doesn't works, but thanks for the tip.

Any clue? How does the netifd ups the 3g interface?

Please share logread output around the time when ifup pci0 was run.

Nothing happens when the ifup is performed. Bellow is the loggread since the modem reset until the modem restarts.

Mon Feb 17 16:23:18 2020 daemon.info pppd[13536]: LCP terminated by peer
Mon Feb 17 16:23:18 2020 daemon.info pppd[13536]: Connect time 42.0 minutes.
Mon Feb 17 16:23:18 2020 daemon.info pppd[13536]: Sent 805359 bytes, received 921188 bytes.
Mon Feb 17 16:23:18 2020 daemon.notice netifd: Network device '3g-pci0' link is down
Mon Feb 17 16:23:18 2020 daemon.notice netifd: Interface 'pci0' has lost the connection
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: reading /tmp/resolv.conf.auto
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain test
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain onion
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain localhost
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain local
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain invalid
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain bind
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using nameserver 149.112.112.112#53
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using nameserver 9.9.9.9#53
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using local addresses only for domain lan
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using nameserver 192.168.1.5#53
Mon Feb 17 16:23:18 2020 daemon.info dnsmasq[17625]: using nameserver 192.168.1.6#53
Mon Feb 17 16:23:18 2020 daemon.notice pppd[13536]: Modem hangup
Mon Feb 17 16:23:18 2020 daemon.notice pppd[13536]: Connection terminated.
Mon Feb 17 16:23:18 2020 user.notice button-hotplug: Device: / Action: ifdown / Interface: pci0
Mon Feb 17 16:23:18 2020 daemon.notice netifd: Interface 'wanout' is now down
Mon Feb 17 16:23:18 2020 user.notice root: stopping ntpclient
Mon Feb 17 16:23:18 2020 daemon.notice netifd: eth1 (4594): udhcpc: sending renew to 0.0.0.0
Mon Feb 17 16:23:18 2020 daemon.notice netifd: eth1 (4594): udhcpc: lease of 192.168.1.43 obtained, lease time 60
Mon Feb 17 16:23:19 2020 daemon.info pppd[13536]: Exit.
Mon Feb 17 16:23:19 2020 daemon.notice netifd: Interface 'pci0' is now down
Mon Feb 17 16:23:19 2020 daemon.notice netifd: Interface 'pci0' is setting up now
Mon Feb 17 16:23:20 2020 daemon.info odhcpd[3881]: Using a RA lifetime of 0 seconds on br-lan
Mon Feb 17 16:23:21 2020 daemon.notice pppd[28754]: pppd 2.4.7 started by root, uid 0
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: abort on (BUSY)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: abort on (NO CARRIER)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: abort on (ERROR)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: report (CONNECT)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: timeout set to 10 seconds
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: send (AT&F^M)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: expect (OK)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: AT&F^M^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: OK
Mon Feb 17 16:23:22 2020 local2.info chat[28756]:  -- got it
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: send (ATE1^M)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: expect (OK)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: ^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: ATE1^M^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: OK
Mon Feb 17 16:23:22 2020 local2.info chat[28756]:  -- got it
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: send (AT+CGDCONT=1,"IP",""^M)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: timeout set to 30 seconds
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: expect (OK)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: ^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: AT+CGDCONT=1,"IP",""^M^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: OK
Mon Feb 17 16:23:22 2020 local2.info chat[28756]:  -- got it
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: send (ATD*99***1#^M)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: expect (CONNECT)
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: ^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: ATD*99***1#^M^M
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: CONNECT
Mon Feb 17 16:23:22 2020 local2.info chat[28756]:  -- got it
Mon Feb 17 16:23:22 2020 local2.info chat[28756]: send ( ^M)
Mon Feb 17 16:23:22 2020 daemon.info pppd[28754]: Serial connection established.
Mon Feb 17 16:23:22 2020 kern.info kernel: [11912.746884] 3g-pci0: renamed from ppp0
Mon Feb 17 16:23:22 2020 daemon.info pppd[28754]: Using interface 3g-pci0
Mon Feb 17 16:23:22 2020 daemon.notice pppd[28754]: Connect: 3g-pci0 <--> /dev/ttyUSB2
Mon Feb 17 16:23:29 2020 daemon.info pppd[28754]: No response to 5 echo-requests
Mon Feb 17 16:23:29 2020 daemon.notice pppd[28754]: Serial link appears to be disconnected.
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.625321] usb 2-1.3: USB disconnect, device number 10
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.631219] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.639676] option 2-1.3:1.0: device disconnected
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.645415] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.653940] option 2-1.3:1.1: device disconnected
Mon Feb 17 16:23:30 2020 daemon.notice pppd[28754]: Modem hangup
Mon Feb 17 16:23:30 2020 daemon.notice pppd[28754]: Connection terminated.
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.666439] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.674941] option 2-1.3:1.2: device disconnected
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.680587] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.689150] option 2-1.3:1.3: device disconnected
Mon Feb 17 16:23:30 2020 kern.info kernel: [11920.694420] qmi_wwan 2-1.3:1.4 wwan0: unregister 'qmi_wwan' usb-0000:00:13.0-1.3, WWAN/QMI device
Mon Feb 17 16:23:31 2020 daemon.info pppd[28754]: Exit.
Mon Feb 17 16:23:31 2020 daemon.notice netifd: Interface 'pci0' is now down
Mon Feb 17 16:23:34 2020 daemon.err chilli[17925]: Network is unreachable: sendto() failed!
Mon Feb 17 16:23:35 2020 authpriv.info dropbear[29290]: Child connection from 192.168.1.51:42748
Mon Feb 17 16:23:36 2020 authpriv.notice dropbear[29290]: Password auth succeeded for 'root' from 192.168.1.51:42748
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.731439] usb 2-1.3: new high-speed USB device number 11 using ehci-pci
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.894177] option 2-1.3:1.0: GSM modem (1-port) converter detected
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.900888] usb 2-1.3: GSM modem (1-port) converter now attached to ttyUSB0
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.908910] option 2-1.3:1.1: GSM modem (1-port) converter detected
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.915930] usb 2-1.3: GSM modem (1-port) converter now attached to ttyUSB1
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.924025] option 2-1.3:1.2: GSM modem (1-port) converter detected
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.930844] usb 2-1.3: GSM modem (1-port) converter now attached to ttyUSB2
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.938824] option 2-1.3:1.3: GSM modem (1-port) converter detected
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.945840] usb 2-1.3: GSM modem (1-port) converter now attached to ttyUSB3
Mon Feb 17 16:23:41 2020 kern.info kernel: [11931.954721] qmi_wwan 2-1.3:1.4: cdc-wdm0: USB WDM device
Mon Feb 17 16:23:42 2020 kern.info kernel: [11931.961879] qmi_wwan 2-1.3:1.4 wwan0: register 'qmi_wwan' at usb-0000:00:13.0-1.3, WWAN/QMI device, d2:32:61:44:55:7e
Mon Feb 17 16:23:43 2020 daemon.notice netifd: Interface 'pci0' is setting up now
Mon Feb 17 16:23:43 2020 daemon.notice netifd: Interface 'pci0' is now down
Mon Feb 17 16:23:44 2020 daemon.err chilli[17925]: Network is unreachable: sendto() failed!
Mon Feb 17 16:23:48 2020 daemon.notice netifd: eth1 (4594): udhcpc: sending renew to 0.0.0.0
Mon Feb 17 16:23:48 2020 daemon.notice netifd: eth1 (4594): udhcpc: lease of 192.168.1.43 obtained, lease time 60
Mon Feb 17 16:23:54 2020 daemon.err chilli[17925]: Network is unreachable: sendto() failed!
Mon Feb 17 16:24:04 2020 daemon.err chilli[17925]: Network is unreachable: sendto() failed!
Mon Feb 17 16:24:12 2020 daemon.warn dnsmasq-dhcp[17625]: no address range available for DHCP request via eth2
Mon Feb 17 16:24:14 2020 daemon.err chilli[17925]: Network is unreachable: sendto() failed!

I did a workaround over this issue using the network reload cmd. These steps are enough to it:

1- Change the interface configuration you want to reload. commit it.
2 - Reload the network with /etc/init.d/network reload
3- Configure the desire interface back, commit it.
4 - Reload the network again.

A reload only restarts interfaces which was modified. Doing it I could solve my problem. After the network reload the 3g-pci0 interface back to working again.

It would be great if restart could be performed for a single interface, like /etc/init.d/network restart $interface.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.