3. Installing 4G USB modem to Raspberry Pi

4G USB modem
&
RaspberryPi

HUAWEI E3372 modem

If you are using HUAWEI E3372, it can plug & play on Raspberry Pi, no need to install any program.


HUAWEI E3370 modem

I have an old HUAWEI E3370 modem that needs config manually. The method also can help me find the problem when the modem didn’t work.

Did the USB modem loaded?

Run the command below in you RPi, to check did the USB modem loaded.

$ lsusb | grep Huawei
12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard

Did the E3370 loaded?

The 12d1 is Huawei and the 1506 is E3370 modem.

$ dmesg | grep 1506
idVendor=12d1, idProduct=1506, bcdDevice= 1.02

Install wvdial

If the modem has been loaded but it didn’t dial up. You can install the wvdial.

$ sudo apt-get install wvdial

The default config of wvdial is fine for me. If you need to edit it, the config file is here:

$ sudo pico /etc/wvdial.conf

It is the default config file:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99#
Password = internet
Username = internet
Stupid Mode = on

Testing the dial up:

$ sudo wvdial

It is the success dial up screen-print:

--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 150000000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Sun Oct 18 14:45:08 2020
--> Pid of pppd: 1329
--> Using interface ppp0
--> pppd: X/?[01]X/?[01]
--> local  IP address xxx.xxx.xxx.xxx
--> pppd: X/?[01]X/?[01]
--> remote IP address xxx.xxx.xxx.xxx
--> pppd: X/?[01]X/?[01]
--> primary   DNS address xxx.xxx.xxx.xxx
--> pppd: X/?[01]X/?[01]
--> secondary DNS address xxx.xxx.xxx.xxx
--> pppd: X/?[01]X/?[01]

Create the service

I need the USB modem can auto dial-up, I created a wvdial.service file.

$ sudo pico /etc/systemd/system/wvdial.service
[Unit]
Description=wvdial

[Service]
ExecStart=/usr/bin/wvdial
Restart=on-failure
RestartSec=5

Add the code to the 99-com.rules file. It will call the wvdial.service when the USB modem loaded.

$ sudo pico /etc/udev/rules.d99-com.rules
SUBSYSTEM=="tty", KERNEL=="ttyUSB0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="wvdial.service"

Testing the connection

Run the command:

ifconfig

If the modem runs correctly, you can find the ppp0 output:

ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet xxx.xxx.xxx.xxx  netmask 255.255.255.255  destination 10.64.64.64
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 11065  bytes 1348146 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12168  bytes 1585065 (1.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Next: 4. Install Zerotier

Welcome your comments