OPNsense Forum

English Forums => Hardware and Performance => Topic started by: klontje on March 24, 2020, 05:40:49 pm

Title: Opnsense NDIS support
Post by: klontje on March 24, 2020, 05:40:49 pm
Hello,

I've spent configuring my new Opnsense router at home and want to add 4G capabilities to it. I have a Huawei E3372h flashed to stick mode and have it working with PPP. PPP mode however does not attain the maximum 4G speed, and NDIS mode is recommended for this. In PFSense (don't want to swear) or other FreeBSD distributions the stick is recognized with the two ports (NDIS and PPP) and after that the NDIS network card is recognized:
Code: [Select]
Mar 24 16:32:01 pfSense kernel: ugen0.3: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0
Mar 24 16:32:01 pfSense kernel: u3g0 on uhub0
Mar 24 16:32:01 pfSense kernel: u3g0: <HUAWEIMOBILE HUAWEIMOBILE, class 0/0, rev 2.10/1.02, addr 2> on usbus0
Mar 24 16:32:01 pfSense kernel: u3g0: Found 2 ports.
Mar 24 16:32:01 pfSense kernel: cdce0 on uhub0
Mar 24 16:32:01 pfSense kernel: cdce0: <NCM Network Control Model> on usbus0
Mar 24 16:32:01 pfSense kernel: cdce0: faking MAC address
Mar 24 16:32:01 pfSense kernel: ue0: <USB Ethernet> on cdce0
Mar 24 16:32:01 pfSense kernel: ue0: Ethernet address: 2a:d0:7c:ff:7f:00

You can after that initialize it with a single AT string to set the APN:
Code: [Select]
echo 'AT ^ NDISDUP = 1,1, "live.vodafone.com"' > /dev/cuaU0.1
On Opnsense it seems there are no drivers available for the NDIS modem as the initialization looks like this (it detects the two ports, but no NDIS network card loaded):
Code: [Select]
Mar 24 16:56:12 OPNsense kernel: ugen0.3: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0
Mar 24 16:56:12 OPNsense kernel: u3g0 on uhub0
Mar 24 16:56:12 OPNsense kernel: u3g0: <HUAWEIMOBILE HUAWEIMOBILE, class 0/0, rev 2.10/1.02, addr 2> on usbus0
Mar 24 16:56:12 OPNsense kernel: u3g0: Found 2 ports.

Would it be possible to include NDIS drivers in Opnsense as well and allow to set an init string for it in the GUI (even without this last part would be amazing as I can set it using a script or something)?
Title: Re: Opnsense NDIS support
Post by: mousaka20 on April 11, 2020, 06:14:22 pm
Hello,

This is my first post to the forum. So please bear with me if formatting is wrong.

NDIS seems to be present in in OPNsense  :)

Using OPNsense in VirtualBox and a Huawei E3372h-153 (in Hilink mode) the network interface ue0 is created and I could assign a interface to it.

Kernel log (sorry bottom up)
Code: [Select]
kernel: da0: quirks=0x2<NO_6_BYTE>
kernel: da0: Attempt to query device size failed: NOT READY, Medium not present
kernel: da0: 40.000MB/s transfers
kernel: da0: <HUAWEI TF CARD Storage 2.31> Removable Direct Access SCSI-2 device
kernel: da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
root: Unknown USB device: vendor 0x12d1 product 0x14dc bus uhub1
kernel: umass0:2:0: Attached to scbus2
kernel: umass0: SCSI over Bulk-Only; quirks = 0x0000
kernel: umass0: <Mass Storage> on usbus1
kernel: umass0 on uhub1
kernel: ue0: Ethernet address: 0c:5b:8f:27:9a:64
kernel: ue0: <USB Ethernet> on urndis0
kernel: urndis0: <RNDIS Communications Control> on usbus1
kernel: urndis0 on uhub1
kernel: ugen1.2: <HUAWEIMOBILE HUAWEIMOBILE> at usbus1
System information
Code: [Select]
CPU Type: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (2 cores)
Versions: OPNsense 20.1.4-amd64 / FreeBSD 11.2-RELEASE-p18-HBSD / LibreSSL 3.0.2


Using OPNsense on a PC Engines APU2 and the same E3372h-153 dongle the network interface is not recognised:

Kernel log (sorry bottom up)
Code: [Select]
kernel: umass0:2:0: Attached to scbus2
kernel: umass0: SCSI over Bulk-Only; quirks = 0x0000
kernel: umass0: <Mass Storage> on usbus0
kernel: umass0 on uhub1
kernel: ugen0.2: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0
System information
Code: [Select]
CPU Type: AMD GX-412TC SOC (4 cores)
Versions: OPNsense 20.1.2-amd64 / FreeBSD 11.2-RELEASE-p17-HBSD / LibreSSL 3.0.2


Any ideas for the different behaviour?

Thanks in advance for any hints.
mousaka20

PS: I copied the kernel logs from System --> Log Files --> General. How do I change the order, so that oldest messages appear on the top (as in /var/log/messages)?
Title: Re: Opnsense NDIS support
Post by: klontje on April 23, 2020, 11:39:25 am
Try to connect to the modem using command below. Make sure you replace x.x with the port the modem is listening on.
Code: [Select]
cu /dev/cuaUx.x
and get the mode using
Code: [Select]
AT^SETPORT?
There might be a different mode set in the device.
Title: Re: Opnsense NDIS support
Post by: mousaka20 on May 01, 2020, 10:23:24 am
Thanks klontie  :)

I managed to solve my issue that ue0 did not show up on the APU setup.
Solution: Set the E3372h to "Work Mode (CDC, not for Windows)"; so your hint using a different mode was key.

My current working setup in all little more details, hopefully useful for others. At least it took me quiet some time to figure it out:

So my E3372h-153 is running in HiLink-Mode, therefore the WebUI of the stick is available providing some additional information like LTE signal strength  :)