Huawei MS2732h-517 in NCM mode

I’m attempting to get a new USB modem to work with my MT300N-V2. I can plug it in and use 3G on ttyUSB no problem. But I would like to get it working via LTE.

I was previously using a Huawei e397u-53 in qmi mode, no issues there. Unfortunately booting up the router with the new modem did not automatically work in qmi mode. I see evidence that the MS2732h uses NCM from the system log:

Fri Sep 28 16:30:38 2018 kern.info kernel: [   17.519177] huawei_cdc_ncm 1-1:1.3: MAC-Address: 00:1e:10:1f:00:00
Fri Sep 28 16:30:38 2018 kern.info kernel: [   17.525463] huawei_cdc_ncm 1-1:1.3: setting rx_max = 16384
Fri Sep 28 16:30:38 2018 kern.info kernel: [   17.547562] huawei_cdc_ncm 1-1:1.3: NDP will be placed at end of frame for this device.
Fri Sep 28 16:30:38 2018 kern.info kernel: [   17.555998] huawei_cdc_ncm 1-1:1.3: cdc-wdm0: USB WDM device
Fri Sep 28 16:30:38 2018 kern.info kernel: [   17.563018] huawei_cdc_ncm 1-1:1.3 wwan0: register 'huawei_cdc_ncm' at usb-101c0000.ehci-1, Huawei CDC NCM device, 00:1e:10:1f:00:00
Fri Sep 28 16:30:38 2018 kern.info kernel: [   17.575349] usbcore: registered new interface driver huawei_cdc_ncm

So I’ve followed the instructions over at [OpenWrt Wiki] Use NCM USB Dongle for WAN connection. I’ve installed the necessary modules:

opkg install comgt-ncm kmod-usb-net-huawei-cdc-ncm usb-modeswitch kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan

But I’m not able to get any response from /dev/cdc-wdm0. Added the following interface to etc/config/network:

config interface 'modem2'
        option proto 'ncm'
        option ifname '4gext'
        option device '/dev/cdc-wdm0'
        option apn 'fast.t-mobile.com'
        option mode 'preferlte'
        option pincode '0000'
        option delay '5'

Rebind protection disabled. comgt and uqmi -d /dev/cdc-wdm0 both return nothing.

I saw at the top of that walkthrough that there was mention of switching the modem to NCM mode, but it looks to be there already based on the entries in the syslog at boot and due to the fact that I can see /dev/cdc-wdm0. Not sure how I would issue an AT command to that effect if it weren’t already in the correct mode.

Has anybody had luck getting this device to work in full LTE mode? Thanks!

For your reference.

Thanks for sharing that thread (not sure why I didn’t find it when searching originally).

Unfortunately, I’m still not having any luck. This etc/config/network entry works great, but only at 3g:

config interface 'modem'
        option country 'country73'
        option sp 'isp3'
        option service 'umts'
        option dialnum '*99#'
        option apn 'epc.tmobile.com'
        option username 'none'
        option password 'none'
        option metric '40'
        option proto '3g'
        option ifname '3g-modem'
        option device '/dev/ttyUSB0'

But as soon as I change option proto from ‘3g’ to ‘ncm’ to try to achieve a 4g connection, nothing else seems to work. I’ve tried specifying option device ‘/dev/ttyUSB0’, ‘/dev/ttyUSB1’, ‘/dev/ttyUSB2’, and ‘/dev/cdc-wdm0’. None makes a connection. Same true when I try to use option proto ‘qmi’. Nothing connecting.

Huawei is using ncm. So qmi or 3g is not working.

As we cannot detect if this is using ncm now, you have to set up manually or in luci.

That’s what I figured, too, but when I switch to proto ncm, I can’t get any device (ttyUSB* or cdc-wdm0) to connect. Also noticed that luci-proto-ncm is no longer fetched in opkg update, so I’ve just been changing manually via ssh.

Resurfacing this thread in hopes that some new information might help find a solution.

