Huawei E3372s + Linux (Rasbian), Incoming connections problem

3ghuaweiltemodemraspbian

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

Best Answer

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

Related Question