Usb lte modem linux

Juul / lte_mbim_from_scratch.md

The purpose of this document is to get you familiar with the concepts and command line tools involved with connecting to the internet using modern 4G LTE modems on both Debian/Ubuntu and OpenWRT.

This writeup is based on my experiences with the Sierra Wireless AirPrime MC7455 modem and a Calyx (Sprint) SIM card, but it should apply to most modern 4G LTE modems.

High level overview

These are the steps required:

  • Physically connect antennas
  • Physically connect modem to computer using USB adaptor
  • Flash latest firmware to modem
  • Configure modem using AT commands
  • Configure modem using QMI protocol (for some modems)
  • Use command-line tools to connect
  • Assign IP address, gateway and DNS

USB and adaptors

These modems come with a variety of connectors. Some use USB Type A, some use Mini PCI Express, and some use M.2 but they all communicate using USB 2 (with some supporting USB 3). This is possible because both the PCI Express Mini Card edge connector and the M.2 (aka NGFF) edge connector provide not just PCIe pins, but also USB and SIM card pins. This means that the PCIe Mini and M.2 modems can be connected to USB via an adaptor. These adaptors are cheap (e.g. on ebay) and usually include a slot for the SIM card.

For the MC7455 you will need such a Mini PCIe to USB adaptor, and probably a nanoSIM or microSIM to normal SIM adaptor since most PCIe to USB adaptors only accept a full-sized SIM card.

Frequencies and antennas

You will also need two antennas, or a single MIMO antenna. The frequencies used by Sprint in my area are:

  • 25: 1850 to 1995 MHz (FDD-LTE)
  • 26: 814 to 894 MHz (FDD-LTE)
  • 41: 2496 to 2690 MHz (TDD-LTE)

The MC7455 supports all frequencies and both FDD-LTE and TDD-LTE (which are just two different ways of splitting upstream and downstream bandwidth). You can check on cellmapper.net which channels are supported by the cell towers near you and look up the corresponding frequencies here. You can then either get a wideband antenna that covers all of the frequencies supported by your modem and the cell tower, or you can pick one or two frequencies and get an antenna for just those frequencies. Usually wideband antennas that support multiple frequencies don’t have as much gain. You might want to try forcing your modem to use each of the frequencies in turn and check the bandwidth during peak times before you decide on the best antenna.

For the MC7455 you will probably need pigtails (antenna adaptors) from u.fl to either SMA or N-type connectors depending on your antenna. Other modems like the EM7565 use MHF4 connectors instead of u.fl. Remember that the longer the cable from your modem to the antenna, the more signal you will loose.

Upgrading the firmware

If you have a Sierra modem then you will probably want to upgrade the firmware to the latest version from Sierra.

I recommend using the bootable ISO from Daniel E Wood which includes everything you need.

Talking to the modem

USB modems use the USB Communications Device Class or USB CDC. They usually show up as multiple devices in /dev . I see three tty devices: /dev/ttyUSB0 to /dev/ttyUSB2 and one /dev/cdc-wdm0 .

One of the /dev/ttyUSBx devices should be a serial console for AT commands, probably using 9600 baud. If it isn’t, refer to the Switching to NBIM section of this guide.

You can connect using minicom:

For the MC7455 you can download an AT command guide from Sierra Wireless (though you have to create an account) but you hopefully won’t need any commands that aren’t in this guide. There is also a nice writeup on AT commands here.

Another one of these /dev/ttyUSBx devices will probably be for NMEA, meaning that it’s for talking to the built-in GPS. This has no bearing on the 4G LTE connectivity.

Some background on protocols

There are several communications protocols used by modems. Years ago all modems used PPP, but even if your modern modem supports PPP you probably don’t want to use it since it doesn’t support very high bandwidth. For modern modems you will probably want to use either MBIM or QMI.

MBIM, or Mobile Broadband Interface Model, is an official USB standard created by the USB Implementors Forum.

QMI or Qualcomm Mobile Station Modem Interface was developed by Qualcomm and is only supported by Qualcomm chips.

Many Qualcomm chips like the Sierra MC7455 support both MBIM and QMI.

Both MBIM and QMI are actually just using existing Ethernet over USB standards with an added signalling channel.

Читайте также:  Ethernet driver windows sp3

MBIM is just the NCM protocol + a signalling channel and QMI is just the ECM protocol + a signalling channel.

ECM is the Ethernet Control Model and NCM is the Network Control Model. ECM is an earlier standard and has some issues with latency while NCM resolves those issues and is designed for high speed operation. You can read more here.

You can learn more about MBIM in Linux via the kernel documentation.

