Huawei modem: Difference between revisions

From B-Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
model: e3131
model: e3131


Original post:
https://forum.netgate.com/topic/99859/pfsense-2-3-and-huawei-e8372-making-it-work
https://forum.netgate.com/topic/99859/pfsense-2-3-and-huawei-e8372-making-it-work


Adapted for E3131 below
For my home network I like using a small nano PC by Foxconn as my router. The down side is that the nano only has a single Ethernet port. My internet is an LTE connection and the carrier provides one of the new “smart” modems in my case the Huawei E8372. Because of the lack of a second Ethernet port and the risk of double NAT I want the LTE modem to be directly connected to the pfSense PC.
As the modem defaults to storage mode it was an interesting journey to get pfSense to make use of it. I am no expert in pfSense or FreeBSD and have trawled the forums and some websites for various bits I cobbled together into something that works for me. It may not be the best way so your mileage may vary. I just wanted my LTE modem to work with pfSense.
Some notes on the setup
pfSense does not like it when there are not two network adapters. You will be constantly stuck and the interfaces configuration prompt. I resolved this by using a USB Ethernet adapter for the curious Trendnet TU3-ETG.
I enable the Secure Shell and use Bitvise to SSH to the pfSense PC so I can easily copy and paste the contents of the configuration files.
What is needed:
usb_modeswitch (This needs to be installed from the FreeBSD repositories as it's not included in pfSense.)
Shellcmd (Available via the pfSense package manager)
Text editor (Nano is a nice editor you can install it from the shell with pkg install nano)
You will install two packages (Three if you want nano)
You will create two files; lte.cfg for the modem configuration & lte.sh which will be used by Shellcmd
Install usb_modechange
Beware this is not a supported configuration and this may break with updates but it is the only way I found to install usb_modeswitch
From the shell run the command below and install the package:
<syntaxhighlight lang="text">
http://pkg.freebsd.org/FreeBSD:11:amd64/release_3/All/usb_modeswitch-2.5.2.txz
</syntaxhighlight>
Install Shellcmd
From the web GUI go to System / Package Manager then select Available Packages find Shellcmd and install it.
Create lte.cfg file for usb_modeswitch configuration for E8372
Use your prefered text editor to create the modem configuration file in cd /usr/local/sbin I named the file lte.cfg
Modem configuration for the E8372 was found here http://www.draisberghof.de/usb_modeswitch
Modem configuration for the E3131 was found here http://forums.debian.net/viewtopic.php?f=7&t=112944
Modem Configuration copy the text below and paste it in the lte.cfg file.


<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
Line 15: Line 55:
MessageContent="55534243123456780000000000000011062000000101000100000000000000"
MessageContent="55534243123456780000000000000011062000000101000100000000000000"
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang="text">
###################################################
#Huawei E8372
#Contributed by: ozonejunkie
DefaultVendor= 0x12d1
DefaultProduct=0x1f01
TargetVendor=  0x12d1
TargetProduct= 0x14db
MessageContent="55534243123456780000000000000a11062000000000000100000000000000"
NoDriverLoading=1
####################################################
</syntaxhighlight>
Create lte.sh file for Script to modeswitch modem
The code to correctly switch your modem you can put a script file in /etc/rc.d.
I named mine lte.sh remember to chmod +x the lte.sh file
<syntaxhighlight lang="text">
#!/bin/sh
/usr/local/sbin/usb_modeswitch -c /usr/local/sbin/lte.cfg
sleep 5
</syntaxhighlight>
Any shell script can be placed in the /usr/local/etc/rc.d/ directory. The filename must end in .sh and it must be marked as executable (chmod +x lte.sh).
Configure Shellcmd
Via the web GUI go to the Services menu and select Shellcmd & click Add
Shellcmd Configuration
Command: /etc/rc.d/lte.sh
Shellcmd Type: earlyshellcmd
Description: LTE Start
Click Save
You should now be able to configure the interface via the interfaces menu.

Revision as of 15:38, 25 April 2020

model: e3131

Original post: https://forum.netgate.com/topic/99859/pfsense-2-3-and-huawei-e8372-making-it-work

Adapted for E3131 below

For my home network I like using a small nano PC by Foxconn as my router. The down side is that the nano only has a single Ethernet port. My internet is an LTE connection and the carrier provides one of the new “smart” modems in my case the Huawei E8372. Because of the lack of a second Ethernet port and the risk of double NAT I want the LTE modem to be directly connected to the pfSense PC. As the modem defaults to storage mode it was an interesting journey to get pfSense to make use of it. I am no expert in pfSense or FreeBSD and have trawled the forums and some websites for various bits I cobbled together into something that works for me. It may not be the best way so your mileage may vary. I just wanted my LTE modem to work with pfSense.

Some notes on the setup pfSense does not like it when there are not two network adapters. You will be constantly stuck and the interfaces configuration prompt. I resolved this by using a USB Ethernet adapter for the curious Trendnet TU3-ETG. I enable the Secure Shell and use Bitvise to SSH to the pfSense PC so I can easily copy and paste the contents of the configuration files.

What is needed: usb_modeswitch (This needs to be installed from the FreeBSD repositories as it's not included in pfSense.) Shellcmd (Available via the pfSense package manager) Text editor (Nano is a nice editor you can install it from the shell with pkg install nano)

You will install two packages (Three if you want nano) You will create two files; lte.cfg for the modem configuration & lte.sh which will be used by Shellcmd

Install usb_modechange

Beware this is not a supported configuration and this may break with updates but it is the only way I found to install usb_modeswitch

From the shell run the command below and install the package:

<syntaxhighlight lang="text"> http://pkg.freebsd.org/FreeBSD:11:amd64/release_3/All/usb_modeswitch-2.5.2.txz </syntaxhighlight>

Install Shellcmd

From the web GUI go to System / Package Manager then select Available Packages find Shellcmd and install it.

Create lte.cfg file for usb_modeswitch configuration for E8372

Use your prefered text editor to create the modem configuration file in cd /usr/local/sbin I named the file lte.cfg

Modem configuration for the E8372 was found here http://www.draisberghof.de/usb_modeswitch Modem configuration for the E3131 was found here http://forums.debian.net/viewtopic.php?f=7&t=112944

Modem Configuration copy the text below and paste it in the lte.cfg file.

<syntaxhighlight lang="text">

  1. Huawei E3131

DefaultVendor= 0x12d1 DefaultProduct= 0x14db

TargetVendor= 0x12d1 TargetProduct= 0x1f01

MessageContent="55534243123456780000000000000011062000000101000100000000000000" </syntaxhighlight>


<syntaxhighlight lang="text">

  1. Huawei E8372
  2. Contributed by: ozonejunkie

DefaultVendor= 0x12d1 DefaultProduct=0x1f01

TargetVendor= 0x12d1 TargetProduct= 0x14db

MessageContent="55534243123456780000000000000a11062000000000000100000000000000" NoDriverLoading=1

</syntaxhighlight>

Create lte.sh file for Script to modeswitch modem

The code to correctly switch your modem you can put a script file in /etc/rc.d. I named mine lte.sh remember to chmod +x the lte.sh file

<syntaxhighlight lang="text">

  1. !/bin/sh

/usr/local/sbin/usb_modeswitch -c /usr/local/sbin/lte.cfg sleep 5 </syntaxhighlight>

Any shell script can be placed in the /usr/local/etc/rc.d/ directory. The filename must end in .sh and it must be marked as executable (chmod +x lte.sh).

Configure Shellcmd

Via the web GUI go to the Services menu and select Shellcmd & click Add

Shellcmd Configuration

Command: /etc/rc.d/lte.sh Shellcmd Type: earlyshellcmd Description: LTE Start Click Save

You should now be able to configure the interface via the interfaces menu.