2

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?

Thanks!

1 Answers1

1

Try following this tutorial, it helped me bring ppp0 elegantly and it has a connection watchdog. I haven't tested that part, but it looks like it would do the trick.

Basically you can create an entry in /etc/network/interfaces or a file in /etc/network/interfaces.d setting up ppp0

Mine is as follows:

auto ppp0
iface ppp0 inet wvdial
provider vodafone #the name you configured for wvdial
pre-up /etc/ppp/wait-dialup-hardware ttyUSB0 20
pre-up /etc/ppp/wait-dialup-hardware ttyUSB1 20
pre-up /etc/ppp/wait-dialup-hardware ttyUSB2 20
pre-up sleep 30
post-up echo "3G (ppp0) is online"

You could then add another post-up action that could run another script with the command route add default dev ppp0