wtorek, 18 maja 2021

LTE Huawei E3372h-153 (no HiLink) modem configuration on Ubuntu 20.04.2 LTS

 

One week ago I bought E3372 LTE modem to upgrade my old 3G modem. But the old connection configuration based on wvdial not works with a new modem (new one use huawei_cdc_ncm profile, model VID:12d1 PID:14fe before modeswitch). After reading tons of forums, I not found any proper, clear way to create automatic LTE connection with my E3372 modem. Then I read Modem-manage and Network-Manger manuals and use Network-manager to create LTE connection.


 

I need GSM connection in my summer home to security monitoring, temperature measurements, radiosondes tracking etc. The old modem works from 4 years, but 3G signal is weak, so connection speed is not enough and have large latency. In my tests the LTE connection in this place is better of course. The summer house is 3 hours away from my home. So I need reliable connection to remote access it all the year. During 4 years I have only one serious failure based on hardware (voltage regulator had parameters drift and voltage drop from 5V to only 4.1V, not enough for GSM modem to establish stable connection), so I lost usable connection for 3 months (winter/spring).

Configuration is tested on Armbian Ubuntu (ARMc7l), but it will work on any other Linux with Network-manager and Modem-manager packages, I hope.

Installation requested packages

root@paradyzium:~# apt install usb-modeswitch usb-modeswitch-data

root@paradyzium:~# apt install modemmanager

 

Software versions used:

usb-modeswitch 2.5.2

usb-modeswitch-data 20191128-3

mmcli 1.12.8

nmcli 1.22.10

kernel Linux 5.10.21-sunxi #21.02.3 SMP Mon Mar 8 00:28:04 UTC 2021 armv7l GNU/Linux

Armbian 21.02.3 Focal

Modem identification and state with Modem-manager

root@paradyzium:~# mmcli -L

    /org/freedesktop/ModemManager1/Modem/0 [huawei] E3372

root@paradyzium:~# mmcli -m 0

  --------------------------------

  General  |            dbus path: /org/freedesktop/ModemManager1/Modem/0

           |            device id: b6c26e9cbbd1ab99545211cd765ff8154103a5ee

  --------------------------------

  Hardware |         manufacturer: huawei

           |                model: E3372

           |    firmware revision: 21.327.62.00.55

           |            supported: gsm-umts

           |              current: gsm-umts

           |         equipment id: 86xxxxxxxxxxxxxx

  --------------------------------

  System   |               device: /sys/devices/platform/soc/1c1b000.usb/usb3/3-1

           |              drivers: huawei_cdc_ncm, option1

           |               plugin: Huawei

           |         primary port: ttyUSB0

           |                ports: wwx001e101f0000(net), ttyUSB0(at), ttyUSB1(at)

  --------------------------------

  Status   |       unlock retries: sim-pin(3),sim-puk(10),sim-pin2(3),sim-puk2(10)

           |                state: connected

           |          power state: on

           |          access tech: lte

           |       signal quality: 64% (recent)

 

Let’s make connection

Manual way (optional, to test modem, every time if you want to connect) .

Create script (change PIN and APN to proper values):

echo '#!/bin/bash

mmcli -m 0 --simple-connect="pin=1234,apn=internet"

sleep 2

dhclient -v wwx001e101f0000

'

> connect_lte.sh

chmod a+x connect_lte.sh

run ./connect_lte.sh to establish connection.

Run mmcli -m 0 –reset to reset modem and disconnect.

Automatic way

Configure Network-manager to automatically connect to GMS network when modem is connected. It is one line command! Change PIN, APN, username and password to proper values.

root@paradyzium:~# nmcli c add type gsm ifname "*" con-name OrangeLTE apn internet connection.autoconnect yes gsm.username internet gsm.password internet gsm.pin 1234

To show connection status use command:

root@paradyzium:~# nmcli  c

NAME                UUID                                  TYPE      DEVICE

Home_network01      4d6abcff-7404-3077-9c6b-b91720a3b27d  wifi      wlan0

OrangeLTE           441fef1d-034a-327e-8cd7-deadbeef96a3  gsm       ttyUSB0

Wi-Fi-testing       512e445b-4a00-3cf3-bf60-2badb1bf6fce  wifi      --

Wired connection 1  990227e8-6075-480e-86ac-131a32666c03  ethernet  --

 Active connections are bolded.

Results

Thanks to LTE technology and cdc_ncm profile modem speed is significally better that old one. I tested it with iperf3:

root@paradyzium:~# iperf3 -c ch.iperf.014.fr -p 18815

Connecting to host ch.iperf.014.fr, port 18815

[  5] local 10.70.87.170 port 37426 connected to 45.91.92.191 port 18815

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec  3.02 MBytes  25.4 Mbits/sec    0    455 KBytes

[  5]   1.00-2.00   sec  2.56 MBytes  21.5 Mbits/sec    0    572 KBytes

[  5]   2.00-3.00   sec  2.38 MBytes  20.0 Mbits/sec    0    687 KBytes

[  5]   3.00-4.00   sec  2.75 MBytes  23.1 Mbits/sec    0    794 KBytes

[  5]   4.00-5.00   sec  2.20 MBytes  18.4 Mbits/sec    0    906 KBytes

[  5]   5.00-6.00   sec  2.38 MBytes  20.0 Mbits/sec    0   1015 KBytes

[  5]   6.00-7.00   sec  2.50 MBytes  20.9 Mbits/sec    0   1.09 MBytes

[  5]   7.00-8.00   sec  1.25 MBytes  10.5 Mbits/sec    0   1.20 MBytes

[  5]   8.00-9.00   sec  2.48 MBytes  20.8 Mbits/sec    0   1.31 MBytes

[  5]   9.00-10.00  sec  2.50 MBytes  21.0 Mbits/sec    0   1.42 MBytes

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec  24.0 MBytes  20.2 Mbits/sec    0             sender

[  5]   0.00-10.62  sec  22.7 MBytes  18.0 Mbits/sec                  receiver

Connection speed is about 20Mbits/s with new modem and about 350-150kbit/s with the old 3G modem.