I have a USB modem (Huawei E1552) connected a RPi running Raspbian Stretch. It is connected at remote location that needs persistent internet. For example, for ssh or pushing code remotely.

I have managed to get it "working" using wvdial and a couple of lines in /etc/profile to get it to automatically to connect on reboot. It is very very cruel and I would like it to have some fail safe (e.g. reconnect on lost connection). The profile looks like this:

echo waiting for device to boot...
sleep 10
screen -S APN -dm sudo wvdial defaults
echo adding to route...
sleep 10
sudo route add default dev ppp0 

Can someone suggest a better method? I am not very familiar with Linux.

I have also tried the qmi method here but it did not work for me. I think the /etc/network/interface is now deprecated?


  • Questions: (1) Is your model EXACTLY this one: AliExpress Unlocked Huawei E1552 3G WCDMA/HSDPA/UMTS 2100MHz Wireless Modem USB Dongle Supports SMS Service - US$15 ( alibaba.com/product-detail/… ) (2) If you software/bash shutdown and reboot, wll Rpi automatically connect? (3) If you hardware/power reset (say, manually switch off and then switch on 5V DC power, will Rpi automatically connect? – tlfong01 Jul 5 at 5:23
  • 1) It does not look exactly like that one, as in it is a local carrier branded. 2) Yes 3) Yes It seems to reconnect in those situations. Maybe all I need is to call wvdial from a bash script in a while loop like wiki.archlinux.org/index.php/Wvdial#Auto_Reconnect suggests? – Tony Baloney Jul 5 at 7:14
  • Ah the look is not important. What is important is the model number and the spec. Sometimes OEMs products have same model number might have different options or spec. Of course you can use wvdial to connect. But what can you do if your Rpi freezes for some reason, and your bash script is dead? – tlfong01 Jul 5 at 7:33
  • So you need a software watchdog timer to automatically reset Rpi, in case it freezes. Or you can use a hardware realtime clock such as DS3231 RTC module to reset Rpi every 1200 midnight, (2) Or use another slave Rpi detecting master Rpi freezes, then use a GPIO pin to reset master Rpi. – tlfong01 Jul 6 at 1:27
  • I actually do have a hardware switch right now! I will have a look at this more in term of some fault tolerance on the bash and wvdial side. Glad to see I am not crazy in the head! – Tony Baloney Jul 7 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.