Live data from Hacker News

Using 4G LTE wireless modems on a Raspberry Pi

jeffgeerling.com

21–30 of 46 posts

Re: Using 4G LTE wireless modems on a Raspberry Pi

#21
post #8

Note that where it says: > A mini PCI Express 4G LTE modem. I used a Quectel EC25-A, but there are some from Sierra Wireless I've heard recommended too. This is actually just a mini-pci-e adapter board that exposes the USB pins to the USB type A connector seen in the photo. It's not an actual pci-e bus device LTE modem. As shown in the example, it appears to the kernel as a USB device.

Most PCI cellular modems are actually USB devices, or at least can be put into USB mode.

Re: Using 4G LTE wireless modems on a Raspberry Pi

#22
I developed an integration for LTE for work a few years ago for a linux server, I found the experience the same in how little clear information there was. We tried quite a few different cards, though I can't remember the one that ended up "working" (the project wasn't ever deployed). I could not get qmi_wwan or wvdial to work consistently, which was crucial as if it went down someone would have to physically intervene. I ended up using plain old pppd and chatscripts, which was especially amusing to me as a late millennial who never expected to use such antiquated technologies. Another fidgety thing was the SIM pin, especially given the threat that multiple failed attempts to set it would lead to a lockout. That being said, it is far simpler to just get an LTE modem with ethernet ports and let that take care of the connection.

Re: Using 4G LTE wireless modems on a Raspberry Pi

#23
post #8

Note that where it says: > A mini PCI Express 4G LTE modem. I used a Quectel EC25-A, but there are some from Sierra Wireless I've heard recommended too. This is actually just a mini-pci-e adapter board that exposes the USB pins to the USB type A connector seen in the photo. It's not an actual pci-e bus device LTE modem. As shown in the example, it appears to the kernel as a USB device.

Most PCI cellular modems are actually USB devices, or at least can be put into USB mode.

This is something I haven't even researched yet, but are 5G modems (the ones that seem to be more M.2 slot style) also using USB, or are they finally running over the PCIe bus?

Re: Using 4G LTE wireless modems on a Raspberry Pi

#24
post #19

This blog post has been quite the effort—coming into it I thought I'd just learn some new things, document a simple process, and be done. But along the way I probably spent 40 hours (and counting) trying to figure out the ins-and-outs of 4G LTE modems and Linux networking when it comes to these oddball devices. I hope some parts of this post help anyone else new to LTE networking in Linux, and maybe somebody can help…

Yeah, things have become wildly fragmented since the "plain" 3G modem days, and there are no effective standards for USB multi-point devices (LTE made Ethernet emulation more popular, but weird pseudo-serials to configure them just became... weirder).

Heh, when I started researching and found that, yes, uart and AT commands are still the preferred way to interact with these modems, I was wondering if I had time-warped back to the 90s!

Re: Using 4G LTE wireless modems on a Raspberry Pi

#25

Earlier quoted context omitted.

Most PCI cellular modems are actually USB devices, or at least can be put into USB mode.

This is something I haven't even researched yet, but are 5G modems (the ones that seem to be more M.2 slot style) also using USB, or are they finally running over the PCIe bus?

USB 3.2 Gen 2 Supports “up to” 10GBs, same as 5G.

Seems like there would be no reason to upgrade to PCIe, since (I assume) it would be a pretty expensive update for no meaningful change in theoretical max speed.

Re: Using 4G LTE wireless modems on a Raspberry Pi

#26
post #10

Earlier quoted context omitted.

Have you experimented with modemmanager/networkmanager to handle the configuration of the modem? For me that has worked quite reliably across a pretty large fleet of devices with a Quectel EG25 (qmi over usb). Regarding FW updates, have you tried opening a support ticket with Quectel? For me they have been extremely responsive and helpful, providing extra documentation on special AT commands and stuff.

I have not—that was what I was trying (mmcli) early on in my exploration, but I kept hitting speedbumps, so switched gears to configuring the modem over TTY and using QMI utils directly. I would like to use modemmanager though, it _seems_ like it's the nicer path.