So, I was able to get the Huawei MS2732h-517 working with ‘clean’ firmware on an MT300N. Here was the procedure:

  1. Flash with GL.iNet download center

  2. opkg update & install wget usbutils kmod-usb2 kmod-usb-ohci kmod-usb-uhci kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch luci-proto-3g kmod-usb-core chat ppp libusb comgt comgt-ncm kmod-usb-net-huawei-cdc-ncm socat minicom

  3. Reboot

  4. Check USB modem is recognized:
    root@OpenWrt:~# lsusb
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 003: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  5. Check correct driver assigned:
    root@OpenWrt:~# lsusb -t
    /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
    /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
    |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 1: Dev 3, If 1, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 1: Dev 3, If 2, Class=Vendor Specific Class, Driver=option, 480M
    |__ Port 1: Dev 3, If 3, Class=Vendor Specific Class, Driver=huawei_cdc_ncm, 480M

  6. Add wwan0 interface to WAN firewall zone.

  7. Specify DNS servers to use for wwan0 interface (peerdns set to 0)

  8. Issue AT commands to set APN and establish an LTE connection:
    root@OpenWrt:~# socat - /dev/ttyUSB2,crnl
    AT+CGDCONT=1,“IP”,“fast.t-mobile.com
    OK
    AT^NDISDUP=1,1,
    OK
    ^NDISSTAT:1,“IPV4”

  9. Acquire DHCP lease on wwan0
    root@OpenWrt:~# udhcpc --interface=wwan0 -q
    udhcpc (v1.24.1) started
    Sending discover…
    Sending select for 22.83.137.140…
    Lease of 22.83.137.140 obtained, lease time 518400
    udhcpc: ifconfig wwan0 22.83.137.140 netmask 255.255.255.248 broadcast +
    udhcpc: setting default routers: 22.83.137.137

After step 9, the router has an active internet connection with name resolution, as do its LAN clients. EDIT:
I can also follow these steps and get this connection to work on an MT300N-V1 with stock gl-inet firmware (GL.iNet download center). But when I try to do the same 9 steps on an MT300N-V2 with stock gl-inet firmware (GL.iNet download center)
, I get all the way through step 8, but when I try to acquire DHCP on wwan0 at step 9, it attempts 3 times and then hangs:

root@RVIT_client0:/# udhcpc --interface=wwan0 -q
udhcpc: started, v1.25.1
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover

My guess is there is some package installed on the gl-inet firmware that is preventing DHCP assignment on wwan0 (mwan3?). Any ideas on how I can get this device to pass its active connection to the router?

Had some time for a bit more testing today. I can confirm ncm mode is working on a MT300N, MT300N-V2, and an AR300M all using stock gl-inet firmware version 2.264.

Here is the syslog on the MT300N-V1 with firmware 2.264… modem is initialized (after what looks like one failed attempt first?), AT commands sent, and connection established automatically at boot:

Sun Dec 16 17:58:19 2018 daemon.notice netifd: modem (1521): Timeout running AT-command
Sun Dec 16 17:58:19 2018 daemon.notice netifd: modem (1521): Failed to connect
Sun Dec 16 17:58:19 2018 daemon.notice netifd: modem (1963): Stopping network
Sun Dec 16 17:58:21 2018 daemon.err insmod: module is already loaded - xt_multiport
Sun Dec 16 17:58:21 2018 daemon.err insmod: module is already loaded - xt_comment
Sun Dec 16 17:58:21 2018 daemon.err insmod: module is already loaded - xt_length
Sun Dec 16 17:58:22 2018 daemon.notice netifd: modem (1963): sending -> AT^NDISDUP=1,0
Sun Dec 16 17:58:22 2018 daemon.notice netifd: modem (1963): Command failed: Permission denied
Sun Dec 16 17:58:22 2018 daemon.notice netifd: Interface 'modem' is now down
Sun Dec 16 17:58:22 2018 daemon.notice netifd: Interface 'modem' is setting up now
Sun Dec 16 17:58:25 2018 daemon.notice netifd: modem (2110): sending -> AT
Sun Dec 16 17:58:26 2018 daemon.crit xl2tpd[2149]: setsockopt recvref[30]: Protocol not available
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Using l2tp kernel support.
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: xl2tpd version xl2tpd-1.3.6 started on GL-MT300N PID:2149
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Forked by Scott Balmos and David Stipp, (C) 2001
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Inherited by Jeff McAdams, (C) 2002
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Forked again by Xelerance (www.xelerance.com) (C) 2006
Sun Dec 16 17:58:26 2018 daemon.info xl2tpd[2149]: Listening on IP address 0.0.0.0, port 1701
Sun Dec 16 17:58:26 2018 user.emerg syslog: setting up led wifi
Sun Dec 16 17:58:27 2018 daemon.notice netifd: modem (2110): sending -> ATZ
Sun Dec 16 17:58:28 2018 daemon.notice netifd: modem (2110): sending -> ATQ0
Sun Dec 16 17:58:30 2018 daemon.notice netifd: modem (2110): sending -> ATV1
Sun Dec 16 17:58:30 2018 user.emerg syslog: 
Sun Dec 16 17:58:30 2018 daemon.info procd: - init complete -
Sun Dec 16 17:58:31 2018 daemon.notice netifd: modem (2110): sending -> ATE1
Sun Dec 16 17:58:32 2018 daemon.notice netifd: modem (2110): sending -> ATS0=0
Sun Dec 16 17:58:32 2018 daemon.notice netifd: modem (2110): sending -> AT^NDISDUP=1,1,"fast.t-mobile.com"
Sun Dec 16 17:58:33 2018 daemon.notice netifd: modem (2110): Connected, starting DHCP
Sun Dec 16 17:58:33 2018 kern.err kernel: [   85.240000] huawei_cdc_ncm 1-1:1.3 wwan0: kevent 12 may have been dropped
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem' is now up
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem_4' is enabled
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Network device 'wwan0' link is up
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Network alias 'wwan0' link is up
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem_4' has link connectivity 
Sun Dec 16 17:58:33 2018 daemon.notice netifd: Interface 'modem_4' is setting up now
Sun Dec 16 17:58:33 2018 daemon.notice netifd: modem (2110): Command failed: Unknown error
Sun Dec 16 17:58:34 2018 daemon.notice netifd: Interface 'modem_6' is enabled
Sun Dec 16 17:58:34 2018 daemon.notice netifd: Interface 'modem_6' has link connectivity 
Sun Dec 16 17:58:34 2018 daemon.notice netifd: Interface 'modem_6' is setting up now
Sun Dec 16 17:58:34 2018 daemon.notice netifd: modem (2110): Command failed: Unknown error
Sun Dec 16 17:58:34 2018 daemon.notice netifd: modem_4 (2380): udhcpc (v1.24.1) started
Sun Dec 16 17:58:34 2018 daemon.notice netifd: modem_4 (2380): Sending discover...
Sun Dec 16 17:58:37 2018 daemon.notice netifd: modem_4 (2380): Sending discover...
Sun Dec 16 17:58:37 2018 daemon.notice netifd: modem_4 (2380): Sending select for 25.73.119.28...
Sun Dec 16 17:58:37 2018 daemon.notice netifd: modem_4 (2380): Lease of 25.73.119.28 obtained, lease time 518400
Sun Dec 16 17:58:37 2018 daemon.notice netifd: Interface 'modem_4' is now up
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: reading /tmp/resolv.conf.auto
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: using local addresses only for domain lan
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: using nameserver 10.177.0.34#53
Sun Dec 16 17:58:37 2018 daemon.info dnsmasq[1732]: using nameserver 10.177.0.210#53
Sun Dec 16 17:58:38 2018 user.notice mwan3: ifup interface modem (wwan0)
Sun Dec 16 17:58:40 2018 user.notice firewall: Reloading firewall due to ifup of modem (wwan0)

