Adding OpenWrt support for Xiaomi AX3600 (Part 1)

Whoops, there was one linked in my previous post.

It's kinda onerous and requires another router, though. All credits go to @yyjdelete on

Basic steps:

  • DIsable DHCP on the other router, and set the gateway IP to
  • create /usr/lib/lua/luci/controller/admin/xqsystem.lua with the following content (if running OpenWRT):
module("luci.controller.admin.xqsystem", package.seeall)

function index()
    local page   = node("api")  = firstchild()
    page.title   = ("")
    page.order   = 100
    page.index = true
    page   = node("api","xqsystem")  = firstchild()
    page.title   = ("")
    page.order   = 100
    page.index = true
    entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08)

local LuciHttp = require("luci.http")

function getToken()
    local result = {}
    result["code"] = 0
    result["token"] = "; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;"
  • if not running OpenWRT, make sure returns
{"code":0,"token":"; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;"}

(the backslash can be escaped, and the order of the keys doesn't matter)

  • on the AX6, browse to;stok=<STOK>/api/misystem/extendwifi_connect?ssid={the ssid of the other router}&password={the WPA passphrase of the other router} (sans brackets)
    • it should return with code 0 after a while
  • then browse to;stok=<STOK>/api/xqsystem/oneclick_get_remote_token?username=xxx&password=xxx&nonce=xxx
    • you can leave the fields username, password, and nonce as is, or change them to any non-empty value
    • if accessing requires authentication, try entering the username/password in the respective fields
    • It should also return with code 0
  • SSH should be enabled now. If AX6's Wi-Fi is down, reboot the router.