Installing usb_modeswitch on pfSense 2.4.3

Updated instructions for getting a Huawei modem to work under pfSense
June 14, 2018
pfsense freebsd

The only instructions I could find on how to switch a Huawei USB modem from mass storage to network referenced pfSense 2.3 and had links for FreeBSD 10. The latest version of pfSense (at the time of writing) is based on FreeBSD 11, so the install returned the following:

[2.4.3-RELEASE][root@pfSense.localdomain]/tmp: pkg add usb_modeswitch-2.2.5.txz
Installing usb_modeswitch-2.2.5...
pkg: wrong architecture: FreeBSD:10:amd64 instead of FreeBSD:11:amd64

Failed to install the following 1 package(s): usb_modeswitch-2.2.5.txz

This will not do.

I dug around in the packages for FreeBSD 11 and found http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/usb_modeswitch-2.5.2.txz, which installed without any issues. Since I’m rebuilding my Internet-connected firewall, I had to pull this down directly to my laptop with wget and then scp it over to the firewall, putting it in /tmp. Once there, I installed it with pkg add from an SSH session to the firewall.

The latest version of usb_modeswitch is intelligent enough to automatically switch the device when it’s connected (or on boot) if you add the parameters to `/usr/local/etc/usb_modeswitch.conf’.

For my Huawei E8372, the additional configuration looks like this:

DefaultVendor=0x12d1
DefaultProduct=0x1f01
TargetVendor=0x12d1
TargetProductList="14db,14dc"
HuaweiNewMode=1
MessageContent="55534243123456780000000000000011062000000101000100000000000000"
CheckSuccess=10

I added CheckSuccess with a reasonable timeout because manual testing showed that it never received a response. I don’t want the boot process to hang forever, waiting for a response that will never come.

The rest of that forum post is awful. Putting config files in /usr/local/sbin and adding additional, unneeded startup scripts into /etc/rc.d are all the hallmarks of someone thrashing about with no knowledge.

The only other takeaway from that post that is helpful is that you temporarily need to assign 2 NICs to pfSense in order for it to get past the interface assignment screen. If you initially add a WAN port without a DHCP server, you can also expect to have a long timeout while it waits for DHCP to fail.

Your total workflow looks like this: