Pimp your TL-MR3020 mobile router
The One-Watt Server
Many devices now run Linux – but mostly as a closed source firmware that you cannot access. We show how to use OpenWrt to free the TL-MR3020 router from its proprietary firmware and convert it into an all-around server for your home network.
TP-Link [1] manufactures routers in various performance classes. The TL-MR3020 (Figure 1) is marketed by the manufacturer as a mobile router because it is small and light. However, it does not support 3G (see the "Hardware" box), although you can upgrade via the USB port. Thus, the router is aimed at people who do not need 3G or have a UMTS stick and therefore do not want to invest in an expensive mobile UMTS router. However, the "normal" use of the router is not the focus of this article; instead, I will describe how to convert it into a mini-server.
Hardware
The TL-MR3020 is a small, white plastic box (Figure 1) measuring 7.4 x 6.7 x 2.2 centimeters and weighing only 60 grams. A mini-USB connector is used for the power supply, and the AC adapter provided supplies 1 watt. Moreover, the router will also work without any problems on a USB port. Additionally, the TL-MR3020 includes a USB 2.0 port and an RJ45 Ethernet port (100Mbps). TP-Link provides a short, flat patch cable for the latter. On the wireless side, the small router supports IEEE 802.11b/g/n at up to 150Mbps.
The TL-MR3020 uses five LEDs to indicate its status, four of which can be programmed. There is also a button for the wireless setup via WPS and a slide switch with three positions (3G/WISP/AP). Inside, the router has a 400MHz ARM CPU and 32MB RAM. The operating system resides on a 4MB flash chip. The USB port is used with the original firmware to connect a UMTS stick for operation as a mobile 3G router. Without a stick, the device acts as a wireless access point.
As a useful addition to the TL-MR3020, I would recommend a mini-USB hub by Pearl (Figure 1). This device integrates a micro-SDHC reader and thus provides the advanced root filesystem described in this article on a memory card without blocking the USB port.
The router board contains additional ports, but TP-Link does not route them out. If you can use a soldering iron, you could attach other components, such as a serial console, an I2C interface, or an external antenna. The OpenWrt wiki shows some pictures and links to relevant instructions on its TL-MR3020 pages [3].
To do this, you'll replace the existing firmware with OpenWrt [2], a special Linux distribution for microdevices. OpenWrt has a package management system that is in no way inferior to that of classical distributions; thus, only the limitations of the hardware can curb your creativity.
Prelude
The TL-MR3020 is well-suited to this purpose for two reasons: On one hand, it costs EUR 30 (US$ 40) – which is not too much, if you happen to "brick" the device. On the other hand, the manufacturer does not put any obstacles in the way of installing third-party firmware.
To begin, download the correct version of OpenWrt [3] and follow the brief, but perfectly sufficient, instructions that come with the router to connect to the device's web interface. When you get there, upload the new firmware to the TL-MR3020 by selecting Upgrade in the new web form (Figure 2).
Uploading the firmware is the only really critical step in the whole process. A defective firmware image will send the router off to the happy hunting grounds – your only chance is a soldering iron. Thus, before loading the image, it is essential to check out the postings on the OpenWrt wiki [3] and follow the appropriate instructions.
After installing OpenWrt, the next step is the basic configuration, particularly for the network. Then, you need to set up a number of software packages that upgrade USB support for data media (USB sticks or hard disks). This step lets you boot the router from an external disk. On the now-extended root filesystem, you then add more software packages from the OpenWrt repository for the actual application.
First Contact
After the firmware upgrade and device reboot, you can connect your PC or laptop to the router with the use of a cable. Configure the network (you can normally use the network manager for this) and login via Telnet on 192.168.1.1 (Figure 3). The router runs a DHCP server that supplies a suitable address to your PC or laptop.
At this point, you should set a password for root. OpenWrt then switches off the Telnet server for safety reasons and starts the SSH server. Next, adjust the network configuration so that the router is on your home network; then, you can move on and add more software. For details of the OpenWrt configuration system, see the "Configuring OpenWrt" box.
Configuring OpenWrt
The OpenWrt configuration system remains very consistent across all system-related packages. All configuration files are located in /etc/config
and are simply structured plaintext files that are most easily changed in an editor.
For production operation of the router later on, the web interface is the preferred alternative to the editor: Here, you can conveniently modify individual configuration parameters and query the system state (Figure 4). Another alternative is an interface for the command line. The command
$ uci get system.slider.handler
reads the value of the handler
option in the slider
section of the /etc/config/system
file. For scripts, the /lib/functions.sh
library offers a few utilities that significantly facilitate the handling of settings.
To use the router as a server on your home network, the network configuration should look like Listing 1 (/etc/config/network
) and Listing 2 (/etc/config/wireless
). Lines 9-15 in Listing 1 configure the WLAN interface. In Listing 2, line 19 ensures that the server is integrated into the network as a WLAN client rather than as an access point or router.
Listing 1
/etc/config/network
Listing 2
/etc/config/wireless
After a reboot, the device should be found at the configured network address. If not, emergency mode can help: During the boot process, press the WPS button once it starts flashing. If the LED light flashes quickly, then release it again. Now the device is in Failsafe mode with the default address 192.168.1.1 and running the Telnet daemon. You can connect to Telnet and make the necessary corrections. However, no DHCP server is available on the router in this mode. You must assign a matching IP address to your own computer manually.
More Software
The original firmware image does not contain all the components that are necessary for running the root filesystem on a USB stick, so you will need to add them now. After successfully completing the network configuration, the mini-router can access the Internet and use the convenient package management system to install additional software retroactively.
The pivotal point is the opkg
command, which you need to run as root. To do so, first call opkg update
to upgrade the package list. Then, install the specified packages using the following command:
# opkg install <package>
If you are looking for a particular package, the list
subcommand outputs a package list with brief descriptions. For the USB installation, you primarily need a set of kernel packages (Listing 3). It's best to partition and format the USB stick (/dev/sdb
in the listing – you might need to adjust this) on your PC. Besides the root partition, you'll want a home partition and, above all, swap space.
Listing 3
Preparing the USB Stick
Then, you can simply plug the stick into the router and change the configuration of the mountpoints in the /etc/config/fstab
file. Lines 10-16 in Listing 4 are important. The last line of Listing 3 copies the entire root filesystem to the stick. Creating a backup now is advisable. The system will still boot, even without the stick inserted: In this case, it simply ignores the nonexisting devices.
Listing 4
Configuring Mountpoints
After a reboot with a stick attached, you finally have more disk space. Any packages you now add can be stored there. All told, having the root filesystem on a USB device is handy. You can modify the configuration with the usual editors on a PC and easily copy data between locations (e.g., for backups).
At this point, the basic configuration is complete except for a few things, such as the hostname. The remainder of the procedure depends on how you will be using the router, and you can use the package manager to retrieve and configure the required software. The procedure on OpenWrt is no different from that of any other distribution.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.