Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:network:wan:wwan:ltedongle [2023/09/17 14:38] – [Optional Packages] andrewz | docs:guide-user:network:wan:wwan:ltedongle [2024/11/27 18:05] – [LTE or 5G Modem Preparation] andrewz | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| Many of currently available 3G/4G/5G modems use **QMI** and/or **MBIM** protocol to interact with the //host system//, e.g. with a router. | Many of currently available 3G/4G/5G modems use **QMI** and/or **MBIM** protocol to interact with the //host system//, e.g. with a router. | ||
| - | For your information, | + | For your information, |
| - | This recipe explains how to setup and configure OpenWrt for using 3G/4G/5G USB modems for WAN connection, using QMI interface. | + | This recipe explains how to setup and configure OpenWrt for using 3G/4G/5G USB modems for WAN connection, using QMI or MBIM protocol. |
| The same applies to external modems connected to USB ports and internal models installed into M.2(NGFF) or mPCIe slots. | The same applies to external modems connected to USB ports and internal models installed into M.2(NGFF) or mPCIe slots. | ||
| - | You may want to checkout the [[docs:guide-user:network:wan:multiwan: | + | You may want to checkout the [[docs/guide-user/network/wan/multiwan/mwan3]] (Multi WAN load balancing/ |
| ===== About ===== | ===== About ===== | ||
| - | Many modern USB modems may operate in different modes. If your modem provides only //serial// interface(s) like ''/ | + | Many modern USB modems may operate in different modes. If your modem provides only //serial// interface(s) like ''/ |
| + | * **MBIM**, see below on this page | ||
| * **NCM**, see [[docs: | * **NCM**, see [[docs: | ||
| * **ECM**, see [[docs: | * **ECM**, see [[docs: | ||
| * **RNDIS**, see [[docs: | * **RNDIS**, see [[docs: | ||
| - | If it is possible to switch your modem to provide QMI interface - then this article | + | If it is possible to switch your modem to provide QMI or MBIM interface - then this article |
| ==== Legacy Modem Preparation ==== | ==== Legacy Modem Preparation ==== | ||
| - | If **QMI** interface is not exposed by the modem initially you may need to switch it to another mode or // | + | If QMI or MBIM interface is not exposed by the modem initially you may need to switch it to another mode or // |
| :!: Please read about [[docs: | :!: Please read about [[docs: | ||
| Line 26: | Line 27: | ||
| More recent modems are set by default to MBIM or QMI mode. | More recent modems are set by default to MBIM or QMI mode. | ||
| - | This is an example for popular Quectel modems: | + | This is an example |
| < | < | ||
| AT+QCFG=" | AT+QCFG=" | ||
| Line 33: | Line 34: | ||
| AT+QCFG=" | AT+QCFG=" | ||
| </ | </ | ||
| - | Reset the power to apply changes. | + | Reset the modem to apply changes |
| + | |||
| + | \\ | ||
| + | It is worth checking the list of //PDP Contexts// (and APNs) configured on the modem. Use a // | ||
| + | < | ||
| + | AT+CGDCONT? | ||
| + | +CGDCONT: 1," | ||
| + | +CGDCONT: 2," | ||
| + | +CGDCONT: 3," | ||
| + | </ | ||
| + | |||
| + | Typically, but not always, context #1 is used for Internet connection. If it is not configured with the correct information (IP type and APN), it is recommended to set the desired parameters. Example: | ||
| + | |||
| + | < | ||
| + | AT+CGDCONT=1," | ||
| + | </ | ||
| + | |||
| + | Replace '' | ||
| + | |||
| + | For an alternative method, see [[: | ||
| + | |||
| + | \\ | ||
| + | While in the // | ||
| + | |||
| + | |||
| + | |||
| ==== Router Preparation ==== | ==== Router Preparation ==== | ||
| 1. Install OpenWrt | 1. Install OpenWrt | ||
| Line 42: | Line 69: | ||
| ==== Required Packages ==== | ==== Required Packages ==== | ||
| - | To make use of QMI protocol, packages '' | + | To make use of QMI protocol, packages '' |
| ==== Optional Packages ==== | ==== Optional Packages ==== | ||
| - | 1. Add QMI protocol support to Luci - install '' | + | 1. Add protocol support to Luci - install '' |
| 2. Add support for //serial// interfaces (ttyUSBx) - install '' | 2. Add support for //serial// interfaces (ttyUSBx) - install '' | ||
| Line 52: | Line 79: | ||
| A // | A // | ||
| - | 3. Install | + | 3. Install |
| 4. Add support for the //storage// of your modem - refer to: [[docs: | 4. Add support for the //storage// of your modem - refer to: [[docs: | ||
| ===== Sample installation ===== | ===== Sample installation ===== | ||
| - | 1. Install all the needed packages | + | 1. Install all the needed packages |
| + | * if the modem is in QMI mode: | ||
| < | < | ||
| - | opkg update | + | root@OpenWrt: |
| - | opkg install kmod-usb-net-qmi-wwan uqmi luci-proto-qmi kmod-usb-serial-option picocom | + | root@OpenWrt: |
| + | </ | ||
| + | * if the modem is in MBIM mode: | ||
| + | < | ||
| + | root@OpenWrt: | ||
| + | root@OpenWrt: | ||
| </ | </ | ||
| - | :!: If your have not enough space on your device - think of installing | + | You can also add the necessary packages when building a new image with [[https://firmware-selector.openwrt.org/ |
| - | :!: Another option is Hardware memory upgrade. Refer to your router | + | :!: If your have not enough space on your device - think about upgrading your hardware or installing [[docs: |
| - | 2. Reboot the router | + | 2. Reboot the router |
| - | < | + | |
| - | reboot | + | |
| - | </ | + | |
| - | 3. Check that everything is OK and You got new device: | + | 3. Check if you got a new //device//: |
| < | < | ||
| - | ls -l /dev/cdc-wdm0 | + | root@OpenWrt: |
| crw-r--r-- | crw-r--r-- | ||
| </ | </ | ||
| - | If you have no such device - try to find out what went wrong: | + | If there is no such device |
| - | try **dmesg** to read kernel | + | |
| - | < | + | |
| - | dmesg | + | * check the details |
| - | </ | + | |
| - | or look info about USB devices | + | |
| - | < | + | |
| - | cat / | + | |
| - | T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev# | + | < |
| - | D: Ver= 2.00 Cls=00(> | + | [...] |
| - | P: Vendor=12d1 ProdID=1506 Rev= 0.00 | + | T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev# |
| - | S: Manufacturer=Huawei Technologies | + | D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 # |
| - | S: Product=HUAWEI Mobile | + | P: Vendor=2c7c ProdID=0306 Rev= 3.10 |
| - | C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=500mA | + | S: Manufacturer=Quectel |
| - | I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=02 Driver=option | + | S: Product=EP06-E |
| + | S: SerialNumber=0123456789ABCDEF | ||
| + | C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA | ||
| + | I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option | ||
| E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms | E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| - | E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms | + | E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms |
| - | I:* If#= 1 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=01 Prot=09 Driver=qmi_wwan | + | I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option |
| - | E: Ad=82(I) Atr=03(Int.) MxPS= | + | E: Ad=83(I) Atr=03(Int.) MxPS= |
| - | I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=08 Driver=qmi_wwan | + | E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms |
| - | E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms | + | E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms |
| - | E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms | + | I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option |
| + | E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms | ||
| + | E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| + | E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| + | I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option | ||
| + | E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms | ||
| + | E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| + | E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| + | I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan | ||
| + | E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms | ||
| + | E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| + | E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms | ||
| </ | </ | ||
| Line 109: | Line 149: | ||
| ===== Configuration ===== | ===== Configuration ===== | ||
| ==== With LuCi web interface ==== | ==== With LuCi web interface ==== | ||
| - | If the package | + | [QMI]: Assuming |
| + | |||
| + | [MBIM]: Assuming '' | ||
| - | Enter your '' | + | [Common]: |
| + | |||
| + | Select Interface " | ||
| + | |||
| + | Enter your '' | ||
| + | |||
| + | Note: in IPv6-only mode it is recommended to enable '' | ||
| + | |||
| + | Assign the firewall zone (wan) on ' | ||
| + | ==== Editing text configuration files ===== | ||
| + | Add new interface to ''/ | ||
| + | |||
| + | < | ||
| + | config interface ' | ||
| + | option proto ' | ||
| + | option device '/ | ||
| + | option apn ' | ||
| + | option pdptype ' | ||
| + | </ | ||
| + | Make sure the APN name is one provided by your carrier. | ||
| + | |||
| + | Add the same interface name to the existing “wan” firewall zone in ''/ | ||
| + | < | ||
| + | config zone | ||
| + | option name ' | ||
| + | [...] | ||
| + | list network ' | ||
| + | </ | ||
| - | Assign the firewall zone (typically - " | ||
| - | ==== QMI Protocol Configuration ==== | + | ==== QMI Protocol Configuration |
| - | You can configure | + | QMI (and MBIM) interfaces could be manually configured in [[docs: |
| - | [[docs: | + | |
| - | :!: The package uqmi must be installed to use QMI protocol. | ||
| - | ^Name ^Type ^Required | + | ^ Name |
| - | |**device** | + | | **device** |
| - | |**apn** | + | | **apn** |
| - | |**auth** |string | + | | **v6apn** | string |
| - | |**username** | + | | **auth** |
| - | |**password** | + | | **username** |
| - | |**pincode** | + | | **password** |
| - | |**delay** | + | | **pincode** |
| - | |**modes** | + | | **delay** |
| - | |**pdptype** | + | | **modes** |
| - | |**profile** | + | | **pdptype** |
| - | |**dhcp** | + | | **profile** |
| - | |**dhcpv6** | + | | **v6profile** |
| - | |**autoconnect** |boolean | + | | **dhcp** |
| - | |**plmn** | + | | **dhcpv6** |
| - | |**timeout** | + | | **autoconnect** |
| + | | **plmn** | ||
| + | | **timeout** | ||
| + | | **mtu** | ||
| - | Here is a brief help about **uqmi** command line usage. | + | Here is a brief help about '' |
| + | < | ||
| <code sh> | <code sh> | ||
| - | No device given | ||
| Usage: uqmi < | Usage: uqmi < | ||
| Options: | Options: | ||
| Line 172: | Line 241: | ||
| --set-ip-family < | --set-ip-family < | ||
| --set-autoconnect < | --set-autoconnect < | ||
| + | --get-profile-settings < | ||
| + | --get-default-profile < | ||
| + | --create-profile < | ||
| + | --apn < | ||
| + | --pdp-type ipv4|ipv6|ipv4v6>: | ||
| + | --username < | ||
| + | --password < | ||
| + | --auth-type pap|chap|both|none: | ||
| + | --no-roaming false|true | ||
| + | --modify-profile < | ||
| + | --apn < | ||
| + | --pdp-type ipv4|ipv6|ipv4v6>: | ||
| + | --username < | ||
| + | --password < | ||
| + | --auth-type pap|chap|both|none: | ||
| + | --no-roaming false|true | ||
| --get-current-settings: | --get-current-settings: | ||
| --get-capabilities: | --get-capabilities: | ||
| Line 198: | Line 283: | ||
| --get-msisdn: | --get-msisdn: | ||
| --reset-dms: | --reset-dms: | ||
| + | --get-device-operating-mode | ||
| --set-device-operating-mode < | --set-device-operating-mode < | ||
| (modes: online, low_power, factory_test, | (modes: online, low_power, factory_test, | ||
| Line 205: | Line 291: | ||
| --uim-verify-pin1 < | --uim-verify-pin1 < | ||
| --uim-verify-pin2 < | --uim-verify-pin2 < | ||
| + | --uim-get-sim-state: | ||
| + | --uim-power-off: | ||
| + | --uim-slot: | ||
| + | --uim-power-on: | ||
| + | --uim-slot: | ||
| --set-network-modes < | --set-network-modes < | ||
| Available modes: all, lte, umts, gsm, cdma, td-scdma | Available modes: all, lte, umts, gsm, cdma, td-scdma | ||
| Line 219: | Line 310: | ||
| --get-signal-info: | --get-signal-info: | ||
| --get-serving-system: | --get-serving-system: | ||
| + | --get-system-info: | ||
| + | --get-lte-cphy-ca-info: | ||
| + | --get-cell-location-info: | ||
| + | --get-tx-rx-info < | ||
| --list-messages: | --list-messages: | ||
| + | --storage < | ||
| --delete-message < | --delete-message < | ||
| + | --storage < | ||
| --get-message < | --get-message < | ||
| + | --storage < | ||
| --get-raw-message < | --get-raw-message < | ||
| + | --storage < | ||
| --send-message < | --send-message < | ||
| --send-message-smsc < | --send-message-smsc < | ||
| Line 229: | Line 328: | ||
| --wda-set-data-format < | --wda-set-data-format < | ||
| --wda-get-data-format: | --wda-get-data-format: | ||
| + | |||
| </ | </ | ||
| + | </ | ||
| + | \\ | ||
| - | ==== MBIM Protocol | + | ==== MBIM Protocol |
| - | Currently, there is not enough information about mbim protocol as it's being actively developed. If you are curious about setting up mbim protocol, you may ask [[https://lists.openwrt.org/ | + | MBIM configuration |
| + | ^ **Name** | ||
| + | | **device** | ||
| + | | **apn** | ||
| + | | **auth** | ||
| + | | **username** | ||
| + | | **password** | ||
| + | | **pincode** | ||
| + | | **delay** | ||
| + | | **pdptype** | ||
| + | | **ipv6** | ||
| + | | **dhcp** | ||
| + | | **dhcpv6** | ||
| + | | **allow_roaming ** | boolean | ||
| + | | **allow_partner** | ||
| + | | **mtu** | ||
| - | Here is a brief help about **umbim** command line. | + | Here is a brief help about '' |
| <code sh> | <code sh> | ||
| - | umbim help | + | root@OpenWrt: |
| Usage: mbim < | Usage: mbim < | ||
| Options: | Options: | ||
| Line 245: | Line 362: | ||
| </ | </ | ||
| - | ==== Interface configuration | + | '' |
| - | First check that everything works correctly: | + | ==== Manual validation |
| + | Check the currently configured APN: | ||
| < | < | ||
| - | root@OpenWrt: | + | root@OpenWrt: |
| - | "disconnected" | + | { |
| + | | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Change the APN and/or IP type (an alternative method to using AT commands mentioned above): | ||
| + | < | ||
| + | root@OpenWrt: | ||
| + | root@OpenWrt: | ||
| + | root@OpenWrt: | ||
| + | </ | ||
| + | where " | ||
| + | |||
| + | Check network registration and signal strength: | ||
| + | < | ||
| + | root@OpenWrt: | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| </ | </ | ||
| and | and | ||
| Line 262: | Line 408: | ||
| } | } | ||
| </ | </ | ||
| - | To start the internet | + | |
| + | Check the connection | ||
| < | < | ||
| - | uqmi -d / | + | root@OpenWrt: |
| + | " | ||
| </ | </ | ||
| - | Where " | ||
| - | :!: Many providers | + | To manually start the Internet connection issue a command: |
| + | < | ||
| + | root@OpenWrt: | ||
| + | </ | ||
| + | where " | ||
| + | |||
| + | :!: Some providers | ||
| Check the status: | Check the status: | ||
| < | < | ||
| - | uqmi -d / | + | root@OpenWrt: |
| " | " | ||
| </ | </ | ||
| - | **--autoconnect** key says that you want always be connected, once dongle | + | '' |
| :!: It will be kept after reboot. | :!: It will be kept after reboot. | ||
| - | In case you need additional authentication, | + | In case you need additional authentication, |
| < | < | ||
| --start-network < | --start-network < | ||
| Line 290: | Line 443: | ||
| </ | </ | ||
| - | ==== Network configuration ===== | ||
| - | Now you should add new **Interface** to / | ||
| - | < | ||
| - | config interface ' | ||
| - | option ifname ' | ||
| - | option proto ' | ||
| - | </ | ||
| - | You can do this using the vi text editor, but if you're not comfortable with that, point your browser to 192.168.1.1 again, choose Network -> Interfaces and click Add new interface. | ||
| - | |||
| - | Or if not working, try with this: | ||
| - | < | ||
| - | config interface ' | ||
| - | option proto ' | ||
| - | option ' | ||
| - | </ | ||
| - | |||
| - | Write **wwan** as the name of the interface and make it cover the **wwan0** interface. Choose **DHCP client** as the protocol. | ||
| - | |||
| - | FIXME Insert a screenshot of LUCI add Interface. I have not enought rights. | ||
| - | |||
| - | ==== Firewall configuration ===== | ||
| - | The only thing that is left - Add **wwan** interface to **WAN zone** | ||
| - | |||
| - | Using LUCI: | ||
| - | * go to Network -> Firewall, scroll down to wan and click the Edit button | ||
| - | * add a checkmark to the **wwan** box under Covered networks heading, click **Save & Apply** | ||
| - | |||
| - | Using CLI: | ||
| - | * Edit **/ | ||
| - | |||
| - | < | ||
| - | config zone | ||
| - | option name wan | ||
| - | list | ||
| - | list | ||
| - | list | ||
| - | option input REJECT | ||
| - | option output | ||
| - | option forward | ||
| - | option masq 1 | ||
| - | option mtu_fix | ||
| - | </ | ||
| - | |||
| - | :-D That's It! 8-) | ||
| - | FIXME Insert a Screen Shot from LUCI. | ||
| ==== Checking your balance ===== | ==== Checking your balance ===== | ||
| Line 343: | Line 451: | ||
| cat / | cat / | ||
| </ | </ | ||
| - | and in the second (*101# is my ussd code): | + | and in the second (*101# is my USSD code): |
| < | < | ||
| echo -ne ' | echo -ne ' | ||
| Line 385: | Line 493: | ||
| </ | </ | ||
| - | __**My router is not detecting the dongle. What should I do?**__ | + | __**My router is not detecting the modem. What should I do?**__ |
| Try the following commands: | Try the following commands: | ||
| Line 395: | Line 503: | ||
| usbmode -s | usbmode -s | ||
| </ | </ | ||
| - | Then wait for the dongle | + | Then wait for the modem to get issued an IP from your ISP. |
| - | __**No serial device is available | + | __**No serial |
| - | You may need to install the packages | + | You may need to install the missing |
| < | < | ||
| - | opkg install kmod-usb-net-cdc-mbim libmbim | + | opkg install kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb-serial-qualcomm |
| </ | </ | ||
| - | At least for the Sierra Wireless EM7455 is this the case. | ||
| - | __**I have to issue //usbmode -l// and //usbmode -s// every time I reboot my router to detect my USB device. How can I automate it?**__ | ||
| - | |||
| - | Include the following codes into /// | ||
| - | < | ||
| - | / | ||
| - | /bin/sleep 2 | ||
| - | / | ||
| - | </ | ||