Qmi, mbim, ncm, rndis protocols



  • I was reading about setting up a USB Broadban dongle here- https://wiki.openwrt.org/doc/recipes/3gdongle  and came across this info:

    
    Some high speed usb modems provide qmi, mbim, ncm, rndis protocol for connection instead of legacy ppp protocol. For more information:
    
    qmi and mbim, see How To Use LTE modem in QMI mode for WAN connection
    ncm, see How To Use LTE modem in NCM mode for WAN connection
    rndis, see How To Use LTE modem in RNDIS mode for WAN connection
    
    

    All this looks like gobbledigook to me :-[    …. Rather than  someone trying to explain these terms, can someone suggest which I should use on FreeBSD assuming it is available?



  • My understanding that RNDIS is the only option currently available [from the protocol list mentioned] as it was mentioned here.

    At the same time I was able to use Huawei E5372 which presents itself to the system as NCM (modem is a network card), however the overall behavior was more similar to RNDIS (modem is a NAT router). The whole story is here.

    NCM (NDIS) mode should be possible as well, but this will require a shell script to configure connection and bring it up, i.e. no GUI support.



  • @AndrewZ:

    My understanding that RNDIS is the only option currently available [from the protocol list mentioned] as it was mentioned here.

    At the same time I was able to use Huawei E5372 which presents itself to the system as NCM (modem is a network card), however the overall behavior was more similar to RNDIS (modem is a NAT router). The whole story is here.

    I couldn't figure out which file I was supposed to copy to /boot/modules, but I added the suggested line to a FreeBSD 11.1 amd64 installation and checked that if_urndis.ko was loaded using kldstat, so I guess my Hilink Huawei E3372 would use this interface if instructed to do so. This is where I believe I'm supposed to run usb_modeswitch to configure the modem.  The VID/PID is currently 012d1:01f01 and I do have this entry in /usr/local/share/usb_modeswitch/.

    My understanding is that running usb_modeswitch will reconfigure the modem, which the system currently recognises as a mass storage device, into a USB ethernet device, and assign an IP address, although I'm not sure what the inteface name would be. Do I undestand that correctly?



  • I'm not 100% sure about VID/PID and usb_modeswitch in this particular case. Just an idea - the source code of the driver should contain all the vid:pid supported.
    I'll try to re-flash one of my modems to HiLink and see how it looks like in a real life, but later.
    Ideally, the modem should be recognized by the OS as it is, a new interface like ue0 should be created and pfSense will obtain the IP address from the modem (192.168.8.X by default).
    Just found this - looks a like a success story?



  • @AndrewZ:

    I'm not 100% sure about VID/PID and usb_modeswitch in this particular case. Just an idea - the source code of the driver should contain all the vid:pid supported.

    Which driver are you referring to? Do you mean the device entry in /usr/local/share/usb_modeswitch/?

    I have two E3372's -
    one is Hilink 12d1:1f01 branded E3372h - 153
    the other is stick 12d1:14fe branded M150 -2 It is labelled MEGAFON 4G+

    both entries appear in /usr/local/share/usb_modeswitch/ but have different TargetProductLists (whatever that means)

    I'll try to re-flash one of my modems to HiLink and see how it looks like in a real life, but later.

    By flashing do you mean a process described here https://www.youtube.com/watch?v=0RsFQH-lAQg&feature=youtu.be? Or by software?

    Ideally, the modem should be recognized by the OS as it is, a new interface like ue0 should be created

    Without using usb_modeswitch the device is only recognised as a mass storage device.

    I notice that when running lsusb on Linux Debian the Vid/Pids shown are  12d1:14dc (Hilink) and 12d1:1506(Stick) so I guess some process must have  invoked usb_modeswitch  when the device was inserted. These changed Pids correspond to the TargetProductList in the modeswitch table.

    On Debian the ifconfig entries are:-

    Hilink:
    11: enx0c5b8f279a64: <no-carrier,broadcast,multicast,up>mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
        link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff

    Stick:-
    10: wwx001e101f0000: <broadcast,multicast>mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 00:1e:10:1f:00:00 brd ff:ff:ff:ff:ff:ff

    I have no idea what sort of connection protocols these are…

    and pfSense will obtain the IP address from the modem (192.168.8.X by default).

    I've seen this reference as way of providing a Web gui for configuring the modem, but have never been able to access it…

    Just found this - looks a like a success story?

    I looked at the post which I've read numerous times in the past and get confused by it mentioning the modem being a CDCE device and the need to set if_cdce_load="YES", so do I need this in addition to if_urndis_load="YES"…

    Getting my E3372 working under FreeBSD has been a long struggle because of so much conflicting advice, but I'm beginning to see how it is supposed to work.</broadcast,multicast></no-carrier,broadcast,multicast,up>



  • Driver - I meant  if_urndis.ko
    Flashing - in this context I mean loading 22.X HiLink firmware to a modem running 21.X Stick firmware.
    Web GUI will be available (on 192.168.8.1 by default) once ue0 is up and usual interface and NAT configuration steps are completed.
    In the example I found it seems that the author was successful with if_cdce.ko, not if_urndis.ko ;
    as I understood switching the modem [by usb_modeswitch] to 0x14dc makes it detectable by if_cdce.ko driver.

    Here is another working example: https://forum.pfsense.org/index.php?topic=111787.msg622688#msg622688
    E8372 does work indeed, I've tested it. However, mode switching works unstable and unpredictable for me.
    E3372 (HiLink) should work with the same settings, will be good to hear feedback on this.
    Here is the up-to-date link for usb_modeswitch:

    http://pkg.freebsd.org/freebsd:11:x86:64/release_1/All/usb_modeswitch-2.5.0.txz
    

    It seems that lte.cfg file is not really needed, it should be enough to use the following command line:

    /usr/local/sbin/usb_modeswitch -v 0x12d1 -p 0x1f01 -P 0x14db -J
    


  • @AndrewZ:

    Here is another working example: https://forum.pfsense.org/index.php?topic=111787.msg622688#msg622688
    E8372 does work indeed, I've tested it. However, mode switching works unstable and unpredictable for me.
    E3372 (HiLink) should work with the same settings, will be good to hear feedback on this.
    Here is the up-to-date link for usb_modeswitch:

    http://pkg.freebsd.org/freebsd:11:x86:64/release_1/All/usb_modeswitch-2.5.0.txz
    

    It seems that lte.cfg file is not really needed, it should be enough to use the following command line:

    /usr/local/sbin/usb_modeswitch -v 0x12d1 -p 0x1f01 -P 0x14db -J
    

    Many thanks for this!

    I needed something like this. I now see a ue0 interface, but there must be something to initiate a connection…..

    After a few minutes - had a brainwave and thought about running

    dhclient ue0
    

    and VOILA  192.168.3.1 appeared!!!!

    So it finally looks like I'm getting there.

    Need to figure out how to route via this interface now.



  • @Balanga:

    After a few minutes - had a brainwave and thought about running

    dhclient ue0
    

    Need to figure out how to route via this interface now.

    as I wrote

    once ue0 is up and usual interface and NAT configuration steps are completed

    Once the ue0 appeared in the system you can do the rest in the GUI, just navigate to Interfaces - Assignment, search for ue0 in Available network ports, click Add.
    Then go to the new interface you just added and configure DHCP. Then you can configure routing, NAT, etc the usual way.

    Please keep in mind the WARNING I've made earlier.



  • I'm doing my testing on FreeBSD 11.1-RELEASE amd64 so am not sure how easy it will be to configure pfSense to use the USB modem alongside my ADSL connection….

    Does pfSense support rndis? From my understanding rndis support is available in FreeBSD 11.1 and I'm not sure which version pfSense is based on.

    Also should I be installing pkgs such as usb_modeswitch manually on pfSense? And how would I get pfSense to run usb_modeswitch at boot time?



  • @Balanga:

    I'm doing my testing on FreeBSD 11.1-RELEASE amd64 so am not sure how easy it will be to configure pfSense to use the USB modem alongside my ADSL connection….

    That's a standard dual WAN configuration, no need to focus on the underlying technology.

    Does pfSense support rndis?

    Driver needs to be installed manually if required, that was mentioned in the very beginning.
    Currently I see no real reason to do this - as you already noticed your modem works with another [pre-installed in pfSense] driver.

    Also should I be installing pkgs such as usb_modeswitch manually on pfSense? And how would I get pfSense to run usb_modeswitch at boot time?

    Yes, 2 packages should be installed, one manually and another from the GUI, that was explained in the last example I referred to.



  • @AndrewZ:

    Also should I be installing pkgs such as usb_modeswitch manually on pfSense? And how would I get pfSense to run usb_modeswitch at boot time?

    Yes, 2 packages should be installed, one manually and another from the GUI, that was explained in the last example I referred to.

    I'm trying to figure out how to automatically run usb_modeswitch either on boot or on insertion of the USB stick… and not sure how to do it...

    It was suggested that I could use devd.conf but not sure how to set it up for a USB device or whether it would actually work...



  • Here is an example of devd.conf: https://forum.pfsense.org/index.php?topic=86064.msg727823#msg727823

    how to automatically run usb_modeswitch either on boot

    That was explained in the last example I referred to!
    look for "shellcmd" in the post I mentioned earlier: https://forum.pfsense.org/index.php?topic=111787.msg622688#msg622688