Hi, I would like to know if it is possible to access a redmi ax6 router via ssh. I know this is possible with the xiami ax3600 with firmware 1.0.17, but is it also possible with the ax6? I have an ax6 in my hands and I see that it comes with version 1.0.18 and doing the same steps as with the ax3600 I see that it is not possible to access via ssh, does anyone know how to do it? Can I flash with the firmware 1.0.17 from ax3600 on the ax6? they are compatible? thanks in advance
You can presume that you can't use another model's firmware and that they are not compatible, unless the opposite is confirmed.
It is possible to access a redmi ax6 router via ssh, but more difficult than ax3600.If you can read Chinese, visit this website for more information: https://www.right.com.cn/forum/thread-4060726-1-1.html
Simply, you need to do
-
You need another router running openwrt, turn off its DHCP function, and set its LAN IP to 169.254.31.1, connect your computer to this router and set the IP to 169.254.31.3. If everything is OK, you can enter the URL http://169.254.31.1 to access this router, you also need to know wifi name and password of this router
-
Create new file /usr/lib/lua/luci/controller/admin/xqsystem.lua on this router, its content is
module("luci.controller.admin.xqsystem", package.seeall)
function index()
local page = node("api")
page.target = firstchild()
page.title = ("")
page.order = 100
page.index = true
page = node("api","xqsystem")
page.target = firstchild()
page.title = ("")
page.order = 100
page.index = true
entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08)
end
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;"
LuciHttp.write_json(result)
end
Make sure when you visit http://169.254.31.1/cgi-bin/luci/api/xqsystem/token you will get result like this
{"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;"}
backslashes are irrelevant
-
Login in to your router and get the STOK like follwing:
http://192.168.31.1/cgi-bin/luci/;stok={STOK}/web/home#router
-
Access the URL in the browser, you need to replace {STOK} {WIFI_NAME} {PASSWORD} in the URL:
http://192.168.31.1/cgi-bin/luci/;stok={STOK}/api/misystem/extendwifi_connect?ssid={WIFI_NAME}&password={PASSWORD}
it will return 0 -
Access the URL in the browser, you need to replace {STOK}:
http://192.168.31.1/cgi-bin/luci/;stok={STOK}/api/xqsystem/oneclick_get_remote_token?username=xxx&password=xxx&nonce=xxx
Now you can access your redmi ax6 via ssh, username is root, you can get default password here: https://www.oxygen7.cn/miwifi/
By the way, don’t forget your router running openwrt, turn on the DHCP function and set the IP to 192.168.1.1, If you forget, I bet you can never connect to it again unless you reset it
Ok, thanks you very much! And yes, it’s more difficult
I copy code but my result is:
{"token":"; sed -i 's\/channel=.*\/channel=\"debug\"\/g' \/etc\/init.d\/dropbear; \/etc\/init.d\/dropbear start;","code":0}
And it doesn't work. When I try open http://192.168.31.1/cgi-bin/luci/;stok={STOK}/api/misystem/extendwifi_connect?ssid={WIFI_NAME}&password={PASSWORD} i get:
504 Gateway Time-out
nginx/1.12.2
What I doing wrong? Any ideas?
Perfect, it worked for me. The only thing is that after HW reset, I need to repeat points 3-5.
I needed this to allow VLAN tagging. My ISP requires VLAN 10 (Fibre - VODAFONE SETUP HERE). Before that, I could not connect to the Internet at all. After changing /etc/config/network to
option ifname 'eth1.10'
in eth1, wan and wan6, it says "connected", blue LED for Internet is on, but I cannot load any page, neither the speed test in the router GUI works. Any idea what it could be?
Thank you very much!
Ahh, got it. It was MTU. The ISP says it should be set on 1500, Redmi AX6 has it natively 1500, but I had to go down with it. Initially, the ping seemed alright at 1472, but Netflix on a TV was still buggy,... All stable at 1462. I hope it is not so bad. The speed is still around some 935-945 through ethernet, so I assume it is fine.
Thank you very much for the guide!
Are you sure you followed the guide? Points 1-3 are on an OpenWrt router, points 3-5 are on Redmi AX6.
Point 4 - you connect with AX6 (PC connected to AX6) to the OpenWrt router (its Wifi name and password).
Point 5 - recalls the tocken on AX6 (PC still connected to AX6) fro the OpenWrt routeer as connected in thee previous step.
yes, i'm sure. Point 3 - " Make sure when you visit http://169.254.31.1/cgi-bin/luci/api/xqsystem/token you will get result like this" and answer is {"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;"}
but I've answer with "token" first and "code":0 at end of line {"token":" bla bla bla"; "code":0}
That is alright. The important thing is that it is there. I had it at the end of the line too. Though, I cannot see this part in your answer:
...nvram set ssh_en=1; nvram commit;...
It seems that your previous step might have been wrong. What firmware version of AX6 do you have, btw.?
Commands doesnt matter, I have ssh_en set 1 so i cut off this commands. I need to start dropbear so i left only sed and dropbear start. I tried on 1.0.16 and 1.0.18, but that dosent mattes to because on my old openwrt router always answer is "token":".......;"code":0 insted "code":0,"token":......
Again, I had "code":0 at the very end of the line too, and it worked for me. This is exactly what I get:
ok, thanks. So i try again.
I found couse of my problem. I changed wifi autorisation on openwrt router WPA>WPA2 and now it works. Thanks for help.
If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Hello, sorry for basic questions - I'm very new to OpenWrt. Could you please comment on few steps:
- How to turn off OpenWrt router's DHCP? I've managed to change the IP and also can enter the URL http://169.254.31.1 but don't know where to search the switch for DCHP in the OpenWrt interface
- How do you create the xqsystem.lua file and send it to the router?
Many thanks in advance and apologies for the basic questions!
need tow router: AX6 and another openwrt router which has wifi module
1.enter the another openwrt router's configure web, find the network,click LAN interface, then it will jump a page, disable dhcp.
2.use xftp or winscp, if you know how to ssh connect device,it will be easy.
not native English speaker,I hope you can understand what i say.
hope you will success and have fun
I do understand, your English is really good. Could you please tell me step by step what commands should I type to send the xqsystem.lua to the router via ssh?
Also, should I create the file via text editor first or the code should be send via ssh?
All I know is how to connect to the router - ssh root@169.254.31.1 - that's all, I'm afraid
Thank you for your praise.
It seem that you are using linux, some efficient software may can not excute.
In that case, I address you that you can enter the code below, it can also be used in windows.
I didn't test it because I only have one ax6. After I enabled ax6's SSH, I sold the old openwrt.
-
ssh your another openwrt router first whatever tools you use
-
create and open a empty file named "xqsystem.lua"
vi /usr/lib/lua/luci/controller/admin/xqsystem.lua
-
on your keyboard enter "i" then paste the context of xqsystem.lua
module("luci.controller.admin.xqsystem", package.seeall)
function index()
local page = node("api")
page.target = firstchild()
page.title = ("")
page.order = 100
page.index = true
page = node("api","xqsystem")
page.target = firstchild()
page.title = ("")
page.order = 100
page.index = true
entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08)
end
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;"
LuciHttp.write_json(result)
end
- on your keyboard , enter "Esc, ":wq", finally "Enter" . (":wq"word by word)
- reboot you another openwrt router
I think it will take too much time to discuss these basic operations, which is a bit off topic and is not suitable for discussion under this issue. I suggest that we can communicate by private letter.
My timezone may be different with you, it's late now, so the next possible response may take a long time.