OpenWRT firmware flashing in Mi 4A Gigabit WiFi Router
OpenWRT firmware flashing in Mi 4A Gigabit WiFi Router
The Mi Router 4A Gigabit Edition is a cost-effective option for those looking for a dual-band gigabit WiFi 5 router in India. We have conducted a thorough review of the product, which can be found below.
As you can see or read (Our Website article -> Mi 4A Router Gigabit Edition Review) in the review, with any mainstream consumer end routers, although the hardware specifications are excellent but actual capabilities are really limited due to the stock firmware supplied with the router. But fortunately, the good thing is OpenWRT support of this router.
In this article, we are going to share a step by step guide and tutorial on how to flash or install OpenWRT custom firmware in a Xiaomi Mi 4A Router Gigabit Edition. Further, we shall also cover the process on how to setup Internet / LAN and WiFi of your Mi 4A router running OpenWRT firmware.
What is OpenWRT?
OpenWRT is a custom and open-source firmware for routers or any x86 hardware.
OpenWRT Project Website -> https://openwrt.org/
In simple terms, just like when you buy a PC, it may come with Microsoft Windows as Operating system but if you want or need, you can choose to delete that and Install Linux. Here too, consumer end routers come with their own company given software (which is called Firmware) for operation and control but if you want or need, you can flash that and replace it with Open-Source software like OpenWRT or DD-WRT.
Why Installing and Flashing OpenWRT?
Dell / HP / Lenovo, all these multinational large PC manufacturers don’t actually make any PCs. All of them buy off the shelf parts like Processor, Graphics Card, RAM and stuff like that and then assembles all these parts in their own case & sell it to us. Often, they would include software like Microsoft Windows as the operating system. Now if you look at these parts on their hardware capabilities, they are perfectly capable of turning this PC into a server or do way more than what Microsoft Windows Home SL edition would allow. It is just the software which is holding it back. So you have the option to remove stock software and install Linux and use the full capabilities of the given hardware.
Similarly router makers too do the same. They mostly buy off the shelf parts like Network ICs, Radio Modems, SoC board and assembles them into their own casing. Major difference here is the software. There is no Windows for routers so all the manufacturers of WiFi Router or network hardware have their own software team. Like Apple, they make custom software for each routers they sell and just like apple, although a specific router may contain hardware capable of doing many advance tasks, they would remove that capability from their software. They do it for two reasons, No.1 home users will never need such pro and advance features. It will only confuse them and hamper easy operations and No.2 they can sale the same hardware with more software features with inflated price.
Here comes OpenWRT to rescue. An open-source custom firmware for routers to allow you use the full potential of your router hardware by unlocking all the advance and pro features and options.
Caution – You are warned !!
- Simple regular home users really don’t need OpenWRT. Router Custom firmware is sufficient. OpenWRT will unnecessarily complicate things for you. If you are unsure, then most likely you don’t need OpenWRT.
- OpenWRT will void your warranty so proceed with caution.
- OpenWRT installation is complicated and needs advance skills. Furthermore, chance of destroying your router is high since a simple mistake while flashing can ruin it for you.
- Flashing OpenWRT will void your product warranty. So if anything goes wrong, repair or replacement is out of question.
Prerequisites
This step by step guide & tutorial is for Mi Router 4A Gigabit Edition. Different models will have their own process so this process is only applicable to Xiaomi Mi Router 4A Gigabit Edition (Version R4A only)
Before you begin, make sure to complete this prerequisite checklist.
Hardware
- Xiaomi Mi Router 4A Gigabit Edition -> We are flashing OpenWRT Firmware on this device.
- RJ45 LAN Network Cable
- Computer (Desktop or Laptop) with RJ45 LAN Network Port
- Working Internet Connection to the Router WAN Port
- Power Backup for router and your computer -> Both router and computer must be on proper power backup. You must avoid restart or turn off during flashing process since any reboot or turning off during flashing and OpenWRT installation process may result in a destroyed router.
Software
- Windows 10 or 11 (with admin rights) / A HyperVisor (like VMWare or Virtual Box or Microsoft Hyper-V) / Ubuntu Server LTS ISO / FileZilla Client / OpenWRT Full install firmware file
- MAC Address of WAN Interface of your Present Router
OpenWRT – Flashing & installing
Installing Linux VM
Some of the commands needs to be run from Linux, so if you are already having a working Linux computer then fine, otherwise for those who are with Windows PCs, you need to install a Linux VM (Virtual Machine). You can use Virtual Box / VMWare or Windows built-in Microsoft Hyper-V software to create a virtual machine using Ubuntu Server ISO. While you are installing Ubuntu Server, make sure to install OpenSSH server when asked by the installer.
Make sure to keep the Ubuntu Virtual Machine on external / bridge mode network to allow the VM to obtain DHCP IP directly from router.
Ubuntu / Hyper-V / Virtual Box and VMWare Player, all these are free software and they have many guides on how to install them. Just follow any and complete the installation.
Getting the software
You will lose Internet connectivity during the flashing process. So obtain the needed software and files before starting,
- Download and install FileZilla FTP client for Windows -> Download FileZilla Client for Windows (64bit x86) (filezilla-project.org)
- Download the OpenWRT Firmware Full install -> https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition (Save the firmware file as openwrt.bin)
Flashing Process
Make sure that your Router is connected to the Internet via WAN port and your PC (from which you are flashing and installing OpenWRT) is connected the LAN Port of the router. Both Router and your PC must be having proper power backup. There can’t be any sudden restart / reboot or shutdown during this process.
Step 1 :- Ubuntu VM Login / Update
Use your HyperVisor (VMWare / VirtualBox or Hyper-V) to start the Ubuntu VM.
Start a command prompt in your Windows by clicking start menu and type cmd
. Then right click on it to start it as administrator.
You can run following command in your command prompt to do a remote login to Ubuntu VM.
ssh username@VM.IP.Address -> Enter your Ubuntu username and password to login.
Then run, sudo su
Then run sudo apt update && apt upgrade -y
-> This will update the Ubuntu VM. Once the update finishes, run sudo reboot
-> This will restart the VM.
Step 2 :- Install Dependencies
Login to Ubuntu VM using command prompt then run following commands,
sudo su
sudo apt install git pip python3 -y
Step 3 :- OpenWRT Invasion
We are using a GitHub project called OpenWRTInvasion for this process. So run following commands in your Ubuntu VM (via Windows cmd login)
sudo su
sudo git clone https://github.com/acecilia/OpenWRTInvasion.git
cd OpenWRTInvasion
sudo pip3 install -r requirements.txt
sudo python3 remote_command_execution_vulnerability.py
-> Now this command will ask for few things like,
- Your Mi 4A Router IP Address :- Enter what is your Router IP Address
- Admin Password :- Enter your Router Password.
- Invasion File Option :- Enter 2 for downloading it directly from GitHub.
Once the script is run, it will generate an output. Copy that output into a Notepad file. You may need it at a later stage for router login.
Step 4 :- Uploading the OpenWRT Firmware into the Router
Visit OpenWRT download page and download the latest Full Install Firmware. Save it in your PC and rename it to openwrt.bin
Now launch File Zilla in your Windows PC. Install it if you haven’t done it already.
Host :- Router IP / UserName :- root / Password :- Root -> Click Quickconnect to connect to the router via FTP. Once you have successful connection, upload the OpenWRT ROM File that you have downloaded to the tmp directory of the router
Step 5 :- Flashing the ROM
Under Ubuntu VM Logged in terminal, type following command to log into the router via telnet.
telnet 192.168.1.1
-> Enter user name and password to log in (UserName :- root / Password :- root)
cd /tmp
mtd -e OS1 -r write openwrt.bin OS1
This flashing process may take some time and router will reboot during this process. So have patience during it. Once it completes the job, your Mi 4A Router Gigabit Edition is now running OpenWRT Firmware.
OpenWRT Configuration for Mi Router 4A Gigabit Edition
Once the flashing process has finished, now you can log into the OpenWRT control panel via the browser of your PC. The default access URL / IP address for OpenWRT Router Login is 192.168.1.1. The router page first login needs no password, username is root. So once you log in, change the password to your own.
Router isn’t connected to the Internet yet but since it is an official OpenWRT firmware release for Mi Router 4A Gigabit Edition, so your network interfaces and stuff like that are already configured. You just need to change WAN the settings as per your ISP for internet access to work & setup the WiFi SSID / Password for WiFi to work.
Step 1 :- LAN DHCP Configuration
Under network menu, click interfaces and there under LAN click Edit. This will bring up the configuration of your LAN Network Interface, there under DHCP Server tab go to General Setup. Here you can configure the LAN DHCP server. Default is fine but for fine tuning, for my setup I am starting the DHCP IP at .151 and allowing it to hand over maximum of 45 addresses (different devices) with lease time of 12 hours. Configure it as per your LAN network requirements.
Click Save. But it won’t commit the changes yet. Notice up top in your RHS, there is an option given showing unsaved changes. Click it to bring up the menu to save and apply the settings changes.
Step 2 :- WAN Interface Configuration
First is to change or spoof the MAC. Most Indian ISP, especially those with Fiber to Home ONU/ONT setup may lock your router mac, we need to change the or sppof the WAN Interface MAC with the previous running router MAC.
Click Network in the top menu, then Interface and there under Devices Tab. Click Configure for WAN and enter your MAC address (MAC ID Spoofing). Save it.
Now go to Interfaces and click edit for WAN. There under general settings, you can configure your Internet Connection as per ISP given settings. Some may have DHCP, some may use PPPoE dialer like mine. So configure it as per your ISP given settings. Save it and apply all changes.
If everything is done alright, by now your OpenWRT Firmware running Mi 4A Router will get a successful internet connection. Connection should now be available via both the LAN Ports. Let’s proceed towards the last thing, getting the WiFi up.
Step 3 :- Setting up WiFi
It is fairly simple. All you need to do is under network menu, click Wireless. It will bring up the WiFi Settings Page. You can see Radio0 -> 2.4Ghz and Radio1 -> 5Ghz showing disabled. So click settings for each to make your own changes, like SSID (WiFi Name) and Password under WiFi Security. Don’t tinker much, rest of the stuff can stay default or if you want to tinker, do it at your own desecration.
Share your feedback
All done by now. You have a working OpenWRT firmware running Mi 4A Router Gigabit Editon. Options are now limitless for you. There are many articles on advance stuff possible with OpenWRT so go ahead and get your pro-network up and running.
Let us know your feedback on this process. If you have any questions or feedback, feel free to share that with us
Comments
Post a Comment