(last update: 08-Mar-2021)

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 X-Wrt 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 X-Wrt firmware for Mi Router 3 will be better choice. It also supports latest software packages from OpenWrt repository.

Before continuing the firmware installation, let’s see what OpenWrt offers beside the default Xiaomi’s Chinese firmware:

  1. Supports ALL kinds of popular VPN protocols. (OpenVPN, L2TP, PPTP…)
  2. Torrent client. You don’t need to always power up your PC for downloading/seeding the big torrent files anymore. Your router will work as a low powered Seedbox.
  3. Run various servers. You can run a web server, a proxy server, IRC server and more!
  4. Using QoS (quality of service) which handles the packets travelling through your router. You can prioritize certain types of traffic with QoS. This is my favorite use case as I can reduce the lag while gaming by properly configuring the QoS.
  5. Capture the network traffic. You can capture the network traffic by using various network tools and analyze that traffic later. Useful to the network admin
  6. Real time accurate bandwidth monitoring and throttling.
  7. Monitor internet connectivity
  8. Ad blocking
  9. Print server
  10. DNSCrypt (only possible in X-Wrt firmware)

and much much more. OpenWrt’s software repositories contain other packages that extends more functionality.

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.


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.

Note: if you brick your router, please follow Recovering from softbrick

If still not solved, please post your issue to the support forum. I will suggest you to take your time and read this support forum from the beginning. It holds lots of useful information regarding flashing and recovering.

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
  2. USB Drive
  3. Enough time
  4. 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 PandoraBox firmware:
2.1. Download the firmware file from here
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

**For X-Wrt firmware:
** 2.4. Download kernel1.bin & rootfs0.bin for “Xiaomi Mi Router R3” from here
2.5. Put both files 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 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.

<img class="alignnone size-full wp-image-219" src="/uploads/2019/07/stok.png" alt="" width="812" height="94" srcset="/uploads/2019/07/stok.png 812w, /uploads/2019/07/stok-768x89.png 768w" sizes="(max-width: 812px) 100vw, 812px" />
3.5 Replace the code in the below url and visit that url


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


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


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


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 ( and connect
4.3. Username is ‘root’ and password is NEW_PASSWORD

For PandoraBox
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

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 (while connected with LAN), you will see a PandoraBox firmware upgrade page. select your Pandorabox firmware (downloaded from step 2.1) and upload it. Router will be restarted when done.
4.9. Access the PandoraBox OpenWrt admin page by going, default password is “admin”. Language is by default Chinese. Don’t panic if you don’t understand anything. Just go to the following link to change language.
4.10. Select language “Chinese” to “auto”
4.11. Save and apply (middle button at the very bottom)

For X-Wrt (If you are already on PandoraBox firmware and want to upgrade to X-Wrt, jump to step 4.15)

4.12. Issue the below commands one by one (source: https://openwrt.org/toh/xiaomi/mir3)

nvram set flag_last_success=1
nvram set boot_wait=on
nvram set uart_en=1
nvram commit
cd /extdisks/sda1
mtd write x-wrt--ramips-mt7620-xiaomi_miwifi-r3-squashfs-kernel1.bin kernel1
mtd write x-wrt--ramips-mt7620-xiaomi_miwifi-r3-squashfs-rootfs0.bin rootfs0

4.13. After a few minutes, visit and login with username: root, password: admin

4.14. To change firmware language to english, follow the instructions in the images:

<img class="size-full wp-image-552 aligncenter" src="/uploads/2019/07/xwrt-language1.png" alt="" width="865" height="329" srcset="/uploads/2019/07/xwrt-language1.png 865w, /uploads/2019/07/xwrt-language1-768x292.png 768w" sizes="(max-width: 865px) 100vw, 865px" />

<img class="size-full wp-image-553 aligncenter" src="/uploads/2019/07/xwrt-language2.png" alt="" width="1035" height="478" srcset="/uploads/2019/07/xwrt-language2.png 1035w, /uploads/2019/07/xwrt-language2-768x355.png 768w" sizes="(max-width: 1035px) 100vw, 1035px" />

Upgrade from PandoraBox to X-Wrt

If you are using PandoraBox and want to upgrade to X-Wrt, follow the below steps (source: https://openwrt.org/toh/xiaomi/mir3)
4.15. Download x-wrt——-ramips-mt7620-xiaomi_miwifi-r3-squashfs-breed-factory.bin file from here
4.16. Put the file in FAT/FAT32 formatted USB drive
4.17. Issue the below commands:

cd /extdisks/sda1 
mtd write x-wrt-------ramips-mt7620-xiaomi_miwifi-r3-squashfs-breed-factory.bin firmware 

Now follow 4.13 & 4.14

If it dosn’t work (blinking orange on boot):
4.18. Connect your router through LAN cable. Cable will go from router’s LAN port (not internet/wan port) to your PC.
4.19. Access from browser
4.20. Upload “x-wrt——-ramips-mt7620-xiaomi_miwifi-r3-squashfs-breed-factory.bin” file and flash. Done

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