Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:network:wan:wwan:ethernetoverusb_ncm [2023/12/24 15:16] – [My router is not detecting the dongle. What should I do?] andrewzdocs:guide-user:network:wan:wwan:ethernetoverusb_ncm [2024/11/17 11:17] – [Network configuration] andrewz
Line 1: Line 1:
 ====== Use NCM USB Dongle for WAN connection ====== ====== Use NCM USB Dongle for WAN connection ======
  
-[[http://www.mcci.com/mcci-v5/hostside/ncm_drivers.html|NCM]] (Network Control Model) is [[https://en.wikipedia.org/wiki/Ethernet_over_USB|Ethernet over USB]] protocol used by some fast speed USB modems/dongles.+[[http://www.mcci.com/mcci-v5/hostside/ncm_drivers.html|NCM]] (Network Control Model) is [[https://en.wikipedia.org/wiki/Ethernet_over_USB|Ethernet over USB]] protocol used by some USB modems.
  
-For more information about different protocols used:+The same applies to external modems connected to USB ports ("dongles") and internal models installed into M.2(NGFF) or mPCIe slots. 
 + 
 +For more information about other protocols commonly used:
   * **PPP**, see [[docs:guide-user:network:wan:wwan:3gdongle|How to use 3g/UMTS USB Dongle for WAN connection]]   * **PPP**, see [[docs:guide-user:network:wan:wwan:3gdongle|How to use 3g/UMTS USB Dongle for WAN connection]]
   * **QMI** and **MBIM**, see [[docs:guide-user:network:wan:wwan:ltedongle|How to use LTE modem in QMI mode for WAN connection]]   * **QMI** and **MBIM**, see [[docs:guide-user:network:wan:wwan:ltedongle|How to use LTE modem in QMI mode for WAN connection]]
 +  * **ECM**, see [[docs:guide-user:network:wan:wwan:ethernetoverusb_cdc|Use cdc_ether driver based dongles for WAN connection]]
   * **RNDIS**, see [[docs:guide-user:network:wan:wwan:ethernetoverusb_rndis|How to use LTE modem in RNDIS mode for WAN connection]]   * **RNDIS**, see [[docs:guide-user:network:wan:wwan:ethernetoverusb_rndis|How to use LTE modem in RNDIS mode for WAN connection]]
  
Line 23: Line 26:
  
 ==== Required Packages ==== ==== Required Packages ====
-To make use of NCM protocol, packages ''kmod-usb-net-huawei-cdc-ncm'' and ''comgt-ncm'' are needed.+To make use of NCM protocol, packages ''kmod-usb-net-huawei-cdc-ncm'' and ''comgt-ncm'' are needed (for Huawei modems). Other modems may require different ''kmod-*'' packages.
  
-To access the PC UI Interface (AT Command port) package ''kmod-usb-serial-option'' is typically needed.+To access the PC UI Interface (AT Command port) package ''kmod-usb-serial-option'' is typically needed. Some modems may need ''kmod-usb-acm'' driver instead.
  
 ==== Optional Packages ==== ==== Optional Packages ====
Line 35: Line 38:
  
 ===== Installation ===== ===== Installation =====
-1. Install all the needed packages+1. Install all the needed packages either in Luci → System → Software or via command line: 
 + 
 +  * For Huawei modems: 
 <code> <code>
-opkg update +root@OpenWrt:~# opkg update 
-opkg install kmod-usb-net-huawei-cdc-ncm luci-proto-ncm picocom+root@OpenWrt:~# opkg install kmod-usb-net-huawei-cdc-ncm luci-proto-ncm picocom
 </code> </code>
  
-Other modules will be automatically installed as //dependencies//.+  * other modems may require different packages, this is an example for Mikrotik modems:
  
-:!: If your have not enough space on your device - think of installing [[docs:guide-user:additional-software:extroot_configuration|Rootfs on External Storage (extroot)]] 
- 
-:!: Another option is Hardware memory upgrade. Refer to your router Forum thread for possibility and instructions. 
- 
-2. Reboot the router 
 <code> <code>
-reboot+root@OpenWrt:~# opkg update 
 +root@OpenWrt:~# opkg install kmod-usb-net-rndis kmod-usb-acm luci-proto-ncm picocom
 </code> </code>
  
-3. Check that everything is OK and you got new device: +Additional packages will be automatically installed as //dependencies//.
-<code> +
-ls -l /dev/cdc-wdm0+
  
-crw-r--r--    1 root     root      180, 176 Oct  1 12:03 /dev/cdc-wdm0 +You can also add the necessary packages when building a new image with [[https://firmware-selector.openwrt.org/|Firmware Selector]].
-</code>+
  
-If you have no such device - try to find out what went wrong:+:!: If your have not enough space on your device - think about upgrading your hardware or installing [[docs:guide-user:additional-software:extroot_configuration|Rootfs on External Storage (extroot)]]. Refer to your router wiki page or forum thread for possibility and instructions.
  
-try **dmesg** to read kernel logs on USB init+2. Reboot the router by executing ''reboot'' on the console. 
 + 
 +3. Check if you got a new //device//:
 <code> <code>
-dmesg+root@OpenWrt:~# ls -l /dev/cdc* 
 + 
 +crw-r--r--    1 root     root      180, 176 Oct  1 12:03 /dev/cdc-wdm0
 </code> </code>
-or look info about USB devices and interfaces present in the system: 
-<code> 
-cat /sys/kernel/debug/usb/devices 
  
-...+If there is no such device found, there is a possibility that completely different name is in use by the device driver, like ''usb0'' or ''eth1''Try to get more details: 
 +  * Open System Log from Luci web interface and see what it shows regarding newly discovered USB device(s) 
 +  * execute ''dmesg'' on the console and see if any relevant information is present in the kernel log 
 +  * check the details about USB devices detected by the system by running ''cat /sys/kernel/debug/usb/devices'' on the console: 
 +<code> 
 +[...]
 T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0 T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
 D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1 D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
Line 95: Line 100:
 E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
 E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=125us E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
- 
-... 
 </code> </code>
  
Line 105: Line 108:
 [[docs:guide-user:base-system:uci|UCI]] is supporting **NCM** network protocol configuration.  [[docs:guide-user:base-system:uci|UCI]] is supporting **NCM** network protocol configuration. 
  
- :!: The package comgt-ncm + modem specific driver must be installed to use NCM. 
 ^ Name      ^ Type       ^ Required  ^ Default          ^ Description                                                                                                                  ^ ^ Name      ^ Type       ^ Required  ^ Default          ^ Description                                                                                                                  ^
-| device    | file path  | yes       | (none)           | NCM device node, typically **/dev/cdc-wdm0** or **/dev/ttyUSB#**                                                             +| device    | file path  | yes       | (none)           | NCM device node, usually ''/dev/ttyUSBx'' or ''/dev/ttyACMx''                                                                
-| apn       | string     | yes       | (none)           Used APN                                                                                                                     |+| apn       | string     | yes       | (none)           | APN to use                                                                                                                   |
 | pincode   | number     | no        | (none)           | PIN code to unlock SIM card                                                                                                  | | pincode   | number     | no        | (none)           | PIN code to unlock SIM card                                                                                                  |
 | username  | string     | no        | (none)           | Username for PAP/CHAP authentication                                                                                         | | username  | string     | no        | (none)           | Username for PAP/CHAP authentication                                                                                         |
Line 114: Line 116:
 | auth      | string     | no        | (none)           | Authentication type: **pap**, **chap**, **both**, **none**                                                                   | | auth      | string     | no        | (none)           | Authentication type: **pap**, **chap**, **both**, **none**                                                                   |
 | mode      | string     | no        | (modem default)  | Used network mode, not every device support every mode: **preferlte**, **preferumts**, **lte**, **umts**, **gsm**, **auto**  | | mode      | string     | no        | (modem default)  | Used network mode, not every device support every mode: **preferlte**, **preferumts**, **lte**, **umts**, **gsm**, **auto**  |
-| pdptype   | string     | no        | IP               Used IP-stack mode, **IP** (for IPv4), **IPV6** (for IPv6) or **IPV4V6** (for dual-stack)                                    |+| pdptype   | string     | no        | IP               PDP Context Type, **IP** (for IPv4), **IPV6** (for IPv6) or **IPV4V6** (for dual-stack)                                      | 
 +| profile   | number     | no        | 1                | PDP Context Identifier                                                                                                       |
 | delay     | number     | no        | 0                | Seconds to wait before trying to interact with the modem (some modems require up to 30 s.)                                   | | delay     | number     | no        | 0                | Seconds to wait before trying to interact with the modem (some modems require up to 30 s.)                                   |
-| profile   | number     | no        | 1                | Index of a PDP context                                                                                                       | 
  
-You can configure UCI manually using [[docs:techref:uci|uci command line]] or [[docs:guide-user:base-system:user.beginner.cli#editing.files| text editor]] or with [[docs:techref:luci| Luci]] package **luci-proto-ncm**.+You can configure the interface manually using [[docs:techref:uci|uci command line]] or [[docs:guide-user:base-system:user.beginner.cli#editing.files| text editor]] or with [[docs:techref:luci| Luci]] package **luci-proto-ncm**.
  
  :!: If option "mode" is set, the corresponding AT command is sent to the modem on every connection attempt. Most of modems (at least all Huawei models) store this setting in internal flash. So on each connection OpenWrt writes to modem flash. It is recommended to not use this option after the required mode is set once.  :!: If option "mode" is set, the corresponding AT command is sent to the modem on every connection attempt. Most of modems (at least all Huawei models) store this setting in internal flash. So on each connection OpenWrt writes to modem flash. It is recommended to not use this option after the required mode is set once.
              
 ==== Network configuration ===== ==== Network configuration =====
-Now you should add a new **Interface** to ''/etc/config/network'':+ 
 +Using Luci web interface: navigate to Network → Interfaces → Add new interface… → Protocol : NCM, Interface: "ttyUSB1" 
 + 
 +The interface selected above is the "AT Command Port" or "PCUI" in Huawei terms, ''ttyUSB1'' is shown here as an example only, different modems have different port assignments like ''/dev/ttyUSBx'' or ''/dev/ttyACMx''. The //data// interface like ''wwan0'' and corresponding device like ''/dev/cdc-wdm0'' will be discovered by the connection script automatically. 
 + 
 +Enter your APN and select the 'IP Protocol' as instructed by the carrier. 
 + 
 +Assign the firewall zone (wan) on 'Firewall Settings' tab.\\  
 +\\  
 +Alternatively you can edit the configuration files with any text editor like ''vi'' or ''nano'': 
 + 
 +  * add a new **Interface** in ''/etc/config/network'':
 <code> <code>
 config interface 'wwan' config interface 'wwan'
         option proto 'ncm'         option proto 'ncm'
-        option device '/dev/cdc-wdm0'+        option device '/dev/ttyUSB1'
         option pdptype 'IP'         option pdptype 'IP'
         option apn 'internet'         option apn 'internet'
 </code>  </code> 
  
-You can do this using any text editor like ''vi'' or ''nano'' or use Luci web interface+  * add the same interface name to the "wan" firewall zone in ''/etc/config/firewall'': 
- +<code> 
-Go to Network → Interfaces → Add new interface… → Protocol : NCM, Interface: cdc-wdm0 +config zone 
- +    option name 'wan' 
-Enter your APN and select the 'IP Protocolas instructed by the carrier+    [...] 
- +    list network 'wwan' 
-Assign the firewall zone (wan) on 'Firewall Settingstab.+</code> 
  
  
  • Last modified: 2024/11/20 12:02
  • by andrewz