When configuring your modem, some settings can be changed with AT commands and others using the QMI signalling channel. I had problems changing the mode from QMI to MBIM using AT commands but was successful using the QMI signalling channel.

Switching to MBIM

Since MBIM is an official USB standard and uses the more modern NCM protocol, that’s what I ended up using.

With the SIM card and modem installed in the USB adaptor, plug the modem into a USB port and wait. It taked a while for the modem to boot up. Maybe give it 30 seconds.

Now use the minicom command from earlier to verify that you can talk to the modem and the SIM card is connected:

It should respond with «READY».

Now let’s enable IPv6 while we’re at it:

If you want, you can ensure that the modem uses only 4G LTE:

You can also attempt to set the USB composition mode. For the MC7455 use this:

Don’t worry if the at!usbcomp command fails or you have a different modem, but if it succeeds you can skip using the swi_setusbcomp script below.

When you’re done, reboot the modem:

Now we need to change the USB composition mode of the modem. «USB composition» refers to the set and types of the devices in /dev associated with the modem.

For this we’ll use this swi_setusbcomp script.

First list the supported USB compositions using:

You will see a list with entries that look something like this:

Pick an entry that includes both AT and NBIM and note down the number, then run:

Replacing with the number of that entry. I used number 1.

Now unplug the modem and plug it back in.

Connecting from Debian / Ubuntu

Connecting using MBIM

You should now be able to connect. For testing this on Debian/Ubuntu you can install libqmi-utils:

which installs the command mbim-network . To connect you will need your APN for your 4G LTE provider. For the Sprint connection you get from Calyx this is r.ispsn . Edit /etc/mbim-network.conf (create it if it doesn’t exist) and make sure a line says «APN= » so for Calyx Sprint it would be «APN=r.ispsn». Also ensure that the file has a line that says «PROXY=yes». If you don’t use a proxy then you can’t query the active connection while it is being used. If you have a username and password see man mbim-network .

You might want to stop network-manager before you run this test:

Check that you can use mbimcli to talk to the device at all:

Start the network connection:

If it works you should see a new network interface probably called wwan0 when you run ip link .

Now to figure out which IP, gateway and DNS to use you can run:

I got the IPv4 IP and subnet 184.250.142.38/30 so to set it I did:

and then to set the gateway (in my case 184.250.142.37):

You should now be able to ping 8.8.8.8 .

If you want to configure a nameserver then you can edit /etc/resolv.conf but remember to put it back the way it was before re-starting network-manager.

Connecting using QMI

If MBIM doesn’t work for you, you can try using swi_setusbcomp.pl to switch to a USB composition that includes QMI.

Then you can repeat the above instructions for MBIM but with the package libqmi-utils , the config file /etc/qmi-network.conf and the commands qmi-network and qmicli . The command to get the IP and gateway is different though and I don’t know what it is for qmicli .

OpenWRT doesn’t seem to have complete official support for MBIM/QMI modems. An updated (as of late 2018) patch-set that uses ModemManager is available here. The problem with this solution (and why it will probably not get merged) is that it requires DBus rather than ubus.

The other option is to use the GoldenOrb ROOter firmware which automates everything via a nice web UI, but then you’re no longer running stock OpenWRT.

For now it just doesn’t seem that MBIM and QMI is well-integrated into OpenWRT, but I could be wrong. It could be that it’s simply not documented. The only mention seems to be here. For QMI, using the uqmi utility manually is documented here but it doesn’t seem to be integrated into uci or ubus .

Читайте также:  Менеджер паролей для линукс

Manually configuring using umbim

OpenWRT does have a utility for mbim called umbim . You can install it using:

If you want to use it on a non-openwrt system you can compile it like so:

Now you can run umbim .

To install all the required packages for umbim on OpenWRT:

With umbim you can connect like so:

E.g. for Calyx Sprint the last command is just:

When you are connected you should get some output from umbim like:

and an interface, probably named wwan0 will appear.

To get the IP config do:

Now set your IP and gateway based on the config, e.g:

That’s it! (well maybe you want to set DNS as well, but otherwise you should be online).

Integration with OpenWRT

Manually running a bunch of commands to connect after each reboot is obviously not ideal.

I found a nice guide for how to get MBIM working properly in OpenWRT here but unfortunately the links to the files are broken. I did find a working link to the /lib/netifd/proto/mbim.sh file here and that seems to be the core of it. It seems like the rest of the missing files implement some sort of automatic ping and re-connect when the 4G LTE connection stops working.

Locking to specific channel/frequency

