How to enable broadband connection with Huawei E3372h on Ubuntu Server

19,156

After further testing I found I had kernel version 3.16 on my Ubuntu Server 14.04.4. With this kernel version, Huawei E3372H did not work properly in cdc_ncm mode. The solution is to upgrade the kernel to 4.2. Then connection to the internet can be done with these simple commands (assuming the modem created /dev/ttyUSB0, APN is "internet"):

This command will connect the stick to LTE netowrk (internet is an APN, so other providers can use different APN name):

echo -e "AT^NDISDUP=1,1,\"internet\"\r" > /dev/ttyUSB0

This command will acquire IP address for the wwan0 interface:

dhclient wwan0
Share:
19,156

Related videos on Youtube

user241281
Author by

user241281

Updated on September 18, 2022

Comments

  • user241281
    user241281 over 1 year

    Important note: after entering this "question" I did some testing and realized I am able to enable the broadband connection with newer version of Ubuntu Server - 15.10. The procedure is described below. Anyway, the reason why it does not work in 14.04.04LTS is not known to me (maybe the functionality is not covered in its kernel version)


    I have Huawei E3372H which I set to "modem" mode, so it does not do NAT and behaves as a modem. It works with Ubuntu 15.10 (desktop). Network manager shows possibility for creating a broadband connection and I just fill APN "internet" and that's it - after enabling this connection it works perfectly.

    But how to connect my Ubuntu Server 14.04 on to the internet using this USB stick when there is no NetworkManager installed?

    Here is some basic info about the stick:

    lsusb shows it as:

    Bus 002 Device 009: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
    

    This interface is being created once the stick is connected to my Ubuntu Desktop PC:

    wwx001e101f0000 Link encap:Ethernet  HWaddr 00:1e:10:1f:00:00  
              BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    

    I tried following this (https://johnlewis.ie/mobile-broadband-from-the-command-line-in-ubuntu/) procedure, but unfortunately I ended with no success:

    Apr  9 16:32:32 test_server pppd[20296]: pppd 2.4.5 started by jim, uid 0
    Apr  9 16:32:33 test_server chat[20298]: abort on (BUSY)
    Apr  9 16:32:33 test_server chat[20298]: abort on (VOICE)
    Apr  9 16:32:33 test_server chat[20298]: abort on (NO CARRIER)
    Apr  9 16:32:33 test_server chat[20298]: abort on (NO DIALTONE)
    Apr  9 16:32:33 test_server chat[20298]: abort on (NO DIAL TONE)
    Apr  9 16:32:33 test_server chat[20298]: send (ATZ^M)
    Apr  9 16:32:33 test_server chat[20298]: expect (OK)
    Apr  9 16:32:33 test_server chat[20298]: ^M
    Apr  9 16:32:33 test_server chat[20298]: OK
    Apr  9 16:32:33 test_server chat[20298]:  -- got it
    Apr  9 16:32:33 test_server chat[20298]: send (AT+CGDCONT=1,"IP","internet"^M)
    Apr  9 16:32:34 test_server chat[20298]: expect (OK)
    Apr  9 16:32:34 test_server chat[20298]: ^M
    Apr  9 16:32:34 test_server chat[20298]: ^M
    Apr  9 16:32:34 test_server chat[20298]: OK
    Apr  9 16:32:34 test_server chat[20298]:  -- got it
    Apr  9 16:32:34 test_server chat[20298]: send (ATDT*99#^M)
    Apr  9 16:32:34 test_server chat[20298]: expect (CONNECT)
    Apr  9 16:32:34 test_server chat[20298]: ^M
    Apr  9 16:32:34 test_server chat[20298]: ^M
    Apr  9 16:32:34 test_server chat[20298]: CONNECT
    Apr  9 16:32:34 test_server chat[20298]:  -- got it
    Apr  9 16:32:34 test_server chat[20298]: send (^M)
    Apr  9 16:32:34 test_server pppd[20296]: Script /usr/sbin/chat -v -f /etc/chatscripts/pap -T *99# finished (pid 20297), status = 0x0
    Apr  9 16:32:34 test_server pppd[20296]: Serial connection established.
    Apr  9 16:32:34 test_server pppd[20296]: using channel 10
    Apr  9 16:32:34 test_server pppd[20296]: Using interface ppp0
    Apr  9 16:32:34 test_server pppd[20296]: Connect: ppp0 <--> /dev/ttyUSB0
    Apr  9 16:32:35 test_server pppd[20296]: sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xce74b2a1> <pcomp> <accomp>]
    Apr  9 16:33:02 test_server pppd[20296]: message repeated 9 times: [ sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xce74b2a1> <pcomp> <accomp>]]
    Apr  9 16:33:05 test_server pppd[20296]: LCP: timeout sending Config-Requests
    Apr  9 16:33:05 test_server pppd[20296]: Connection terminated.
    Apr  9 16:33:06 test_server pppd[20296]: Modem hangup
    

    Edit: I found out working procedure, but unfortunately it works just on my desktop with Ubuntu 15.10:

    echo -e "AT^NDISDUP=1,1,\"internet\"\r" > /dev/ttyUSB0
    dhclient -v wwx001e101f0000
    

    --> Using the commands above will bring up working mobile broadband on wwx001e101f0000 ethernet interface.

    Unfortunately on my Ubuntu Server 14.04 via command dhclient -v wwan0 an ip address is not provided although the modem is connected to the LTE network (blue light on). It is very strange.

    Edit2: I found out the issue is most likely in Ubuntu 14.04 kernel version. I did a test - installed new "test" Ubuntu Server 14.04 just for this test - the behavior was exactly the same as on my "production" Ubuntu Server 14.04 - no IP acquired using dhclient wwan0.

    Then I installed new "test" Ubuntu Server 15.10 and in this installation it works perfectly. So I assume from some reason this ncm interface does not work properly. I noticed this difference between the 2 servers:

    Ubuntu 14.04 Dmesg:

    Apr  9 19:32:13 ubuntu kernel: [27410.720039] usb 1-4: new high-speed USB device number 18 using ehci-pci
    Apr  9 19:32:13 ubuntu kernel: [27410.861148] usb 1-4: New USB device found, idVendor=12d1, idProduct=1506
    Apr  9 19:32:13 ubuntu kernel: [27410.861154] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Apr  9 19:32:13 ubuntu kernel: [27410.861159] usb 1-4: Product: HUAWEI_MOBILE
    Apr  9 19:32:13 ubuntu kernel: [27410.861163] usb 1-4: Manufacturer: HUAWEI_MOBILE
    Apr  9 19:32:13 ubuntu kernel: [27410.898395] option 1-4:1.0: GSM modem (1-port) converter detected
    Apr  9 19:32:13 ubuntu kernel: [27410.898552] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
    Apr  9 19:32:13 ubuntu kernel: [27410.943023] huawei_cdc_ncm 1-4:1.1: MAC-Address: 00:1e:10:1f:00:00
    Apr  9 19:32:13 ubuntu kernel: [27410.943029] huawei_cdc_ncm 1-4:1.1: setting rx_max = 16384
    Apr  9 19:32:13 ubuntu kernel: [27410.968250] huawei_cdc_ncm 1-4:1.1: cdc-wdm0: USB WDM device
    Apr  9 19:32:13 ubuntu kernel: [27410.968657] huawei_cdc_ncm 1-4:1.1 wwan0: register 'huawei_cdc_ncm' at usb-0000:00:1a.7-4, Huawei CDC 
    NCM device, 00:1e:10:1f:00:00
    

    Ubuntu 15.10 Dmesg:

    Apr  9 22:29:20 ubuntu kernel: [   64.269728] usb 2-1.2: new high-speed USB device number 7 using ehci-pci
    Apr  9 22:29:20 ubuntu kernel: [   64.367373] usb 2-1.2: New USB device found, idVendor=12d1, idProduct=1506
    Apr  9 22:29:20 ubuntu kernel: [   64.367379] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    Apr  9 22:29:20 ubuntu kernel: [   64.367382] usb 2-1.2: Product: HUAWEI_MOBILE
    Apr  9 22:29:20 ubuntu kernel: [   64.367384] usb 2-1.2: Manufacturer: HUAWEI_MOBILE
    Apr  9 22:29:21 ubuntu kernel: [   64.459900] usbcore: registered new interface driver usbserial
    Apr  9 22:29:21 ubuntu kernel: [   64.459910] usbcore: registered new interface driver usbserial_generic
    Apr  9 22:29:21 ubuntu kernel: [   64.459918] usbserial: USB Serial support registered for generic
    Apr  9 22:29:21 ubuntu kernel: [   64.507601] usbcore: registered new interface driver option
    Apr  9 22:29:21 ubuntu kernel: [   64.507614] usbserial: USB Serial support registered for GSM modem (1-port)
    Apr  9 22:29:21 ubuntu kernel: [   64.507691] option 2-1.2:1.0: GSM modem (1-port) converter detected
    Apr  9 22:29:21 ubuntu kernel: [   64.507963] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB0
    Apr  9 22:29:21 ubuntu kernel: [   64.535895] usbcore: registered new interface driver cdc_ncm
    Apr  9 22:29:21 ubuntu kernel: [   64.542625] usbcore: registered new interface driver cdc_wdm
    Apr  9 22:29:21 ubuntu kernel: [   64.579935] huawei_cdc_ncm 2-1.2:1.1: MAC-Address: 00:1e:10:1f:00:00
    Apr  9 22:29:21 ubuntu kernel: [   64.579940] huawei_cdc_ncm 2-1.2:1.1: setting rx_max = 16384
    Apr  9 22:29:21 ubuntu kernel: [   64.587318] huawei_cdc_ncm 2-1.2:1.1: NDP will be placed at end of frame for this device.
    Apr  9 22:29:21 ubuntu kernel: [   64.587427] huawei_cdc_ncm 2-1.2:1.1: cdc-wdm1: USB WDM device
    Apr  9 22:29:21 ubuntu kernel: [   64.587579] huawei_cdc_ncm 2-1.2:1.1 wwan0: register 'huawei_cdc_ncm' at usb-0000:00:1d.0-1.2, Huawei CDC NC
    M device, 00:1e:10:1f:00:00
    

    So in Ubuntu 15.10 there are additional "usbcore" and "usbserial" entries logged and also eth interface wwan0 is being renamed to wwx001e101f0000. I will try to upgrade kernel of my Ubuntu 14.04 to the higher version and will check whether it will work there.

    Important note: When doing my tests I installed Ubuntu Server 14.04.2 iso image. This one had older 3.x kernel version. Now I downloaded 14.04.4 from Ubuntu website and after installation I can see it had kernel 4.2. Interesting is on my "production" server I have Ubuntu Server version 14.04.4, but the Kernel there is 3.16: Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.16.0-53-generic x86_64). I update the server on regular basis, but it looks from some reason linux-generci-lts-wily is included in the downloaded 14.04.4, but is not present in my 14.04.4 which had been several times updated.

    New installation of 14.04.4:

    $ sudo dpkg -l linux-generic-lts-*
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name                          Version             Architecture        Description
    +++-=============================-===================-===================-================================================================
    ii  linux-generic-lts-wily        4.2.0.27.21         amd64               Complete Generic Linux kernel and headers
    

    So apt-get install linux-generic-lts-wily solved the problem on my Ubuntu Server - it installed 4.2 kernel and with this one it works properly.

    • user241281
      user241281 about 8 years
      I also tried with wvdial, but the problem is the same: pppd[25159]: LCP: timeout sending Config-Requests
  • user66638
    user66638 almost 7 years
    thanks for the command, now I am able to connect, but If I unplug/reattach it stops working.
  • user241281
    user241281 almost 7 years
    sure it will stop working. you can't simply disconnect and then reconnect the usb modem and await it will automagically reconnect. Why would you need to unplug it? This solution was for home "router" which is in reality a headless server and the usb modem is permanently connected there. If you need it for desktop, then you have network manager there which will manage the connection for you without using the above commands.
  • Mi Ro
    Mi Ro over 6 years
    I just logged in to say that this solution is so simple and helped me to connect with my huawei e3372h in raspbian I was trying lot of things but it is actually this simple