Using Your 4G LTE Modem From The Terminal

* These directions have been tested on Fedora 32, Raspbian Buster (10) and Trisquel 8 (EM7455 & LT4120), but should work on most Debian, Ubuntu, Trisquel, Fedora, Red Hat Enterprise Linux, and CentOS based distributions as well. They are probably also applicable to hundreds if not thousands of distributions as well, although some may require a few tweaks to these directions.

Install libmbim from your distribution's official repositories (this may not be needed on some distributions, like Fedora). To bring up the modem you can use mbim-network which is a wrapper for mmcli calls. First create a profile for mbim-network.

0. Make sure universe is enabled if on Ubuntu or otherwise apt-get command below will fail to find the package that needs to be installed

1. On Debian/Ubuntu/Raspbian/Trisquel based distributions open a terminal and become admin: sudo su

* Some distributions you may need to run "su -" or similar to become an admin

2. On Debian/Ubuntu/Raspbian/Trisquel based distributions run the following commands (you will need a temporary internet connection to install the modem software, which may also be done by copying the packages from another machine, or contact support about obtaining this software/packages on CD/flash drive):

apt-get update

apt-get install libmbim-utils

3. Run (replace Broadband in the command below with your cellular providers APN, see provider specific documentation for APN info) the following commands:

echo APN=Broadband > /etc/mbim-network.conf

4. Insert your SIM card, connect the antennas, and plug your modem in and run the below command to find out your modem's device name (you may have to wait a minute for the modem's blue light to come on and the system to initialize the modem, otherwise you'll have to try running the command below again):

dmesg | tail -n 15

Or the following should also show a cdc-wdmX modem as well, if you say have an internal card in your laptop from us:

ls /dev/cdc*

5. Take note of the cdc-wdmX device and replace X below with what is shown. Then run:

mbim-network /dev/cdc-wdmX start

Note 1: If you see "error: operation failed: Transaction timed out" just be patient as it'll automatically attempt to reconnect.

Note 2: If you don't see a blue light on the modem the radio is probably off. To turn it on run the command below and replace X with your /dev/cdc-wdmX device and then run the mbim-network command above again:

mbimcli --device=/dev/cdc-wdmX --device-open-proxy --set-radio-state=on

6.Once you get "Network started successfully" or "Successfully connected" the next step is to find out what your modems network interface shows up as by running:

ip a

Either ip a will show something like wwanX or if it's something else run:

dmesg | grep cdc_mbim

In the output you should be able to spot a line like below where wwp0s24e1u4i13 is you modems network interface:

[ 13.043613] cdc_mbim 1-1:3.12 wwp0s24e1u4i13: renamed from wwan0

7. We need to grab ip information from the mobile broadband provider. That isn't a typical DHCP request though so make sure to follow the instructions below. Replace /dev/cdc-wdm1 below with your modem's device as discovered in step 4.

Note: Before running the below command make sure your wifi is disconnected and off or you may get "error: couldn't get IP configuration response message: ContextNotActivated"

mbimcli -d /dev/cdc-wdm1 -p --query-ip-configuration

8. Run the commands below after replacing wwan0 with the network interface of your modem as discovered in step 6.

ip addr flush dev wwan0
ip -6 addr flush dev wwan0
ip link set wwan0 up

9. Replace 10.51.14.130/28 with the output from the query-ip-configuration IP line in step 7 and your wwan network interface found in step 6 and run the command:

ip addr add 10.51.14.130/28 dev wwan0 broadcast +

10. Replace 10.51.14.131 with the gateway address found in step 7 and your wwan network interface found in step 6 and run the command:

ip route add default via 10.51.14.131 dev wwan0

11. Run the command below, but replace wwan0 with your wwan network interface found in step 6 and mtu found in step 7:

ip link set mtu 1430 dev wwan0

12. One last thing... test the connection!

ping -c 4 8.8.8.8

If you see 0% packet loss then you have an internet connection! Great! It works.

Also try seeing if you can resolve domains:

nslookup thinkpenguin.com

If you see a line with and Address: and an ip on it then you've successfully setup your connection, but if not you probably need to set a nameserver by running the following command:

echo nameserver 8.8.8.8 > /etc/resolv.conf

Note: There are different ways to set a nameserver depending on which distribution and release you are on, but the above typically works. The above may not be preserved however. Some distributions use /etc/network/interfaces, some use netplan, and some utilize the traditional /etc/resolv.conf and it can depending on whether or not you have a server or desktop version of your distribution at that. For more information on setting a DNS we will refer you to an outside article written on the subject: how to set DNS nameservers on Ubuntu 18.04.

If you have any problems we recommend looking at our troubleshooting documentation and/or contacting our support team for assistance.