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. I tried other custom firmware for my Xiaomi Router 3 but I found that Pandorabox (OpenWrt based firmware) is an absolute killer! I’ve been using Pandorabox for almost a year and found no issue.

Let’s see what OpenWrt offers besides 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

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

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

Step 3: Turning on SSH on Router

3.1. Connect your router through wifi with a default password.
3.2. Go to 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.

3.5 Replace the <STOCK> code in the below url and visit that url;stok=<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 <STOCK> code in below url and visit that url;stok=<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 <STOCK> code in below url and visit that url;stok=<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 <STOCK> 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;stok=<STOK>/api/xqsystem/set_name_password?oldPwd=OLD_PASSWORD&newPwd=NEW_PASSWORD

Step 4: Entering into SSH and flash Pandorabox

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
4.4. Now 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. 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)

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

22 thoughts on “How to install OpenWrt on Xiaomi Mi Router 3

  1. Ramom

    Hello, congratulations on the tutorial.

    Can I use the latest firmware and boot?

    1. Kamrul

      Hello, I tried other versions and I found the mentioned version is very stable for day to day work. You can definitely try the latest version.

      Thank you for the comment.

    2. makima

      what version you ended up with? cheers

  2. Miecz

    no matter what i do, i cant get to cd directory…

    1. Kamrul

      Did you connect your usb drive? Otherwise, you won’t be able to cd in external drive

    1. Kamrul

      Yes. USB 2.0, 2 ports 100mbps, non-gigabit.

      1. makima

        great, will install openwrt using your tutorial today. i do hope i won’t brick it)
        thanks again and have a great 2020!

        1. Kamrul

          Good luck. Please let me know whether you succeed or not. Happy new year.

          1. makima

            all went smooth! thank you for the how-to!

          2. Kamrul

            Glad you didn’t brick your router :p Congratulation!

    1. Kamrul

      I would definitely try if I had a spare router. I don’t want to install the new update in my home router as I don’t know if it will work as stable as 18.12. However, you can try upgrading if you want. Thank you

      1. makima

        can i upgrade to OpenWRT if we are now using PandoraBox?

        1. Kamrul

          PandoraBox is based on OpenWRT

    2. Tom

      Did you tried upgrade to 19.07.0?
      Did you bricked the router?

  3. Ben

    Ive reinserted my usb but it still wont let me cd to the external drive

    1. Kamrul

      Please make sure that the usb drive is formatted with FAT/FAT32 and try again.

  4. Fabio

    Hi, thank you for the time you’ve spent for us. I followed your instruction untill “4.5. Wait until the led turns into blue”, but my led is stuck un purple and I can’t access the router anymore…. Can someone help me? Thanks in advance

  5. Adnan

    My Xiaomi Mi Router 3 got bricked and the LED is turned to orange.

    Tried the reset button – USB drive – power up combination but it didn’t work.

    Can anyone please help me fix this problem?

Leave a Reply

Your email address will not be published. Required fields are marked *