OpenWrt is an open-source Linux-based operating system designed for routers and network devices. It offers advanced customization, enhanced security, and additional features that surpass the capabilities of factory firmware. This tutorial walks you through installing OpenWrt on the TP-Link MR6400 router, configuring it for cellular connectivity, and troubleshooting common issues.
Introduction to OpenWrt
What is OpenWrt?
OpenWrt transforms your router into a versatile, powerful networking device. It’s especially popular for enabling advanced network management, security enhancements, and the installation of additional software.
Why Use OpenWrt?
- Unlock Potential: Overcome limitations of factory firmware.
- Customization: Tailor the router for VPNs, QoS, VLANs, and more.
- Prolonged Lifespan: Frequent updates keep older hardware relevant.
- Security: Enhanced firewall and timely patches ensure better protection.
Requirements
- A TP-Link MR6400 router (V5 recommended for this tutorial).
- A computer with an Ethernet port.
- Internet connection for firmware download.
- An Ethernet cable.
- Backup of your current firmware (optional but recommended).
Download OpenWrt Firmware
Verify Compatibility
Visit the OpenWrt Device Page for MR6400.
https://openwrt.org/toh/tp-link/tl-mr6400_v5
Ensure the router version matches the supported hardware.
Download the Firmware
For first-time installation, download the Factory firmware.
Save the file as tp_recovery.bin.
Set Up a TFTP Server
On Linux, use dnsmasq to set up a TFTP server:
sudo dnf install dnsmasq
Serve the Firmware
Configure the server to host tp_recovery.bin at 192.168.0.225/24.
sudo cat /etc/dnsmasq.conf | grep -v ^# | grep -v ^$
port=69
user=dnsmasq
group=dnsmasq
listen-address=192.168.0.225
local-service=host
enable-tftp
tftp-root=/tmp/tftpdata
tftp-no-fail
log-queries
log-dhcp
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
Connect the Router
Use an Ethernet cable to connect the computer to the router.
Hold the router’s Reset button while powering it on.
Flash the Firmware
Release the button after 8 seconds.
The router will download the firmware and flash it. Wait 3–5 minutes until the device reboots.
Install Required Packages
Once OpenWrt is installed, access the LuCI web interface:
- Open a browser and navigate to http://192.168.1.1.
- Log in (default credentials: root with no password). Set an admin password and configure ssh access using keys.
- Go to System -> Software and install the luci-proto-qmi package.
Configure Cellular Connectivity
Create a QMI Interface
- Navigate to Network -> Interfaces.
- Add a new interface and select QMI Cellular as the protocol.
- Set the modem device to /dev/cdc-wdm0.
- Enter the APN provided by your mobile network operator (e.g., “internet”).
- Disable DHCP for IPv4.
Configure via cli.
Manually edit /etc/config/network:
config interface 'wwan'
option proto 'qmi'
option device '/dev/cdc-wdm0'
option apn 'internet'
option pdptype 'ipv4'
option dhcp '0'
Set as Default WAN to setup internet connectivity.
Assign the new wwan interface to the WAN firewall zone.
Troubleshooting
Check Connection Status
Use SSH to connect to the router and verify the LTE modem status:
uqmi -d /dev/cdc-wdm0 --get-data-status
"connected" indicates a successful connection.
Debugging SIM Issues
If the SIM is not detected, run:
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --uim-get-card-status
Look for "Card state: present". If not, power cycle the device.
Signal Strength
Monitor signal quality:
uqmi -d /dev/cdc-wdm0 --get-signal-info
A strong LTE signal typically shows RSSI around -60 dBm.
Fixing Hanging Commands
Edit the qmi.sh script to resolve hanging:
uqmi -s -d "$device" --get-pin-status &
sleep 3
killall uqmi || echo "UQMI is working!"
Maintenance and Optimization
Check Current Network Settings
uqmi -d /dev/cdc-wdm0 --get-current-settings
Automate Interface Restarts
Add a cron job to handle DHCP lease issues:
* * * * * [ "$(uqmi -d /dev/cdc-wdm0 --get-current-settings | grep -oFm1 "Out of call")" != "Out of call" ] || /etc/init.d/network restart
Installing OpenWrt on the TP-Link MR6400 unlocks a wealth of features and customization options. With the steps above, you can harness the full potential of your router, whether for enhanced security, advanced networking, or better performance.
Join the OpenWrt community to explore more possibilities and keep your device at the forefront of networking innovation.
Happy hacking!