Install and configure OpenWrt 23.05.0 in TL-MR6400 v5 with working LTE

(disculpeu-me per escriure en english…)

  • Openwrt version used: OpenWrt 23.05.0

  • DISCLAIMER: once I installed openwrt on the tp-link WR6400 v5, i haven’t been able to reinstall the original TP-link firmware!

I spent few hours to get a working connection via SIM card, and did try few configuration, before I had a working LTE connection. Being openwrt, it is proving to archeive a much more reliable LTE connection then the TP-link firmware.

This router is relatively cheap (~60.-e) but it has very little available space on /dev/mtdblock4, and uses the LTE modem in qmi mode, which is a proprietary protocol by Qualcomm :frowning: , documented at https://openwrt.org/docs/guide-user/network/wan/wwan/ltedongle.

I found that only two extra packages are needed:
qmi-utils luci-proto-qmi

In order to install the qmi-utils package, I had to rebuild the openwrt image, gaining some useful space, but dropping ipv6 support.
I used the image builder, as documented at https://openwrt.org/docs/guide-user/additional-software/imagebuilder.%C2%A0 with the following packages removed and added once compiling with make:

PACKAGES=“uhttpd uhttpd-mod-ubus libiwinfo-lua luci-base luci-app-firewall luci-mod-admin-full luci-theme-bootstrap -ppp -ppp-mod-pppoe -ip6tables -odhcp6c -kmod-ipv6 -kmod-ip6tables -odhcpd-ipv6only qmi-utils luci-proto-qmi”

I installed openwrt on the device, following the instructions at https://openwrt.org/toh/tp-link/tl-mr6400_v5

#serve tftp-recovery image as tp_recovery.bin on 192.168.0.225/24
dnsmasq --port=0 --enable-tftp --tftp-root=/path/to/firmware/directory --tftp-no-blocksize --user=root --group=root

# check tftpd is running
netstat -lunp | grep 69

# when powering on router, with reset button pressed, as soon as possible
ifconfig eth0 192.168.0.225 up

Somehow the tftp image I built was not working, so I first installed the last official openwrt tftp .bin version, and then I did a sysupgrade with the openwrt sysupgrade .bin image I built.

Once succesfuly installed, I removed eth0.2 from the wan interface, and assigned the qmi interface as wan in /etc/config/network:

config interface 'wan'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option apn 'YOUR APN NAME'
        option pincode '****' # your pin code numbers
        option auth 'none'
        option pdptype 'ipv4'
        option delegate '0'
        option dhcp '0'

(I successfully tested this configuration with digi and movistar APNs)

Once rebooted, it takes a minute for the qmi interface to connect to the LTE network and obtain an ipv4 address.

You can check the LTE signal strenght (and a lot of other stuff) with uqmi:

root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-signal-info
{
        "type": "lte",
        "rssi": -71,
        "rsrq": -15,
        "rsrp": -108,
        "snr": 1.400000
}

You can check the status of the network connection on the interface section in Luci or with ifconfig on the terminal:

root@OpenWrt:~# ifconfig
wwan0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.19.10.145  P-t-P:10.19.10.145  Mask:255.255.255.252
          inet6 addr: fe80::745c:fd7e:9bb7:78a4/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:893508 errors:0 dropped:0 overruns:0 frame:0
          TX packets:447789 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1256641567 (1.1 GiB)  TX bytes:22103352 (21.0 MiB)

Finally, I wanted to have the “internet” led blinking on the router, once packages are received from an LTE connection. I added this section in /etc/config/system:

config led 'led_wan'
        option 'name'           'wan'
        option 'sysfs'          'white:wan'
        option 'trigger'        'netdev'
        option 'dev'            'wwan0'
        option 'mode'           'rx'

Next thing to do is to write a script assigning the LTE signal strength to the three “signal” leds: white: signal1 white:signal2 white:signal3

I am still able to receive and read SMS messages, via uqmi commands on the terminal:

uqmi -d /dev/cdc-wdm0 --list-messages --storage me

uqmi -d /dev/cdc-wdm0 --get-message 0 --storage me