OpenWrt support for Zyxel LTE5398-M904

Thank you @ncompact and @AndrewZ
You were right!
Somehow I missed the part that I have to configure the Quectel modem separately.

This is my latest configuration:

config interface '4G'
	option proto 'qmi'
	option device '/dev/cdc-wdm0'
	option apn 'web.vodafone.de'
	option auth 'none'
	option pdptype 'ipv4'
	option delay '30'
	option timeout '120'

For future reference, I am posting my command history for anyone else who might land here via a search engine
Screenshot 2024-07-24 at 19.33.31

picocom /dev/ttyUSB3

>AT+CGDCONT?
>+CGDCONT: 1,"IPV4V6","internet","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
>+CGDCONT: 2,"IPV4V6","ims","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
>+CGDCONT: 3,"IPV4V6","sos","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,1
>
>OK
>
>AT+CGDCONT=1,"IP","web.vodafone.de"
>OK
>
>AAT+CGDCONT?
>+CGDCONT: 1,"IP","web.vodafone.de","0.0.0.0",0,0,0,0
>+CGDCONT: 2,"IPV4V6","ims","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
>+CGDCONT: 3,"IPV4V6","sos","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,1
>
>OK

reboot

Since I set the record straight, this is what my last log looks like.

Fri Jul 19 17:58:37 2024 daemon.notice netifd: Interface '4G' is setting up now
Fri Jul 19 17:59:07 2024 daemon.notice netifd: 4G (4903): Waiting for SIM initialization
Fri Jul 19 17:59:10 2024 daemon.notice netifd: 4G (4903): Failed to parse message data
Fri Jul 19 17:59:10 2024 daemon.notice netifd: 4G (4903): SIM in illegal state - Power-cycling SIM
Fri Jul 19 17:59:10 2024 daemon.notice netifd: 4G (4903): "Failed to connect to service"
Fri Jul 19 17:59:13 2024 daemon.notice netifd: 4G (4903): "Failed to connect to service"
Fri Jul 19 17:59:14 2024 daemon.notice netifd: 4G (4903): Failed to parse message data
Fri Jul 19 17:59:14 2024 daemon.notice netifd: 4G (4903): SIM in illegal state - Power-cycling SIM
Fri Jul 19 17:59:15 2024 daemon.notice netifd: 4G (4903): "Failed to connect to service"
Fri Jul 19 17:59:18 2024 daemon.notice netifd: 4G (4903): "Failed to connect to service"
Fri Jul 19 17:59:19 2024 daemon.notice netifd: 4G (4903): Failed to parse message data
Fri Jul 19 17:59:19 2024 daemon.notice netifd: 4G (4903): SIM in illegal state - Power-cycling SIM
Fri Jul 19 17:59:20 2024 daemon.notice netifd: 4G (4903): Request timed out
Fri Jul 19 17:59:20 2024 daemon.notice netifd: 4G (4903): "Unknown error"
Fri Jul 19 17:59:23 2024 daemon.notice netifd: 4G (4903): "No effect"
Fri Jul 19 17:59:24 2024 daemon.notice netifd: 4G (4903): Failed to parse message data
Fri Jul 19 17:59:24 2024 daemon.notice netifd: 4G (4903): PIN verification is disabled
Fri Jul 19 17:59:25 2024 daemon.notice netifd: 4G (4903): Device does not support 802.3 mode. Informing driver of raw-ip only for wwan0 ..
Fri Jul 19 17:59:26 2024 daemon.notice netifd: 4G (4903): Waiting for network registration
Fri Jul 19 17:59:31 2024 daemon.notice netifd: 4G (4903): Starting network 4G
Fri Jul 19 17:59:31 2024 daemon.notice netifd: 4G (4903): Setting up wwan0
Fri Jul 19 17:59:32 2024 daemon.notice netifd: Interface '4G' is now up
Fri Jul 19 17:59:32 2024 daemon.notice netifd: Network device 'wwan0' link is up
Fri Jul 19 17:59:32 2024 daemon.notice netifd: Network alias 'wwan0' link is up
Fri Jul 19 17:59:32 2024 daemon.notice netifd: Interface '4G_4' is enabled
Fri Jul 19 17:59:32 2024 daemon.notice netifd: Interface '4G_4' has link connectivity
Fri Jul 19 17:59:32 2024 daemon.notice netifd: Interface '4G_4' is setting up now
Fri Jul 19 17:59:32 2024 daemon.notice netifd: 4G_4 (5040): udhcpc: started, v1.36.1
Fri Jul 19 17:59:32 2024 daemon.notice netifd: 4G_4 (5040): udhcpc: broadcasting discover
Fri Jul 19 17:59:32 2024 daemon.notice netifd: 4G_4 (5040): udhcpc: broadcasting select for xxx.xxx.xxx.243, server xxx.xxx.xxx.244
Fri Jul 19 17:59:32 2024 daemon.notice netifd: 4G_4 (5040): udhcpc: lease of xxx.xxx.xxx.243 obtained from xxx.xxx.xxx.244, lease time 7200
Fri Jul 19 17:59:33 2024 daemon.notice netifd: Interface '4G_4' is now up
Fri Jul 19 17:59:33 2024 user.notice nlbwmon: Reloading nlbwmon due to ifup of 4G (wwan0)
Fri Jul 19 17:59:35 2024 user.notice nlbwmon: Reloading nlbwmon due to ifup of 4G_4 (wwan0)

Hello Guys,

