Show pagesourceOld revisionsBacklinksBack to top × Table of Contents Use cdc_ether driver based dongles for WAN connection Required Packages Modem Preparation Network Configuration Using Luci Editing configuration file Additional steps Modem Settings Use cdc_ether driver based dongles for WAN connection This recipe explains how to setup and configure OpenWrt for using a USB 3G/4G/5G modem operating in ECM mode supported by cdc_ether driver. The same applies to external modems connected to USB ports and internal models installed into M.2(NGFF) or mPCIe slots. Required Packages Before using your USB modem, install packages either in Luci → System → Software or via command line: root@OpenWrt:~# opkg update root@OpenWrt:~# opkg install kmod-usb-net-cdc-ether Some [older] modems may additionally need usb-modeswitch package. It is used to switch the modem into a “working” mode. More about: USB mode switch If the installation was successful, plugging the USB dongle in or restarting the internal modem will show similar messages in the log: root@OpenWrt:~# dmesg [ 208.424433] usb 1-1: new high-speed USB device number 3 using ehci-platform [ 209.251501] usb 1-1: USB disconnect, device number 3 [ 209.652469] usb 1-1: new high-speed USB device number 4 using ehci-platform [ 210.060700] cdc_ether 1-1:1.0 usb0: register 'cdc_ether' at usb-1b000000.usb-1, CDC Ethernet Device, d2:60:c8:b6:65:46 Note the interface name (usb0) mentioned on the last line, it will be used later. For another modem the name could be eth2 or something like that. It is worth to check the output of cat /sys/kernel/debug/usb/devices to make sure the necessary drivers are loaded for USB interfaces: root@OpenWrt:~# cat /sys/kernel/debug/usb/devices [...] T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=12d1 ProdID=14dc Rev= 1.02 S: Manufacturer=HUAWEI S: Product=HUAWEI Mobile C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=125us [...] Modem Preparation Some modems require manual switching into ECM mode by using AT commands. This could be done on any computer prior to installation or on the router directly using a terminal application like picocom. More about: sending AT commands from the router. A few extra packages need to be installed in order to “talk” with the modem from the router: opkg install kmod-usb-serial-option picocom This is an example for popular Quectel modems: AT+QCFG="usbnet" # check the current mode AT+QCFG="usbnet",1 # set ECM mode Network Configuration Using Luci Navigate to Network → Interfaces → Add new interface... → Protocol : DHCP Client, Interface: usb0 (or another name found earlier) Assign this new interface to “wan” firewall zone. Open Advanced Settings and make sure that both “Use default gateway” and “Use DNS servers advertised by peer” checkboxes are selected. Editing configuration file Alternatively, add a new section to the configuration file via command line: root@OpenWrt:~# vi /etc/config/network [...] config interface 'lte' option proto 'dhcp' option ifname 'usb0' Additional steps For some modems adding an interface will be sufficient, but some others may need an additional “dial” command to be sent to the AT command port. It is recommended to install additional packages picocom kmod-usb-serial-option and consult AT Commands Guide for the given modem. Modem Settings Compared to PPP or QMI protocols there are no settings provided from OpenWrt for the modem. All the configuration changes are made on the modem itself, typically by using AT commands. Alternatively, some manufacturers (Huawei, ZTE, etc) provide a web interface where you can enter your APN, check connection status, enter PIN code, enable data roaming, change bands, send/receive SMS, etc. As an example, with Huawei modem in HiLink mode the interface is accessible via http://hi.link or http://192.168.8.1 (that is a default IP address). If the request is blocked, it may be that your firewall does not allow it. In this case you can define a rule like the following: config rule option name 'Allow-HiLink' option src 'lan' option proto 'tcp' option target 'ACCEPT' option family 'ipv4' option dest 'wan' list dest_ip '192.168.8.1' This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.OKMore information about cookies Last modified: 2023/09/30 08:23by andrewz