TODO There is a way to force the modem to only use specified channels using AT commands. This could be useful if some channels are more crowded than others or if you have an antenna which doesn’t work well for some channels.

It seems that many people experience intermittent disconnections with the MC7455. I’ve seen this happen myself and the GoldenOrb ROOter firmware has a nice feature for detecting these disconnects and re-connecting automatically. You have to enable this feature using the web UI. Remember to specify the IP to ping, otherwise it won’t work.

For OpenWRT you could write a simple scripts that pings some server and then reboots or re-initializes the modem when pings begin failing. Or maybe you could look at how it’s done in GoldebOrb ROOter.

Some have reported that the newer and faster EM7565 modem doesn’t suffer from these disconnection issues but I have not tested this.

For troubleshooting modem configuration, I recommend this guide.

Источник

поиски 4g/3g модема, с совместимостью с linux

Собственно сабж. Требования следующие:

1) 100 % поддержка linux.проблем с этим у новых моделей -полно;

2 желательно поддержка как и 4g ,таки и 3 и ниже;

3) возможность закупки большой партии без сильного гемора ( 300-500 штук,гемором считать время доставки более 6 недель)

4) крайне желательна или не залочка на оператора,или предсказуемая и стабильная разлочка от него.

Что было уже проверено:

+ легко заводится под linux

— устарел,купить уже проблемно

— неудолеворительное качество связи в сложных условиях

Модем ZTE MF667

— С линуксом завести не удалось

— под linux не работает

— довольно проблемная разлочка

— под линуксом работать отказался

Собственно таков результат.Жду боевых специалистов по всему 🙂

Перемещено DoctorSinus из talks

Тоже в поисках такого модема.

Если без 4g можно обойтись Huawei 171 — неплохой вариант. Нормальное у него качество связи. У меня ещё валяется такой от Билайн, единственный без проблем с любым дистрибутивом и даже не залочен.

У меня их тут валяется почти сотня .Увы,массовые его закупки уже крайне сложны,ибо не производят.

хороший тред.
можно ссылаться на него, когда кто-то будет заявлять что в линуксе нет проблем с железом.

Давай без офтопа. P.S. проблемы с модемами в линуксе 100500 лет уже

технический вопрос в толксах

Почему не возьмешь 4G роутер?

Дорог.Модем используется в машине,нет ни лишнего места,не лишнего эллектричества

В тех разделе ответит полтора анонимуса,через год.Как будет найдено решение,попрошу переместить в тех раздел.

Почему-то гугл выдаёт истории узбека с мегафоновскими модемами (или же они одно и то же обощначение на разные модели лепят?). ZTE MF667 вроде тоже (разве что упоминаются проблемы с билайновской залочкой, которая привязывает к их программе).

Так что есть подозрение, что 4.2.

Если требуется работа из коробки, то ради 500 штук можно автоматизировать настройку.

Так сюда эти полтора анонимуса вообще не ответят.

тьфу ты, подписался на тред — думал посоветуют что, а тут срач один.

На DX есть и достаточно недорогие варианты. Уж не знаю, что там по поводу надежности и покупки больших партий.

ZTE MF667 именно с билайном и был.В данный момент нет способа его разлочить, а не разлоченный,он каждые 120 сек рвёт соединение ,под виндой -рестартиться,под линуксом-нет.

у 150 — проблемы вообще непонятные- пропадает доступ до com порта. 100 -нельзя разлочить,под линуксом видно только флешку ( не вшитый диск с дровами под винду,а именно кардридер)

В любом случае-истории успеха привествуются

Спасибо,я уже облазил DX.про совместимость с линуксом не ясно,заказывать пару штук для тестов,и ждать месяцы можно,но опять таки не ясно на сколько возможны большие партии,и вероятность что не взлетит не нулевая.

Читайте также:  Install pip windows command

Я думаю что-то дельное проскачет

Даже еще дешевле есть варианты. А если оттуда выпилить WiFi (не знаю, возможно ли), то он и жрать много не должен. А можешь наоборот, заодно пассажирам WiFi раздать.

про совместимость с линуксом не ясно

Какая может быть совместимость/несовместимость с линуксом у роутера?

ZTE MF667 именно с билайном и был.В данный момент нет способа его разлочить, а не разлоченный,он каждые 120 сек рвёт соединение ,под виндой -рестартиться,под линуксом-нет.

А не-билайновский нельзя купить? Вроде продаются.

Я наверно дурак,но м 100 ,как и yota брендированный модем — фактически 4g роутеры. И если есть проблемы у м 100,то почему не быть проблемам у этого 4g роутера?Я на самом деле только за,и если этот роутер будет работать-то это прекрасное решение проблемы.