i want to give an update on my issue with frequent disconnects and stability.
After the tests mentioned in this thread, the first thing i tried, was using modemmanager. i found that it reconnects automatically every 4h (maybe ip reset?) though the stability was greatly improved. My (cell locked) line never changed to 3g or to any other bts anymore. Also it always reconnected automatically really fast, so service monitor couldnt even recognize any downtime anymore.
for me modemmanager did the trick and got me a pretty stable and reliable connection.

The overall experience for me is now a lot better then before with stock rom or OpenWRT with qmi.

Thanks to all and special thanks to @ncompact for all the ideas

hoping to do you a favor ... :grinning:

I suggest you switch to ECM mode that was recommended to me by user @brada4

https://openwrt.org/docs/guide-user/network/wan/wwan/ethernetoverusb_cdc


if you're interested:

for AT commands use "picocom"
for sms management use "sms-tool"

uptime 10 days
no reconnection script needed,

2 connectivity failures detected during use but resolved autonomously by the router for about 2 minutes of no internet signal

if you want to detect all possible disconnections and you have a connection with unlimited gigabytes

set AT command AT+QCFG="usbnet",1

+QCFG: "usbnet",1

edit /etc/config/network (only part of interest)

config interface 'wan'
        option proto 'dhcp'
        option modes 'all'
        option autoconnect '1'
        option device 'usb0'

ps: and reboot your router ... :grinning: because if you don't do this you may detect a lack of connection ...

1 Like

It depends on actual hardware and wiring, you must roll through all modes and measure which works best. One reconnects gsm with no updown to host ,another gives you perfect control over that aspect etc.

Probably, that is your ISP.

Hi, if anyone need to restore to stock i followed this method:
prerequisites:
You must have Kernel2 stock image not erased

in openwrt do:
fw_setenv CheckBypass 0
mtd -r erase Kernel

Doing this, Bootloader will check the Kernel1 image, and will not pass the checksum
so this trigger the copy of Kernel2 to Kernel1

How to check kernel2 is not erased?

hoping to help you (As for the question, I may have misunderstood it, in that case I apologize in advance) ...

if you have not done this step:

https://openwrt.org/toh/zyxel/lte5398-m904#copying_openwrt_to_the_recovery_partition

"Kernel2" has not been touched

show:

if you want to go back to the original firmware you can do this:

what i did to install Openwrt:

Log in as β€œroot” on 192.168.1.1 port 22
scp OpenWrt initramfs-recovery.bin image to 192.168.1.1:/tmp

Prepare bootloader config by running:

nvram setro uboot DebugFlag 0x1
nvram setro uboot CheckBypass 0
nvram commit

Run mtd_write -w write initramfs-recovery.bin Kernel and reboot

Wait for OpenWrt to boot and ssh to root@192.168.1.1

Sysupgrade to the OpenWrt sysupgrade image and reboot

I made a dump of the partitions before and after the migration on Openwrt and the md5sum of "Kernel2" remained unchanged since I did not touch this partition..

how to dump the current "Kernel2" partition and find its md5sum:

ssh to the router and then:

cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00080000 00020000 "Bootloader"
mtd1: 00080000 00020000 "Config"
mtd2: 00040000 00020000 "Factory"
mtd3: 01ec0000 00020000 "Kernel"
mtd4: 01ac0000 00020000 "ubi"
mtd5: 01ec0000 00020000 "Kernel2"
mtd6: 00100000 00020000 "wwan"
mtd7: 01000000 00020000 "data"
mtd8: 00100000 00020000 "rom-d"
mtd9: 00080000 00020000 "reserve"

cd /tmp

dd if=/dev/mtd5 of=mtd5.bin
62976+0 records in
62976+0 records out

md5sum mtd5.bin 
c371cadac1f973151f5850f30ed0201f  mtd5.bin

my archive on pc (before migrating to Openwrt):

date
Sat Dec  9 22:33:27 GMT 2023
cat /proc/mtd
dev:    size   erasesize  name
mtd0: 07f80000 00020000 "ALL"
mtd1: 00080000 00020000 "Bootloader"
mtd2: 00080000 00020000 "Config"
mtd3: 00040000 00020000 "Factory"
mtd4: 01ec0000 00020000 "Kernel"
mtd5: 01ec0000 00020000 "Kernel2"
mtd6: 00100000 00020000 "wwan"
mtd7: 01000000 00020000 "data"
mtd8: 00100000 00020000 "rom-d"
mtd9: 00080000 00020000 "reserve"

dc7b20f210e261637f08c198ebe02778  /dev/mtd0
84ed520d76000b93199318ff68f15ed0  /dev/mtd1
aba9ac2c0a14bcb523c908b25e1987b9  /dev/mtd2
3eb342775b89e2e4a14dae5eadda6c31  /dev/mtd3
104ccf1763aedd8dfe8d5b307a302cd7  /dev/mtd4
c371cadac1f973151f5850f30ed0201f  /dev/mtd5
2fdd6851b32ae931637d4845c037b550  /dev/mtd6
187b869ef737120af2ac1b235cbe798d  /dev/mtd7
53a4e0e6351dcd4f313de7991c9ff3e7  /dev/mtd8
38eb11b49b828dc070270680a8a37845  /dev/mtd9

How to improve speeds on this router?

On ZTE MF289F i have 360Mb/s, but on this Zyxel 299Mb/s. Same ISP, same place.

There is no solution for that yet. It looks like the problem is in the MT7621 USB3 driver affecting other platforms as well.

2 Likes