How to get Huawei E3372 working with pfSense?



  • Hmm… tried to get information here and there but it seems not so easy... or nicely documented...

    Anyway it seems that storage mode is affecting... Here is situation at the moment.

    usb_alloc_device: Found possible auto-install disk (trying next config)
    ugen4.2: <huaweimobile> at usbus4
    umass0: <mass storage=""> on usbus4
    umass0:  SCSI over Bulk-Only; quirks = 0x0000
    umass0:0:0:-1: Attached to scbus0
    (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
    (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
    (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
    (probe0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:29,0 (Power on, reset, or bus device reset occurred)
    (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
    (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
    (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
    (probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
    da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
    da0: <huawei tf="" card="" storage="" 2.31=""> Removable Direct Access SCSI-2 device
    da0: 40.000MB/s transfers
    da0: Attempt to query device size failed: NOT READY, Medium not present</huawei></mass></huaweimobile>
    
    usbconfig -d ugen4.2 dump_device_desc show_ifdrv
    ugen4.2: <huaweimobile huaweimobile="">at usbus4, cfg=1 md=HOST spd=HIGH (480Mbps) pwr=ON
    ugen4.2.2: umass0: <mass storage="">bLength = 0x0012
      bDescriptorType = 0x0001
      bcdUSB = 0x0210
      bDeviceClass = 0x0000
      bDeviceSubClass = 0x0000
      bDeviceProtocol = 0x00ff
      bMaxPacketSize0 = 0x0040
      idVendor = 0x12d1
      idProduct = 0x157d
      bcdDevice = 0x0102
      iManufacturer = 0x0001  <huawei_mobile>iProduct = 0x0002  <huawei_mobile>iSerialNumber = 0x0003  <0123456789ABCDEF>
      bNumConfigurations = 0x0002
    
    usbconfig show_ifdrv
    ugen0.1: <uhci root="" hub="" intel="">at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
    ugen0.1.0: uhub0: <intel 1="" 9="" uhci="" root="" hub,="" class="" 0,="" rev="" 1.00="" 1.00,="" addr="">ugen1.1: <uhci root="" hub="" intel="">at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
    ugen1.1.0: uhub1: <intel 1="" 9="" uhci="" root="" hub,="" class="" 0,="" rev="" 1.00="" 1.00,="" addr="">ugen2.1: <uhci root="" hub="" intel="">at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
    ugen2.1.0: uhub2: <intel 1="" 9="" uhci="" root="" hub,="" class="" 0,="" rev="" 1.00="" 1.00,="" addr="">ugen3.1: <uhci root="" hub="" intel="">at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
    ugen3.1.0: uhub3: <intel 1="" 9="" uhci="" root="" hub,="" class="" 0,="" rev="" 1.00="" 1.00,="" addr="">ugen4.1: <ehci root="" hub="" intel="">at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
    ugen4.1.0: uhub4: <intel 1="" 9="" ehci="" root="" hub,="" class="" 0,="" rev="" 2.00="" 1.00,="" addr="">ugen0.2: <back-ups 650="" cs="" fw817.v9.i="" usb="" fwv9="" american="" power="" conversion="">at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
    ugen2.2: <bluetooth usb="" host="" controller="" atheros="" communications="">at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
    ugen4.2: <huaweimobile huaweimobile="">at usbus4, cfg=1 md=HOST spd=HIGH (480Mbps) pwr=ON
    ugen4.2.2: umass0: <mass storage=""></mass></huaweimobile></bluetooth></back-ups></intel></ehci></intel></uhci></intel></uhci></intel></uhci></intel></uhci></huawei_mobile></huawei_mobile></mass></huaweimobile> 
    
    usb_modeswitch -b2 -W -v 12d1 -p 14dc -n -message-content
    Taking all parameters from the command line
    
     * usb_modeswitch: handle USB devices with multiple modes
     * Version 1.2.1 (C) Josua Dietze 2011
     * Based on libusb0 (0.1.12 and above)
    
     ! PLEASE REPORT NEW CONFIGURATIONS !
    
    DefaultVendor=  0x12d1
    DefaultProduct= 0x14dc
    TargetVendor=   not set
    TargetProduct=  not set
    TargetClass=    not set
    TargetProductList=""
    
    DetachStorageOnly=0
    HuaweiMode=0
    SierraMode=0
    SonyMode=0
    QisdaMode=0
    GCTMode=0
    KobilMode=0
    SequansMode=0
    MobileActionMode=0
    CiscoMode=0
    MessageEndpoint=0x0e
    MessageContent=""
    NeedResponse=1
    ResponseEndpoint= not set
    
    InquireDevice enabled (default)
    Success check disabled
    System integration mode disabled
    
    Looking for default devices ...
      searching devices, found USB ID 12d1:157d
       found matching vendor ID
      searching devices, found USB ID 13d3:3362
      searching devices, found USB ID 051d:0002
      searching devices, found USB ID 0000:0000
      searching devices, found USB ID 0000:0000
      searching devices, found USB ID 0000:0000
      searching devices, found USB ID 0000:0000
      searching devices, found USB ID 0000:0000
     No devices in default mode found. Nothing to do. Bye.
    
    

    Also if I get this working… Is there anywhere steo by step instructions how I get this my primary wan-connection because I am disconnecting my adsl agreement?


  • Netgate Administrator

    The default product ID you asked mode-switch to look for doesn't match that of your modem in virtual CD mode.
    Try finding the correct switching string on the mode-switch forum. However I've only seen one person use usbmode-switch successfully long term. Even if you switch the device to modem mode you have to hope u3g will attach to it to generate the required virtual serial ports for pfSense to talk to. It's much easier to just get a modem that's already supported.

    Steve



  • Hi!

    Thx for your reply… What 4G modem you suggest (or anybody else). This could be solved by buying Dovado Pro where I attach usb-stick but this seems stupid. Have to check is there available (in Finland) those usb-dongles which are supported.


  • Netgate Administrator

    I suggest using one of the modems from the known working page:
    https://doc.pfsense.org/index.php/Known_Working_3G-4G_Modems
    I don't have any personal experience with any particular modem to recommend though.

    Steve



  • I just got this working. FreeBSD (aka pfSense) doesnt know how to modeswap this modem, also if the modem is "hilink" by default (aka it's NATing you) then it sucks a bit as well. Also i dont think freebsd supports the NDIS network card stuff yet?

    So long story short, you can reflash it with a "stick" firmware, and use it via ppp via pseudo serial (20Mbit/s max speed) or with its NCM network interface for 20Mbps+

    What worked for me was a combination of steps from these two pages

    http://www.0xf8.org/2017/01/flashing-a-huawei-e3372h-4g-lte-stick-from-hilink-to-stick-mode/

    http://www.0xf8.org/2017/01/flashing-a-huawei-e3372h-4g-lte-stick-from-hilink-to-stick-mode/

    Basically, unless you have an older firmware on your modem, youll need to open up the modem, force it in to firmware recovery mode, then feed it a bootloader, then feed it a 21.x series (aka stick versions) firmware.

    You can also reconfigure the modem to start up straight in modem mode, rather than presenting the 'cdrom' and requiring a modeswitch. FreeBSD doesnt currently know how to modeswitch the device, but the kernel will happily recognize the usb serial's if they come up first.

    TBH most of the time, all that is needed is for FreeBSD to import the usb id's from usbmodeswitches database. Im not certain why someone hasnt simply done this? Still, if you have a linux or windows machine its trivial to reconfigure the modem to start straight in modem mode (see above).

    Note: there are lots and lots of forums (in german and russian) covering these devices and how to change out their firmware. I wasnt able to get it to work on windows, as windows couldnt work out the right usbserial drivers when the modem was in recovery mode - however, in linux it worked perfectly and the linux steps are easier anyway


  • Netgate Administrator

    Nice work.  :)

    FreeBSD does have an rndis driver now. It's not included in pfSense by default (yet) but you can load the module to test it if required.

    Steve



  • any annoying side note not specific to just the e3372, is that if the usb modem is unplugged then reconnected or rebooted (via AT commands) it comes up as ttyU1 then ttyU2 etc then pfsense config cant reconnect

    ttyU0.{0,1,2} all disappear but ttyU0.3 remains. i think this is why the kernel gives it the next ttyU spot

    fstat shows nothing is using ttyU0.3, but a reboot of pfsense is required to get the usb modem back to ttyU0

    the result of the above is that pfsense is configured for ttyU0 it cannot reconnect and must be reconfigured (which breaks again on reboot) or rebooted.


  • Netgate Administrator

    Hmm, very annoying!

    You could try the rndis mode if you import the freebsd kernel module. It might not be recognised though. However that too has an issue with rebooting if it's interface has been assigned but it's no longer present.

    Steve



  • Hi,

    I would try the rndis with E3372 and pfSense, but did not find any information to install the rndis (or urndis) kernel module.

    https://redmine.pfsense.org/issues/6293
    https://redmine.pfsense.org/issues/6574
    https://forum.pfsense.org/index.php?topic=70858.15
    https://forum.pfsense.org/index.php?topic=106078.msg596600

    Can you please point me to some information about doing that?

    Best regards,

    Gabor

    p.s. My only success with pfSense and this stick was when I installed pfSense under VirtualBox on a Windows 10 host. I think it worked because VirtualBox only provided USB 1.0 hardware which caused the E3372 to switch back to stick mode. So switching back is possible via software but how to do it is not know, is it? (This VirtualBox setup was useless though because of very poor speed. Not even a single web page was accessible.)



  • If you have any luck, then please post your findings here.


  • Netgate Administrator

    @koverg70:

    I would try the rndis with E3372 and pfSense, but did not find any information to install the rndis (or urndis) kernel module.
    Can you please point me to some information about doing that?

    Download the equivalent FreeBSD ISO for the pfSense version you're running. FreeBSD 10.3 for pfSense 2.3.4. Probably 64bit.

    Extract the if_urndis.ko module from the ISO. Copy it to /boot/modules in pfSense and make the file executable.

    Add the following line to /boot/loader.conf.local to load it at boot, create that file if you don't have one yet:

    if_urndis_load="yes"
    

    Steve



  • i found that this is due to /usr/local/bin/3gstats.php holding open the cuaU0.3 device which stops it from clearing and being available when the usb is plugged in again. ssh'ing into pfsense, killing it, then replugging the device then works perfectly.

    it seems that /usr/local/bin/3gstats.php should be listening for HANGUP and then exiting when received, observe how the  'cu' command exits gracefully if youre connected to the cuauU0.X and you pull out the USB.

    this should be raised as a bug. where is the best place to raise it?

    @djzort:

    any annoying side note not specific to just the e3372, is that if the usb modem is unplugged then reconnected or rebooted (via AT commands) it comes up as ttyU1 then ttyU2 etc then pfsense config cant reconnect

    ttyU0.{0,1,2} all disappear but ttyU0.3 remains. i think this is why the kernel gives it the next ttyU spot

    fstat shows nothing is using ttyU0.3, but a reboot of pfsense is required to get the usb modem back to ttyU0

    the result of the above is that pfsense is configured for ttyU0 it cannot reconnect and must be reconfigured (which breaks again on reboot) or rebooted.


  • Netgate Administrator

    Mmm, good catch.

    Open it as a new bug on our redmine as with all bugs: https://redmine.pfsense.org/

    Thanks,
    Steve





  • @stephenw10:

    Download the equivalent FreeBSD ISO for the pfSense version you're running. FreeBSD 10.3 for pfSense 2.3.4. Probably 64bit.

    Extract the if_urndis.ko module from the ISO. Copy it to /boot/modules in pfSense and make the file executable.

    Add the following line to /boot/loader.conf.local to load it at boot, create that file if you don't have one yet:

    if_urndis_load="yes"
    

    Steve

    I've been away from this forum for a few months and just came across your post following a Google search.
    I have FreeBSD 11.0-RELEASE installed and looked for this module but couldn't find it…
    My immediate aim is to turn a laptop into a WWAN-WLAN router using this Huawei E3372 modem which I have only ever managed to get working under Windows.



  • using the modem in serial mode is probably your best bet for now.



  • @djzort:

    using the modem in serial mode is probably your best bet for now.

    I can figure out how…

    I know I'm supposed to use usb_modeswitch but I haven't found the correct options to use, there are quite a few available.



  • you can set the E3772 so that it starts up in tty mode and usbmodeswitch isnt needed. infact all huawei modems have this features.

    check out the post above where i step through how to flash the firmware and put into serial only mode: https://forum.pfsense.org/index.php?topic=88356.msg711074#msg711074



  • @djzort:

    you can set the E3772 so that it starts up in tty mode and usbmodeswitch isnt needed. infact all huawei modems have this features.

    check out the post above where i step through how to flash the firmware and put into serial only mode: https://forum.pfsense.org/index.php?topic=88356.msg711074#msg711074

    I read through but couldn't make much sense of it…

    Notice anything here: ?

    What worked for me was a combination of steps from these two pages

    http://www.0xf8.org/2017/01/flashing-a-huawei-e3372h-4g-lte-stick-from-hilink-to-stick-mode/

    http://www.0xf8.org/2017/01/flashing-a-huawei-e3372h-4g-lte-stick-from-hilink-to-stick-mode/

    I still haven't found out how to tell if I have “Hilink” firmware or “Stick” firmware…



  • despite double posting the same link, it explains how to determine your firmware.

    i think the second link was supposed to be http://blog.asiantuntijakaveri.fi/2015/07/convert-huawei-e3372h-153-from.html

    anyway, there are plenty of guides around to flash the firmware, just google for them.

    there are also forums that can help.

    but if youre uncomfortable opening up the modem and shorting pins, its probably something you should ask someone else to do for you



  • if youre interested, i can cook one up and ship it to you. or you can send me yours and i can do it.



  • Is there no way to get this working in hilink mode?



  • its just a matter of the kernel supporting it, and you being ok with the usb modem NAT'ing in front of you.

    what would be ideal is NCM mode working properly



  • @djzort:

    its just a matter of the kernel supporting it, and you being ok with the usb modem NAT'ing in front of you.

    what would be ideal is NCM mode working properly

    yeah, I agree that would be the best solution, but will the hilink mode be working if i load the if_urndis module, or do I need an other module? The NATing is fine in the setup that i'm doing this time.



  • I have no idea. I need the IP address for what im doing.



  • Just wondered if anyone has managed to get the Huawei E3372 working in RNDIS mode yet…