📜 ⬆️ ⬇️

How-To: Connect Pfsense with Huawei E392 Modem to Yota Provider

Introduction


This post was written because there is little information on the Internet and it is scattered, we had to collect in rows from various sources. I will try in this manual to bring it all together. It is assumed that you already have basic knowledge of the pfSence assembly and you can go to the console.
System version:
[2.0.3-RELEASE][admin@pfsense.office]/root(1): uname -a FreeBSD pfsense.office 8.1-RELEASE-p13 FreeBSD 8.1-RELEASE-p13 #0: Fri Apr 12 10:47:01 EDT 2013 root@snapshots-8_1-i386.builders.pfsense.org:/usr/obj.pfSense/usr/pfSensesrc/src/sys/pfSense_SMP.8 i386 


Why Huawey E392?

This modem was chosen due to the presence of stable reception in places where conventional modems do not catch. You can also connect an external antenna to it and move it to the external wall of a building.
The router was already available, it worked for a long time and successfully, and I didn’t want to change the additional equipment due to the change of provider. Buying a new router from Yota is undesirable, because all sorts of buns, such as blocking sites and channel shaping in it, are not available.

Transfer modem modem mode

By default, the modem is in usbdisk + CD-ROM mode for installing drivers under Windows. Drivers are right on it. This mode is of little interest to us, we need to transfer it to modem mode.
Check that the modem is seen in the system with the command dmesg . There should be such lines:
 da3: Attempt to query device size failed: NOT READY, Medium not present Root mount waiting for: usbus4 ugen4.3: <Huawei Technologies> at usbus4 umass1: <Huawei Technologies HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 3> on usbus4 umass1: SCSI over Bulk-Only; quirks = 0x0000 Root mount waiting for: usbus4 umass1:1:1:-1: Attached to scbus1 Trying to mount root from ufs:/dev/ad6s1a WARNING: / was not properly dismounted (probe0:umass-sim1:1:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error (probe0:umass-sim1:1:0:0): SCSI status: Check Condition (probe0:umass-sim1:1:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present) cd0 at umass-sim1 bus 1 scbus1 target 0 lun 0 cd0: <HUAWEI Mass Storage 2.31> Removable CD-ROM SCSI-0 device cd0: 40.000MB/s transfers cd0: Attempt to query device size failed: NOT READY, Medium not present 

We check which idVendor and idProduct are set by default with the command usbconfig -d 4.3 dump_device_desc , the value of the -d parameter is viewed from the output of dmesg ( ugen4.3: at usbus4 ):
 ugen4.3: <HUAWEI Mobile Huawei Technologies> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0200 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0040 idVendor = 0x12d1 idProduct = 0x1505 bcdDevice = 0x0000 iManufacturer = 0x0003 <Huawei Technologies> iProduct = 0x0002 <HUAWEI Mobile> iSerialNumber = 0x0000 <no string> bNumConfigurations = 0x0001 

Since there are no / usr / ports in the FreeBSD pfSence edition, we will install the package to change the modem configuration directly from the official repository via a direct link
We need a compiled usb_modeswitch package.
 pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/usb_modeswitch.tbz 

This package stores the configuration in the /usr/local/etc/usb_modeswitch.conf file and the startup script / usr / local / sbin / usb_modeswitch
After installation, edit the configuration file, adding idVendor and idProduct to it :
 DisableSwitching=0 EnableLogging=1 DefaultVendor= 0x12d1 DefaultProduct= 0x1505 TargetVendor= 0x12d1 TargetProduct= 0x140c TargetClass= 01 DetachStorageOnly=0 HuaweiMode=0 MessageEndpoint= not set MessageContent="55534243000000000000000000000011060000000000000000000000000000" NeedResponse=0 ResponseEndpoint= not set 

As a result, we get the replacement of DefaultProduct 0x1505 with TargetProduct 0x140c .
To do this, execute the script, substituting the config for it:
 /usr/local/sbin/usb_modeswitch -H -c /usr/local/etc/usb_modeswitch.conf 

We check usbconfig -d 4.3 dump_device_desc , we are satisfied with the values idProduct 0x1506 and 0x140c .
Checking the dmesg , should get the following lines on the output:
 ugen4.3: <Huawei Technologies> at usbus4 u3g0: <Huawei Technologies HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 3> on usbus4 u3g0: Found 4 ports. 

')
But this is not enough, when rebooting, our modem will return to its settings again, and the connection will be reset. To prevent this from happening, we ’ll add to the /etc/devd.conf file a check at startup, whether our device is in the required configuration, and a script launch, if it is in USBmass mode
 attach 10 { device-name "ugen[0-9]+"; match "vendor" "0x12d1"; match "product" "0x1505"; action "/usr/local/sbin/3G.sh"; }; 

Create the file /usr/local/sbin/3G.sh and make it executable. File contents:
 #!/bin/sh sleep 3 /usr/local/sbin/usb_modeswitch -H -c /usr/local/etc/usb_modeswitch.conf sleep 12 /usr/local/sbin/usb_modeswitch -H -c /usr/local/etc/usb_modeswitch.conf 


ISP connection setup

To create a connection to Yota, go to the top Interfaces -> (assign) menu and select the PPPs tab.


Add a new connection, type PPP, specify Link (/dev/cauU0.3) phone number * 99 #, address of the access point yota.ru.


In the additional options you need to specify that the connection will be raised on request - Enable the Dial on Demand option.


After that, the new interface will appear on the Interface assignments tab.


We turn it on through the top menu Interfaces -> OPT1 and turn it on, choosing PPP as the interface type, phone number * 99 # and APN yota.ru.


Add equipment to your personal account

In the end, you need to register the equipment in your account on the Yota.ru website and link the device to your account. This can be done from any machine; specify ID number on the sim-card with 10 digits (010100xxxx) as the equipment ID. Without this, you can only go to the site yota.ru


Conclusion


This setup is complete, we can use. For other modems, this configuration is also fair, you only need to clarify the idVendor and idProduct parameters required for operation of the equipment in modem mode and substitute them into the configuration.

Author: Dmitry Barsukov, will be grateful for an invite, if the article is worth it, as well as for pointing out possible shortcomings and mistakes. Thank!

Source: https://habr.com/ru/post/187702/


All Articles