Можно.Но цена не сильно вкусная,да и 4g нема, да ещё и разлочка + перешивка.Если их сотни -это пара дней очень нудной и грустной работы.

Часто вижу отметки о возможности/трудности/невозможности/ разлочки, но не догоняю цимус.

Можете пояснить что дает разлочка оператора ?

Вот, смотри фото. Втыкаешь туда Ethernet кабель, а какая у тебя ОС на другой стороне вообще фиолетово.

Можете пояснить что дает разлочка оператора ?

Возможность вставлять любую сим-карту. В случае с билайном ещё и отвязку от их мега-нано-программы.

Да я не слепой .У тебя были истории успеха с подобным агрегатом?

Конечно нет. Все сказанное выше — исключительно на правах диванного аналитика. Однако есть некая уверенность в кроссплатформенности Ethernet. Через Ethernet привязать девайс к ОС — это нужно очень хорошо постараться.

Часто вижу отметки о возможности/трудности/невозможности/ разлочки, но не догоняю цимус.
Можете пояснить что дает разлочка оператора ?

Что касается Билайна — нормальную работу под линуксом (программа от билайна под виндами раз в две минуты шлёт в модем строку, которую, конечно, можно подделать, но зачем?). Что касается остальных — работа с другими симками.

стоять.это роутер ДЛЯ 3/4 g модема.Т.е. не замена модема,а лишь прокладка между модемом и ос,причём с совершенно неизвестной совместимостью с модемом.Даже если это будет решать проблему с совместимостью,это не снимает проблему с самим модемом.

huawei e1820 мегафоновский

HSDPA вроде работало, лок снял по манам с интернетов, даш поставил свежий модифицированный на 128 метров с линуксовой частью оттуда же

местность сельская, поэтому покрытие 3g так себе, но мегабит 5 было в пике тем не менее

разъем под внешнюю антенну есть, но работает модем с ней отвратно — под внешнюю антенну эту модель не рекомендуют, я использовал модем прилепив его присоской к USB удлинителю на окно в режиме 3g modem only(так меньше просадка на удлинителе)

в принципе, работал в бубунте как под оффтопиком, т.е. удовлетворительно

Хм, действительно. То, о чем я говорил, это кажется вот. Но тут цена уже выше.

Яндексовский маркет говорит что нет в наличии.Устарел?

Дорого. За такие деньги можно взять yota модем,а он работает искоропки,единственный минус- нет 3г.Если найдёшь аналог, с ценой меньше 1900 — то честь тебе и хвала ,и можно тестить.

надо же опсосам что-то впаривать хомякам вместе с симкой

мне-то и e1550 за глаза хватало

Сейчас пишу через Мегафон М100-1. Под Linuxом завелся без малейших проблем, так что его не работа в Linux похоже на ЛПП.

Про разлочку не интересовался, так что ничего сказать не могу.

можешь сказать что за дистрибутив,и юзаешь ли нетворк менеджер?

А есть-ли в природе 3g модемы с cdc(communication device class)? С ними по идее вообще проблем быть не должно.

Ссылки выше- разве не оно?

можешь сказать что за дистрибутив

Сначала настроил руками, потом через нетворк менеджер. Оба способа работают.

спасибо,буду копать.Хотя залоченный он в любом случае мне малополезен

буквально вчера поднял с консоли х*явей E3276, (это я выяснил какой-то ат-командой) хотя, на корпусе написано E392.

Это вседиапазонный модем, дрова в исходниках прямо на нём. собрал, поставил. мобильного партнера выкинул в топку.

modprobe hw_cdc_acm (то, что собрал)
а потом /dev/ttyUSB0
at^ndisdup=1,1,«internet»

и ты в интернете.

//настраивал удалённо, так что, модема даже не видал.

Здрасти, У менья попался MF667 с болгарского Вивакома. Этот модем Linux видит как диска, так как на него диск с програмного объезпечения. Для того, надо ставит цацку в режиме «modem only» при помощю АТ команд, но я не успел запустит в РРР терминале, так как Linux не понимает его как модема. Виндовская «хипер-терминал» тоже не видит. Проблему решил следующим: 1. Запустил под Виндовсе с отцовском обьезпечением. 2. Когда заработал (замигала синяя лампочка) выкинул из USB не выключая. 3. Поставил симку в объичного GSM-а и выбрал «не проверять РИН-кода. После этого модем работает только поставляя в USB (без никакого диалера) и на Win и Lin (Fedora 20) и на планшете (Android) через хубом и на андроидовой китайской поделкой айфона i5C.

Источник

Оцените статью