Notifications
Clear all

How to install OpenWrt on Xiaomi Mi Router 3

 

domo
 domo
(@domo)
Member Admin
Joined: 3 years ago
Posts: 11
Topic starter  

(based on https://kamrul.dev/how-to-install-openwrt-on-xiaomi-mi-router-3/)

OpenWrt is an embedded operating system based on Linux. You will get full power of Linux in your home router. OpenWrt has a lot of powerful features that default firmware doesn’t offer.

There are several OpenWrt based firmwares for Xiaomi Mi Router 3. Among of them, PandoraBox and Openwrt work very well in Xiaomi Mi Router 3. However, PandoraBox is discontinued. Means Mi Router 3 might not get any latest update from PandoraBox. So right now, installing Openwrt firmware for Mi Router 3 will be better choice. It also supports latest software packages from OpenWrt repository.

NOTE: There is no mobile app to control OpenWrt firmware as Xiaomi firmware does. Also, it is not easy to configure OpenWrt firmware. You need to have absolute patience and troubleshooting capability in order to configure it like the way you want. Also, if you are not a techie person, I will not recommend you to proceed.

Disclaimer

I will not take any responsibility if you brick your router by incorrectly following this tutorial. Though I’ve tested every steps several times and successfully install OpenWrt on my Xiaomi Router. I’ve bricked my router many times in order to find the right steps :p

Some basic knowledge of Linux commands and SSH are necessary.

 

Let’s begin (bricking or succeeding? :p )

What you need:

1. Xiaomi Mi WiFi Router 3 (2 100Mbps non gigabit LAN ports)
2. LAN Cable
3. USB Drive
4. Enough time
5. Brain/common sense

Step 1: Downgrading the official Xiaomi firmware to dev build

1.1. First, assuming that you are using official Xiaomi firmware. Backup your settings if you needed. Now, we need to downgrade to the dev build in order to enable SSH service. So download dev firmware from here:

1.2. Put downloaded “miwifi_r3_all_55ac7_2.11.20.bin” file on FAT/FAT32 formatted USB drive and rename it to “miwifi.bin” (without quote)

1.3. Power off the router and plug the USB into the router. Now hold the reset button and power it up until the yellow led starts flashing. A solid blue will appear after a few moments. We just flashed the dev firmware. Remove the USB.

Step 2:  Download firmware & preparing the flash file

For Openwrt firmware:
2.1. Download the Openwrt firmware file openwrt-ramips-mt7620-xiaomi_miwifi-r3-squashfs-pb-boot.bin 
2.2. Download Pandorabox boot file from here
2.3. Put “pb-boot-xiaomi3-20180726-0d8505f.img” file (boot file) to your FAT/FAT32 formatted USB drive

 

Step 3: Turning on SSH on Router

3.1. Connect your router through wifi with a default password.
3.2. Go to  http://miwifi.com  or  http://192.168.31.1  and setup your router as usual.
3.3. Login to admin panel. Look at the url bar.
3.4. In url bar, after “stok=”, copy the code.

3.5 Replace the code in the below url and visit that url

 http://miwifi.com/cgi-bin/luci/;stok=/api/xqnetwork/set_wifi_ap?ssid=Xiaomi&encryption=NONE&enctype=NONE&channel=1%3Bnvram%20set%20ssh%5Fen%3D1%3B%20nvram%20commit 

3.6. If your wifi disconnect, then connect again. Follow 3.3 and 3.4 step again
3.7. Replace the code in below url and visit that url

 http://miwifi.com/cgi-bin/luci/;stok=/api/xqnetwork/set_wifi_ap?ssid=Xiaomi&encryption=NONE&enctype=NONE&channel=1%3Bsed%20%2Di%20%22%3Ax%3AN%3As%2Fif%20%5C%5B%2E%2A%5C%3B%20then%5Cn%2E%2Areturn%200%5Cn%2E%2Afi%2F%23tb%2F%3Bb%20x%22%20%2Fetc%2Finit.d%2Fdropbear 

3.8. You will probably disconnect again. Reconnect and follow 3.3 and 3.4 steps.
3.9. Replace the code in below url and visit that url

 http://miwifi.com/cgi-bin/luci/;stok=/api/xqnetwork/set_wifi_ap?ssid=Xiaomi&encryption=NONE&enctype=NONE&channel=1%3B%2Fetc%2Finit.d%2Fdropbear%20start 

3.10. Again (one last time) you will be disconnected. Connect again and follow 3.3 and 3.4 steps.
3.11. Replace the code in below url and visit that url. BUT replace OLD_PASSWORD with your admin panel password (that you provided in step 3.2) and NEW_PASSWORD with your desire password

 http://miwifi.com/cgi-bin/luci/;stok=/api/xqsystem/set_name_password?oldPwd=OLD_PASSWORD&newPwd=NEW_PASSWORD 

Step 4: Entering into SSH and flash firmwares:

4.0. Connect USB drive to router
4.1. Download and open PUTTY client
4.2. In SSH field, put your router IP address (192.168.31.1) and connect
4.3. Username is ‘root’ and password is NEW_PASSWORD

For OpenWrt
4.4. Issue below commands one by one:

cd /extdisks/sda1
cp pb-boot-xiaomi3-20180726-0d8505f.img /tmp
cd /tmp
mtd write pb-boot-xiaomi3-20180726-0d8505f.img Bootloader
reboot

4.5. Unplug the USB. Now wait until the led turns into blue
4.6. Power off the router (disconnect the power cable) and then hold the reset button then power up the router, release the reset button after 2/3 seconds after powering up. You will see breath style yellow led will glow
4.7. Connect your router through LAN cable. Cable will go from router’s LAN port (not internet/wan port) to your PC.
4.8. Now go to  http://192.168.1.1  (while connected with LAN), you will see a PandoraBox firmware upgrade page. select your Openwrt firmware file: openwrt-ramips-mt7620-xiaomi_miwifi-r3-squashfs-pb-boot.bin (downloaded from step 2.1) and upload it. Router will be restarted when done.
4.9. Connect your PC or Laptop to router using LAN or wifi SSID: domo3/1234567890 then access the OpenWrt admin page by going  http://192.168.8.1 , default password is “root/admin”. Language is by default English. 

 

If you come this far, congratulation! You have successfully installed OpenWrt to your Xiaomi R3 router. 

This topic was modified 2 years ago 4 times by domo

Quote