How to restart a USB modem connected to a Keenetic router

Keenetic routers are able to control the power of USB modems without user intervention. The fact is that many modern USB modems are standalone devices that start and operate independently of the router. On the one hand, this is a good thing. On the other hand, many compact USB modems are designed mainly for occasional work in a laptop but not for round-the-clock work, from which, alas, they can malfunction or halt. In this case, a power reset function on the modem can restore connectivity.

You can power reset your USB modem in the following ways:

1. Reboot via the router's web interface.

Connect to the web interface of the router at or—IP address, preinstalled by default. On the 'System dashboard' page, click on 'More details' to display more information and under 'Modem', click on 'Reboot'.


2. Reboot via the router's command-line interface.

Connect to the command-line interface (CLI) of the router and specify a command for the required USB connection:

interface {имя} usb power-cycle {пауза}

USB modem interface can be of any type—UsbModem, UsbLte, UsbQmi or CdcEthernet. You can find out the name of the required interface with the show interface command.
The value {pause} is an interval of time for which the USB port will be powered off (in milliseconds). For example:

(config)> interface UsbQmi0 usb power-cycle 1000

3. Automatic USB modem reboot when the connection to the Internet is lost.

In case the USB modem periodically hangs up, it is possible to set an automatic restart of the modem when access to any external site is lost. For this, you should use the Ping Check function. You can read more about setting up Ping Check in the article Internet availability checking (Ping Check). You need to configure Ping Check for the required USB modem interface.

By default, when using Ping Check for the USB modem interface, the modem restart function is automatically enabled to prevent hang-up as the cause of connection loss. You can disable it through the command-line interface (CLI) with the command

no ping-check profile {profile_name_connectivity-check} power-cycle

To switch it back on, run the command:

ping-check profile {profile_name_connectivity-check} power-cycle

For example, to disable automatic reboot on the UsbQmi0 interface, run the command:

(config)> no ping-check profile _WEBADMIN_UsbQmi0 power-cycle



Besides connection loss, there are cases when a modem is "lost" from the system, e.g. due to internal software or hardware problems with the modem or EMI (Electromagnetic interference) - interference in the USB port. Kernel prints the following message in logs: ndmkernel: usb 1-1: USB disconnect, device number X

There may be many reasons for such a situation. Solutions are: connect your modem with a short USB cable; move your Keenetic itself with the USB modem to some other place, maybe some device near Keenetic causes interference; connect the USB modem to an active USB hub (with its own supply); replace the modem, maybe it is faulty.

Or you can solve the problem in a more radical way. One of our customers, who uses numerous USB modems, was helped in a similar situation by the command:

interface UsbQmi0 usb power-fail 60 reboot

where UsbQmi0 is the name of the modem interface.

With this setting, in the situation described above, the USB modem was rebooted, after which it started functioning correctly.
Full command syntax:

interface {name} usb power-fail {interval} (retry {pause} | reboot)


This command does not perform any action on the modem but only enables additional correction mechanisms in a situation where power-cycle has not resulted in the USB device being restored. There are three such mechanisms:

1. Restore operation by resetting power again with interface command {name} usb power-fail {interval} retry {pause} after specified {interval} seconds for {pause} sec.

2. Restore device operation (Internet connection) by rebooting the entire system with interface command {name} usb power-fail {interval} reboot in {interval} sec. The power will not be switched off and on again in this case. If after power-cycle the USB device does not appear in the system after {interval} sec, the system is rebooted completely.

3. Restore the operation of USB devices that are spontaneously disconnected from the USB bus due to their own internal faults and then appear in the system as devices that KeeneticOS cannot recognize. The only way to get them out of this state is to forcibly power them off again.
This recovery mode is always active when the power-fail command is active. This is a one-time action that is only performed when a device is removed from the port. It will be repeated if the device itself disappears from the bus after power-up. The {interval} value specified in the command is ignored, and the power to the USB port the device was connected to is switched off immediately after the device disappears from the system and comes back on after 2 sec.

NOTE: Important! In mechanisms 1 and 2, the value of {pause} must be less than {interval} in order to work correctly.

To save the above settings in Keenetic memory, run the command

system configuration save


Was this article helpful?

46 out of 52 found this helpful