Note: The router referenced in this blog is an EU variant of the router, i.e. TP-Link Archer C50 V4. It is recommended that you reference both OEM and OpenWrt documentation for your router before following these steps.
⚠️ Disclaimer: Failing to properly follow mentioned steps may end up in a bricked router. The goal of this blog is to share knowledge and document everything in one place. Proceed with caution at your own risk.
I have been contributing to OpenWISP for over a year now. OpenWISP is a network management software that can be used to manage network devices primarily running OpenWrt. I have been using a virtual machine to suffice for a networking device. But, after getting comfortable with VM, I wanted to get my hands dirtier with a real router.
I chose TP-Link Archer C50 after thorough research for OpenWrt compatible router in my local market. It comes with 8MB Flash storage and 64MB RAM. More hardware information can be found at OpenWrt's device page for TP-Link Archer C50.
While there are pre-built OpenWrt images available from the community, I chose to build the image on my own.
Note: If you want to use the pre-built images, you can reference the concerned section in OpenWrt's documentation.
Building the firmware image on your own is simple as well. You'll have just followed these steps:
Step 1: Download the firmware for the router from TP-Link's download center. The link will download an archive. Extract the contents of the archive and rename the firmware file(it will be with
.bin extension) to
Step 2: Download the OpenWrt sysupgrade for this router from OpenWrt's website. Rename this file to
Step 3: Move these files under the same directory for your ease.
Step 4: Open the terminal in the said directory, and execute the following commands. These commands will build the required firmware image for your router
dd if=/dev/zero of=tp_recovery.bin bs=196608 count=1 dd if=tpl.bin of=tmp.bin bs=131584 count=1 dd if=tmp.bin of=boot.bin bs=512 skip=1 cat boot.bin >> tp_recovery.bin cat owrt.bin >> tp_recovery.bin
TFTP - Trivial File Transfer Protocol - is a very simple protocol, such that it can be implemented in small boot loaders like a router.
While booting, the bootloader listens to TFTP requests for transferring a flash image. This characteristic of the bootloader, allows us to flash the router using TFTP Server.
A router can either have a TFTP client or server. The bootloader of TP-Link Archer C50 integrates a TFTP client. This means that we will have to run a TFTP server.
You will need to follow these steps, to properly configure a TFTP server:
Step 1: Install
sudo apt install aftpd
Step 2: Create a directory from where you want to serve the image file
mkdir -p ~/srv/tftp/
Step 3: Put the
tp_recovery.bin image file in the
Step 4: Change the ownership of the folder and the file in it
sudo chown nobody:nogroup -R /srv/tftp
Step 5: Run TFTP server
sudo atftpd --daemon --no-fork --logfile - ~/srv/tftp
atftpd might not be able to bind to the
69 port number. On Ubuntu, a service named
inet already keeps the hold of port
69. You can stop that service using
systemctl. If the system keep complaining, use
fuser to kill the process as follows
fuser -k 69/udp
Step 6: Check if your TFTP server is listening
netstat -lunp | grep 69
Before jumping right into the flashing your router using the TFTP server, it is generally a good practice to check whether the server is able to serve
tpl_recovery.bin file or not.
It is preferred to use another computer to test the TFTP server, but you can also test it from the same machine. You'll just need to follow these steps.
Step 1: Install
sudo install tftp
Step 2: Connect to the TFTP server using the IP address of the computer running the server.
Substitute X.X.X.X with the IP address of the computer running TFTP server
Note: If you are testing from the same computer, use
0.0.0.0 for the IP address.
Step 3: Fetch
You should get a message like following on the client.
Received <size of the file> bytes in <time taken to complete the transfer> seconds
On the server, you will get a message like this:
<Date and time> <host system name> atftpd[<some numbers I don't understand 😅>]: Serving tp_recovery.bin to <IP address and port number of client>
If you see messages like above, and the
tpl_recovery.bin is present on the client computer, then you are good to go. If not, it might be possible that you messed up something while setting up the TFTP server. Take a step back and check every step.
With everything set, we are good to go and flash the TP-Link Archer C50 V4 with OpenWrt.
Don't get overwhelmed, just follow these steps:
Step 1: Reset your router.
You will not find it in the OpenWrt's documentation because it might not be needed but I like to start fresh.
Step 2: Plug the power cable into the router, but don't turn it on yet.
I prefer to use the power switch on the back of the router to control power.
Step 3: Connect the ethernet interface of your computer to the LAN 1 port of the router.
Step 4: Make sure your computer is not connected to any other network. (Turn off WiFi). And manually set the IP address of your wired ethernet interface to
192.168.0.66. This is important.
Step 5: After making all the configurations, press and hold the reset button and power on the router simultaneously.
⚠️ Don't let go of the reset button yet
After 10 seconds the router will start downloading the firmware image from the TFTP server. The WPS LED will also light up during this time.
You will see a message as below on your TFTP server
<Date and Time> <name of host system> atftpd[<Some numbers I don't understand 😅>]: Serving tp_recovery.bin to 192.168.0.2:3026
Voila! The router has started downloading the firmware image At this moment, you can let go of the reset button.
The router will then reboot(indicated by all LEDs turning off and on). After this, only the power LED will stay on and will keep blinking.
After about a minute, the router will reboot once again and you will be able to login to OpenWrt. But, before that, you will need to follow this one last step.
Step 6: Either configure the ethernet interface of your system to configure its IP address automatically(using DHCP) or manually set it to
192.168.1.X (replace X with a desired number less than 255).
Step 7: Log in to the OpenWrt dashboard by visiting
192.168.1.1 on your browser.
By default, no password is set. The username field should be already populated with
root. Leave the password field blank and click on
Login. Make sure you set a password later.
You can now play with OpenWrt installed on your TP-Link Archer C50 V4 🎉
This write-up was an attempt to document everything in one place in a beginner-friendly manner. While it includes personal experiences, it would have not been possible without the awesome work of the OpenWrt community.