Huawei E3372s + Linux (Rasbian), Incoming connections problem

14,106

Solution 1

You don't need a firmware update, but you do need a modeswitch, which you've found, and a dialer, which you haven't found. The following config files, taken from NVDC Stuff Networking, Virtualization and Data Center Stuff may work out of the box. If not use each as a template and tweak until it starts working:

/etc/usb_modeswitch.conf

DefaultVendor=0x12d1
DefaultProduct=0x14fe

TargetVendor=  0x12d1
TargetProduct= 0x1506

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

/etc/wvdial.conf

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0
Init3 = AT+CGDCONT=1,"IP","internet.t-mobile.cz"
Stupid Mode = 1
ISDN = 0
Modem Type = Analog Modem
New PPPD = yes
Phone = *99***#
Modem = /dev/gsmmodem
Username = { }
Password = { }
Baud = 9600

Usage

  1. Create a link from /dev/gsmmodem to /dev/ttyUSB2, that is the modem.
  2. Dial the outside world. Note that you must do this every time:

    wvdial >/dev/null 2>&1 &
    
  3. Add the following to your system's local startup scripting area:

    MODEM_STORAGE="12d1:14fe"
    MODEM_MODEM="12d1:1506"
    
    # 0 = storage, 1= modem
    MODEM_MODE=0
    
    check_modem_mode () {
     echo -n "Checking modem presence... "
    
     lsusb | grep --quiet "$MODEM_STORAGE"
    
     if [ $? -eq 0 ]; then
      MODEM_MODE=0
      echo "OK: modem in mass storage mode"
     else
      lsusb | grep --quiet "$MODEM_MODEM"
      if [ $? -eq 0 ]; then
       MODEM_MODE=1
       echo "OK: modem in modem mode"
      else
       echo "ERROR: modem not found"
       exit 1
      fi
     fi
    }
    
    set_modem_mode () {
     while [ $MODEM_MODE -eq 0 ]
     do
      echo -n "Setting modem mode... "
      usb_modeswitch -s 15 -I -H -c /etc/usb_modeswitch.conf     >/dev/null 2>&1
      lsusb | grep --quiet "$MODEM_MODEM"
      if [ $? -eq 0 ]; then
       MODEM_MODE=1
       echo "OK"
      else
       echo "FAILED"
      fi
     done
    }
    

Explanation

As I explained in a previous post, a GSM Modem always has two or more parts, in this model's case 3 parts.

  • A Storage area, akin to a USB Stick.
  • A Wireless Ethernet Adapter for connecting multiple devices to it.
  • A PPP Dialer, so that your wireless provider knows you're a paying customer, and can charge you for overages as necessary. Since you can prove you are a paying customer, because PPPoE requires authentication, you can use the negotiated IP Address to access the Internet.

Bullets 1 and 2 are controlled via the etc/modeswitch.conf config file. 12d1 is the Vendor MAC Address, so to speak. Using the local script, the rest of the MAC Address is created. 12:D1:14:FE, ends up as the storage device, and 12:D1:15:06 ends up being the modem. If not using the local script issue a usb_modeswitch -s 15 -I -H -c /etc/usb_modeswitch.conf

Note: By default, ie with no modeswitch Linux only sees the storage device, which is why the OP cannot see or use the PPP Dialer or the Wireless Device.


Once the modem is turned on using the modeswitch, wvdial, or one of it's many replacements, controls access to the outside world. With the modem in Modem Mode, you will finally see output similar to:

wwan0     Link encap:Ethernet  HWaddr 58:2c:80:13:93:13
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:10.83.249.176  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:4265 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6699 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:506706 (494.8 KiB)  TX bytes:600991 (586.9 KiB)

when issuing ifconfig

Solution 2

I guess this is a NAT problem. Even if the ISP is not NATing the connections, the Huawei is using NAT for the eth1 interface.

The Huawei has basically two modes:

  • hi-link, which is using NAT and provides an Ethernet interface.
  • non hi-link, where PPP or NDIS is used to connect to the mobile provider.

There are a lot of tutorials how to change between the two modes by flashing another firmware. However, since you may brick your modem during this process, I am refraining from posting a particular link.

Solution 3

