Troubleshooting QMI connection to a LTE modem, does not get IP address

Will send a copy to you.

The linux Qlog version is sent to you, please take a look.

The point is to generate the Qlog in QMI mode under Linux, when the modem leaves the coverage area, looses service completely, then reenters the service area and connects back to the network or not. Be careful, as in some cases the modem reconnects properly, but looses the connection every few minutes even if the network is properly available.

I ran across this thread, and diagnosed something very similar with uqmi yesterday and corrupted output. You guys seem to off using NetworkManager and QMI, so not sure this is helpful, but it does make uqmi work on ARM9 and smaller systems.

The output is broken because is a fundamental problem in uqmi, it assumes all architectures can do unaligned accesses. Lots of small systems like ARM9, which uses an ARMv5 core require all 32bit values to be aligned in word boundaries, and will break silently if they aren't. (The data is shifted to nearest word boundary.)

It's a good news/bad news story. The macro used means it's a small change, but it's also a terrible macro that uses a GNU GCC feature call compound statement, so there's only so much you can do to fix it. I also don't know where else he makes this assumption. Since the code is generated by perl....I dunno it's all just kind of horrible, IMHO.

--- a/data/gen-code.pl
+++ b/data/gen-code.pl
@@ -431,7 +431,8 @@ print <<EOF;
 #include <string.h>
 #include "qmi-message.h"

-#define get_next(_size) ({ void *_buf = &tlv->data[ofs]; ofs += _size; if (ofs > cur_tlv_len) goto error_len; _buf; })
+uint64_t get_next_tmp[10];
+#define get_next(_size) ({ if (_size > 8*10) goto error_len; memcpy(&get_next_tmp, &tlv->data[ofs], _size); ofs += _size; if (ofs > cur_tlv_len) goto error_len; (void *) &get_next_tmp; })
 #define copy_tlv(_val, _size) \\
        do { \\
                unsigned int __size = _size; \\

It seems that with the latest develop branch and latest EC25 firmware the auto connect issue in QMi mode is resolved. Tried it quite a few times, but the modem came back online all the time, does not matter for how long the signal outage lasted.

Now the new issue is that the QMI connection never goes offline, no matter for how long the signal is not available. The uptime counter also indicates and UP connection, and the uqmi --get-status also indicates "connected" even though the modem is long lost the signal, and is in search mode.

Just a tip, check if your modem in qmi raw_ip mode by looking for Y or N

cat /sys/class/net/wwan0/qmi/raw_ip

Did anyone get troubles with firewall and LTE modems in OpenWrt?
I have Quectel EG25 (same as EC25), have setup QMI (and classic serial 3G the same) in SSH of OpenWrt device modem works great, i can ping any host, make opkg update and install software, download any files without problems. But in LAN networks happens crazy things - i can tracert host, but can't ping or browse it, network icon in Windows 10 OS is showing that PC has access to internet, but i can't download files or access sites. If i connect mobile devices, it says that there no internet. More details here:

I don't know what to do, maybe someone here can helps?

Privet. Gde Tbi shiviosh ?
I have various routers used with Huawei 941 or Quectel EC25, no real problems. BUT I always used good old SERIAL. It simply works :slight_smile: QMI seems to be some type of "Black Magic" to be configured correctly. Anyway, my first guess is, that your firewall does not do correct MASQUERADE for WWAN. Having used SERIAL, MASQERADE had to be done for 3g-wan interface. For your QMI something similar required. Without correct MASQUERADE you can reach the web from router+SSH, which prooves correctnes of the WWAN connection, but your clients from LAN are not properly NATted.
In my custom build openwrt images, I never use the standard firewall stuff, but my own, plain, iptables rules. Easier to read, for me at least, coming from LINUX.

It seems that you right, when i add to firewall custom rules:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o wwan0 -j MASQUERADE
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

it works, but after reboot it again stuck even with custom rules, and nothing helps, i did't understand why. :frowning:

  1. WWAN works from router only, so in general OK
  2. MASQUERADE was missing,and after manual (?) addition it worked.
  3. Does not work any more, after reboot
    Thus: Seems to be firewall problem. For simpler diagnostic, and setup, get rid off the built-in firwall stuff and use your own, minimal iptables-rules for MASQUERADE only. I.e. from rc.local.
  1. WWAN and 3G Serial mode works from router only;
  2. After manual addition it has works before reboot, when i reboot router - even manual addition did not works;
  3. I has clear firewall rules and add rules:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o wwan0 -j MASQUERADE
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

this did not helps.

  1. After manual addition it has works before reboot, when i reboot router - even manual addition did not works;<
    I do not understand.
    After reboot, did you enter the rules again ? As they will be lost, otherwise.
    iptables rules are not automatically kept thru a boot.

Do a
iptables -L -n -v -t nat
to verify, that these rules are really hit.

I have change SIM card (Vodafone) to other LTE operator SIM card (Kyivstar), didn't change any settings in OpenWrt, and problem is gone! I can't understand dependency of that, maybe Vodafone is blocking something... But it very-very curiously!!!

Now there is another problem with new SIM, after some (absolutely randomly) time WAN connection is stop working (even on SSH of OpenWrt host), it seems that QMI did not get new IP address from modem when it needs to reconnect (low signal maybe or something related)...

P.S.
It was issue with "uqmi autoconnect" function, i have disable it and make wwan connection with QMI instead of DHCP lease wwan...

Hi,

I use a quectel EG06, when I write this command,

uqmi -d /dev/cdc-wdm0 --start-network auth

we got an error 14:

QMI_PROTOCOL_ERROR_CALL_FAILED = 14, /< nick=CallFailed >/

what does this error means?
from my understanding I have an authenticated APN so I should use a username + password. So, I changed the command to

uqmi -d /dev/cdc-wdm0 --start-network auth --auth-type pap --username USERNAME --password PASSWORD001
!!"Call failed"!!

any help please!
thank you

To be honest, I never heard of an APN setting that actually needed auth in that sense, with PAP or CHAP.

"subscription" is a term mobile operators use, that for specific APNs they need to be allowed ("subscribed") on your subscriber profile. After that - if the APN is not your default APN - you need to key in the correct APN name, so the network can route your userplane packets across the network to the right SGI address. (particularly important for large corporate APNs which also allows direct access to a corporate network, like a VPN).

To sum it up: in most cases you do not need to "authenticate" an APN, as if your subscriber profiles allows access to an APN, that is already "authenticated", you just need to select it, by configruing its name in your device.

HI,

thank you for your answer.
But, in my case I need the username/password to be attach to the network.

Thank you.

Could you clarify what you mean with that sentence? I am using a Quectel EP06 on a GL.iNet GL-X750 and having the same problems on T-Mobile here in the Netherlands, namely, randomly the WAN connection stops working.
So what I understand of it, you did disable uqmi autoconnect: uqmi -d /dev/cdc-wdm0 --set-autoconnect disabled, and under networking you configured an interface using the QMI protocol instead of using the DHCP client protocol?