With modemmanager you get a lot of nice stuff for "free", like automatic reconnect, DHCP, good logging, and an APN database (useful if you don't provide your own SIMs). It also allows you to easily set up correct priorities between WiFi and LTE, both for routing and DNS. Especially DNS is something I didn't think about at first, but the DNS server provided by your LTE connection is not always reachable over your WiFi/ethernet connection.

This is the config I'm using: https://github.com/commaai/agnos-builder/blob/master/userspa...

You can run modemmanager in debug mode, which allows you to send AT commands over dbus (or mmcli) in case you still want to configure some stuff manually or get debug info.

Re: Using 4G LTE wireless modems on a Raspberry Pi

#27

ModemManager / NetworkManager also work really well with these modems on RPi using nmcli.

I found that using the Ubuntu Server build for RPi supported more modern modems out of the box than Raspberry Pi OS as the latter operating system links to very old builds of these tools.

Re: Using 4G LTE wireless modems on a Raspberry Pi

#28

This blog post has been quite the effort—coming into it I thought I'd just learn some new things, document a simple process, and be done. But along the way I probably spent 40 hours (and counting) trying to figure out the ins-and-outs of 4G LTE modems and Linux networking when it comes to these oddball devices. I hope some parts of this post help anyone else new to LTE networking in Linux, and maybe somebody can help…

> Why doesn't Quectel have any firmware downloads on their site?

The telecoms industry in general is pretty shit and does a lot of anti-user nastiness like SIM locking or other arbitrary restrictions. It is not in the their best interests to let the user get too close to the inner workings of things. Security-wise it's also often terrible and security by obscurity is still very much the norm and would be threatened by more transparency. There's also only a handful of manufacturers of the underlying modem chips (Qualcomm is the main one) and they're all in bed with the industry and perpetuate the issue, and the barriers to entry to build your own module are huge both in terms of skill, factories/equipment needed to produce the chips and patents so there's little chance for a more open competitor to step up.

> And is there any way to get them besides downloading random files posted to forums?

If you can find a production-grade device that embeds the same modem that you have, search for firmware updates for that device - chances are it may embed the firmware for the modem too, which you can extract with a bit of reverse engineering. It's not great, but at least you're still getting the firmware from a more trusted source than random forum posts.

> Is there any advantage to using QMI (`wwan0` / qmi_wwan) vs ECM (`usb0` / cdc_ether)?

If you look carefully at the `ip addr` output of QMI vs ECM you would see that the IPs you got aren't the same.

In QMI mode, the LTE interface is directly connected to your system, the 10.... IP you got is the one assigned by your carrier (I am not sure where the initial 169.254.231.106 IP it had before you established the connection came from) and your machine is directly reachable from the Internet.

In ECM mode, you are given a fake Ethernet interface that's connected to a router and NAT gateway ran by the LTE module itself; this is also where that web interface comes from. In this mode, the module's router part is the one exposed to the internet and acts as a router/firewall/NAT gateway - your computer is not directly reachable unless you use that web interface to forward a port. Given the usual "quality" of these (as you witnessed by looking at the UI) I would not be surprised if there are exploits or bugs in there.

There should also be a third mode, where the modem exposes one or more serial ports that accept AT commands and you can establish a connection over it using wvdial/pppd just like good old dial-up. This is worse than QMI mode but preferable to ECM mode as you still get your system directly connected to the internet without relying on the modem's router/gateway part.

In general, I would recommend QMI mode - it is a breath of fresh air compared to the old school way of the modem exposing multiple serial ports and having to do dial-up on it. It does require some work but it's a solved problem - for desktop Linux look into ModemManager, or alternatively look into how OpenWRT deals with it for a potentially lighter alternative.

Re: Using 4G LTE wireless modems on a Raspberry Pi

#29
post #6

> A SIM card with a 4G data plan. I bought a SixFab SIM and used their monthly pay-as-you-go service for testing. You could pull out the SIM from your mobile phone (on most carriers at least) but that is a bit inconvenient as your phone won't get service until you put the SIM back in. You could also get a plan and SIM from any major carrier (e.g. AT&T, T-Mobile, Verizon in the USA)—though you have to make sure the ca…

I feel like you'd probably get more predictable experience by using an always-on VPN configuration on your phone than a wifi hotspot.

iOS leaks requests around the VPN, sadly. I don't run an LTE base station and I don't have a jailbroken device, so I can't tell you how much, but I do know that with a VPN enabled and set to always, I get mobile-network IP DNS queries to my DNS server (not sent via VPN).

iOS is not a privacy-focused OS.

Having a discrete device means you can also connect multiple mobile devices via Wi-Fi on the same SIM, and do your own monitoring/filtering of traffic (such as blocking all unencrypted DNS, and installing DoH profiles on devices, or running an unencrypted-dns-to-DoH forwarding proxy).

Post reply on HN