However, if I upgrade to firmware version 2.27x, I can no longer get the modem to connect via NCM. Here is the syslog from firmware ver 2.27 on an AR300M. It looks sort of like the AT commands are sent to modem before wwan0 is initialized, and they are not retried after wwan0 is up, so no successful connection is made, and no dhcp assignment is handed to wwan0 from the modem. How can I fix this so I can use NCM with up-to-date firmware on these devices?

Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'modem' is setting up now
Sun Dec 16 18:40:54 2018 kern.info kernel: [   40.900891] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Sun Dec 16 18:40:54 2018 daemon.err insmod: module is already loaded - xt_connmark
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'wan' is enabled
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'wan6' is enabled
Sun Dec 16 18:40:54 2018 daemon.info odhcpd[1312]: Raising SIGUSR1 due to address change on br-lan
Sun Dec 16 18:40:54 2018 daemon.notice netifd: bridge 'br-lan' link is up
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'lan' has link connectivity 
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Network device 'lo' link is up
Sun Dec 16 18:40:54 2018 daemon.notice netifd: Interface 'loopback' has link connectivity 
Sun Dec 16 18:40:54 2018 daemon.err insmod: module is already loaded - xt_comment
Sun Dec 16 18:40:54 2018 daemon.err insmod: module is already loaded - xt_length
Sun Dec 16 18:40:55 2018 kern.info kernel: [   41.869107] br-lan: port 1(eth1) entered disabled state
Sun Dec 16 18:40:55 2018 daemon.notice netifd: bridge 'br-lan' link is down
Sun Dec 16 18:40:55 2018 daemon.notice netifd: Interface 'lan' has link connectivity loss
Sun Dec 16 18:40:55 2018 daemon.info odhcpd[1312]: Using a RA lifetime of 0 seconds on br-lan
Sun Dec 16 18:40:55 2018 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)
Sun Dec 16 18:40:57 2018 daemon.notice netifd: modem (1794): sending -> AT
Sun Dec 16 18:40:58 2018 daemon.err hostapd: Configuration file: /var/run/hostapd-phy0.conf
Sun Dec 16 18:40:58 2018 kern.info kernel: [   44.760508] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Sun Dec 16 18:40:58 2018 kern.info kernel: [   44.853335] device wlan0 entered promiscuous mode
Sun Dec 16 18:40:58 2018 daemon.err hostapd: Using interface wlan0 with hwaddr e4:95:6e:44:3a:90 and ssid "GL-AR300M-a90"
Sun Dec 16 18:40:58 2018 daemon.notice netifd: modem (1794): sending -> ATZ
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_multiport
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_connmark
Sun Dec 16 18:40:59 2018 daemon.notice netifd: modem (1794): sending -> ATQ0
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: started, version 2.78 cachesize 150
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: DNS service limited to local subnets
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC no-ID loop-detect inotify
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq-dhcp[2220]: DHCP, IP range 192.168.8.100 -- 192.168.8.249, lease time 12h
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: using local addresses only for domain lan
Sun Dec 16 18:40:59 2018 daemon.warn dnsmasq[2220]: no servers found in /tmp/resolv.conf.auto, will retry
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: read /etc/hosts - 1 addresses
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: read /tmp/hosts/odhcpd - 0 addresses
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq[2220]: read /tmp/hosts/dhcp.cfg02411c - 3 addresses
Sun Dec 16 18:40:59 2018 daemon.info dnsmasq-dhcp[2220]: read /etc/ethers - 0 addresses
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_comment
Sun Dec 16 18:40:59 2018 daemon.err insmod: module is already loaded - xt_length
Sun Dec 16 18:40:59 2018 kern.info kernel: [   46.417441] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Sun Dec 16 18:40:59 2018 kern.info kernel: [   46.424244] br-lan: port 2(wlan0) entered forwarding state
Sun Dec 16 18:40:59 2018 kern.info kernel: [   46.430027] br-lan: port 2(wlan0) entered forwarding state
Sun Dec 16 18:40:59 2018 daemon.notice netifd: bridge 'br-lan' link is up
Sun Dec 16 18:40:59 2018 daemon.notice netifd: Interface 'lan' has link connectivity 
Sun Dec 16 18:40:59 2018 daemon.notice hostapd: wlan0: interface state UNINITIALIZED->ENABLED
Sun Dec 16 18:40:59 2018 daemon.notice hostapd: wlan0: AP-ENABLED 
Sun Dec 16 18:40:59 2018 daemon.notice netifd: modem (1794): sending -> ATV1
Sun Dec 16 18:41:00 2018 daemon.notice netifd: Network device 'wlan0' link is up
Sun Dec 16 18:41:00 2018 daemon.notice netifd: modem (1794): sending -> ATE1
Sun Dec 16 18:41:01 2018 daemon.notice netifd: modem (1794): sending -> ATS0=0
Sun Dec 16 18:41:01 2018 kern.info kernel: [   48.426695] br-lan: port 2(wlan0) entered forwarding state
Sun Dec 16 18:41:02 2018 daemon.notice netifd: modem (1794): sending -> AT+CGDCONT=1,"IP","fast.t-mobile.com"
Sun Dec 16 18:41:02 2018 daemon.notice procd: /etc/rc.d/S96led: setting up led WLAN
Sun Dec 16 18:41:03 2018 daemon.notice netifd: modem (1794): Starting network modem
Sun Dec 16 18:41:03 2018 daemon.notice procd: /etc/rc.d/S99ss-server: 
Sun Dec 16 18:41:03 2018 daemon.info procd: - init complete -
Sun Dec 16 18:41:03 2018 daemon.notice netifd: modem (1794): sending -> AT^NDISDUP=1,1,"fast.t-mobile.com"
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem (1794): Setting up wwan0
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem' is now up
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Network device 'wwan0' link is up
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Network alias 'wwan0' link is up
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem_4' is enabled
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem_4' has link connectivity 
Sun Dec 16 18:41:04 2018 daemon.notice netifd: Interface 'modem_4' is setting up now
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem (1794): Command failed: Unknown error
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem_4 (2484): udhcpc: started, v1.25.1
Sun Dec 16 18:41:04 2018 daemon.notice netifd: modem_4 (2484): udhcpc: sending discover
Sun Dec 16 18:41:05 2018 daemon.info odhcpd[1312]: Using a RA lifetime of 0 seconds on br-lan
Sun Dec 16 18:41:07 2018 daemon.notice netifd: modem_4 (2484): udhcpc: sending discover
Sun Dec 16 18:41:08 2018 kern.notice kernel: [   55.310638] random: nonblocking pool is initialized
Sun Dec 16 18:41:10 2018 daemon.notice netifd: modem_4 (2484): udhcpc: sending discover
Sun Dec 16 18:41:15 2018 user.warn mwan3: Could not find gateway for interface modem (wwan0)
Sun Dec 16 18:41:15 2018 user.notice firewall: Reloading firewall due to ifup of modem (wwan0)

Thanks for the detailed feedback.

We will investigate.