In my case I found that this is what I need for the usb_modeswitch config

cat /etc/usb_modeswitch.d/huawei_e3372.conf 
# modeswitch config file for the huawei e3372

DefaultVendor=0x12d1
DefaultProduct=0x1f01

TargetVendor=  0x12d1
TargetProduct= 0x14dc

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

With this command to run and get the modem working.

sudo usb_modeswitch -s 15 -I -H -c /etc/usb_modeswitch.d/huawei_e3372.conf
Share:
14,106

Related videos on Youtube

Janne Honkonen
Author by

Janne Honkonen

Updated on September 18, 2022

Comments

  • Janne Honkonen
    Janne Honkonen over 1 year

    I have a Linux-based OS (Rasbian) running on Raspberry Pi 2+ and it is using Huawei E3372s 4G/LTE USB Stick for internet connection.

    All my outbound connections work perfectly (Huawei USB mode changed using usb_modeswitch-ruling and Udev/rules.d) but I am unable to receive any kind of inbound connection to the Raspi. Incoming is just not working.

    I cannot receive any packets or connections, which I have tracked realtime and from logs using tools provided by Raspbian package distributions.

    I have already confirmed with my 4G ISP that the extended service which allows two-way traffic is enabled, reseted and so much of their knowledge, to my 3G/4G subscription, working perfectly from their end but I am unable to receive any packets with the Raspi.

    Huawei E3372s (unlike most of the older sticks which use dialing like wvdial) uses CDC_ETH driver system which creates an ethernet-like device to the system (ETH1 in this case) and should work in this case flawlessly.

    I have cleared, re-created, tested, modified, re-cleared and again done all needed tasks with IPTables, checked, modified and tested Route several times as well as confirmed that there are no known blocking systems preventing connection through Huawei USB-stick, yet I still cannot receive even Ping to my system, although there are fully functional services running.

    I have also checked more simple and straightforward areas such as hosts allow/deny rules and have had no luck with them. It is not APN name either as all settings with the Huawei's internal configuration have been set correctly using it's web interface.

    I have, however, encountered on few occasion from random forums, that Huawei CDC_ETH solution may have flaws handling incoming connections with its driver.

    If any of you have experience with Debian/Rasbian/Linux incoming connection problems with Huawei E3372s or relative 3G/4G USB product which use CDC_ETH and have found solution to this problem

    • Admin
      Admin almost 9 years
      Do you have 2 Connection Types - ppp0 connects to your ISP, and eth1/wlan1 should connect you to your network. See Difference between ppp0 vs wwan0
    • Admin
      Admin almost 9 years
      As I described above, Huawei does not create any dialup or ppp-described devices. As devices are inspected, for example with ifconfig, system recognizes device as normal ethernet-based device ETH1 (in addition to regular non-plugged ethernet cable-based connection ETH0). Therefore, all connections are handled like they would be with any LAN-based (ethernet-like) connection, which in normal case, would allow two-way access without problems. At least as far as my knowledge goes.
    • Admin
      Admin almost 9 years
      In addition to the previous comment, as stated, there are no additional devices. Only 3: Lo (for local), Eth0 (for unused cable ethernet) and Eth1 (Huawei pretending to be ethernet device)
    • Admin
      Admin almost 9 years
      you need to install the PPPoE client for your distribution. The PPPoE controls the connection to your ISP. Read the link in my 1st comment.
    • Admin
      Admin almost 9 years
      Solution for those with same problem, solved by ISP's professional task force. Did not test it myself. PPPoE seems not to work in this case. Problem with Huawei E3372s and it's hardware is that virtual hardware prevents any regular PPP connections because of it's HiLink / ethernet virtual mode. Only solution is to upgrade Huawei's firmware to allow PPP connections which it does not normally support. I did not have time to test this myself because project has limited timeframe. Solutions can be found here: lteforum.at/mobilfunk/…
    • Admin
      Admin almost 9 years
      I keep telling you it has 2 parts, virtual or not... No firmware update is needed. Look at NVDC Stuff Networking, Virtualization and Data Center Stuff. The post dated April 25 may help...
  • nelaaro
    nelaaro about 7 years
    This is not the e3372s device but just a straight e3372.