小米AX3000T折腾OpenWrt

前置准备

  • 小米路由器AX3000T
  • 一根网线
  • 一台PC或笔记本

有时间的话,可以先看下相关的视频,了解一些前置知识。

openwrt 路由器设置详解 - bilibili

OpenWrt防火墙设置,端口转发|通信规则设置,实现内网穿透、远程桌面的首选设置项 - 知乎

OpenWrt安装

可以先阅读一下 [OpenWrt 维基百科]小米 AX3000T

主要参考:https://www.cnblogs.com/subeipo/p/18974162

看过的一些帖子:

汉化

opkg update
opkg install luci-compat
opkg install luci-lib-ipkg
opkg install luci-i18n-base-zh-cn

Argon主题安装

opkg update
opkg install luci-compat
opkg install luci-lib-ipkg

cd /tmp
wget --no-check-certificate -O luci-theme-argon_2.3.1_all.ipk --no-check-certificate https://gh-proxy.com/https://github.com/jerrykuku/luci-theme-argon/releases/download/v2.3.1/luci-theme-argon_2.3.1_all.ipk
opkg install luci-theme-argon_2.3.1_all.ipk

wget --no-check-certificate -O luci-app-argon-config_0.9_all.ipk --no-check-certificate https://gh-proxy.com/https://github.com/jerrykuku/luci-app-argon-config/releases/download/v0.9/luci-app-argon-config_0.9_all.ipk
opkg install luci-app-argon-config*.ipk
/lib/functions.sh
# 安装中报错: line 2: can't open '/etc/uci-defaults/luci-argon-config
# 先将文件/lib/functions.sh中的377行(openwrt24.10.4版本)
# ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i"
# 改成 ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && echo
# 就是将最后的 rm -f "$i" 改成 echo
# 然后再安装ipk

https://www.regecc.net/openwrt-argon-theme-zh/

https://github.com/jerrykuku/luci-theme-argon/releases

OpenWrt 修改登录页面默认展示的 root 用户名信息,保护隐私

解决安装中的问题://usr/lib/opkg/info/luci-theme-argon.postinst: .: line 2: can’t open ‘/etc/uci-defaults/30_luci-theme-argon’: No such file or directory

禁止全局访问

修改/etc/config/uhttpd文件。

config uhttpd 'main'
list listen_http '0.0.0.0:80' # 将0.0.0.0改成当前路由器IP,比如192.168.1.2。如果要修改端口,就将80修改为指定端口。
list listen_http '[::]:80' # 不需要IPv6访问,删除此行
list listen_https '0.0.0.0:443' # 不需要https,删除此行
list listen_https '[::]:443' # 不需要IPv6+https,删除此行

修改完配置后,执行/etc/init.d/uhttpd restart重启即可生效。

更换清华源

sed -i 's/downloads.openwrt.org/mirrors.ustc.edu.cn\/openwrt/g' /etc/opkg/distfeeds.conf

参考:https://mirrors.ustc.edu.cn/help/openwrt.html

访问光猫配置

OpenWrt 纯浏览器设置访问桥接模式下的光猫

IPv6配置

opkg update
opkg install ip6tables
opkg install kmod-ipt-nat6

# 临时开启IPv6端口转发
ip6tables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination [fe80::1aff:42b6:71f0:317e]:3389

OpenWrt 开启 IPv6 公网访问全指南

OpenWrt | 在 PPP 拨号模式下启用 IPv6 功能

解决家庭环境宽带断线重播后,有概率无法获取 IPV6 地址的问题

在OpenWrt上配置原生IPv6 NAT

Openwrt 配置IPV4&IPV6 DNAT端口映射,访问内网IPV6地址_openwrt 端口映射

可能需要用到

一些插件

Host Updater

GxxkX/hostupdater: 一个用于OpenWrt的hosts订阅源管理软件包,支持多个hosts源的定时抓取和手动更新。

wget https://gh-proxy.com/https://github.com/GxxkX/hostupdater/releases/download/1.0.0/hostupdater_1.0.0-r1_all.ipk
opkg install hostupdater_1.0.0-1_all.ipk

DDNS-GO

wget --no-check-certificate https://gh-proxy.com/https://github.com/sirpdboy/luci-app-ddns-go/releases/download/v6.12.5/luci-app-ddns-go_1.5.4-r20250601_all.ipk
wget --no-check-certificate https://gh-proxy.com/https://github.com/sirpdboy/luci-app-ddns-go/releases/download/v6.12.5/luci-i18n-ddns-go-zh-cn_25.135.22407.89837ec_all.ipk
wget --no-check-certificate https://gh-proxy.com/https://github.com/sirpdboy/luci-app-ddns-go/releases/download/v6.12.5/ddns-go_6.12.5-r11_aarch64_cortex-a53.ipk

opkg install luci-app-ddns-go_1.5.4-r20250601_all.ipk
opkg install luci-i18n-ddns-go-zh-cn_25.135.22407.89837ec_all.ipk
opkg install ddns-go_6.12.5-r11_aarch64_cortex-a53.ipk

参考:https://github.com/sirpdboy/luci-app-ddns-go

SmartDNS

opkg update
opkg install smartdns
opkg install luci-app-smartdns
opkg install luci-i18n-smartdns-zh-cn

资料参考:

TTYD终端

opkg update
opkg install ttyd luci-app-ttyd luci-i18n-ttyd-zh-cn

# 如果希望默认登录root用户,在/etc/config/ttyd配置文件中,/bin/login 后面追加 -f root 即可.
# option command '/bin/login -f root'

OpenWrt 中 TTYD 相关

家长控制

wget --no-check-certificate https://gh-proxy.com/https://github.com/sirpdboy/luci-app-parentcontrol/releases/download/v1.7.2/luci-app-parentcontrol_1.7.1_all.ipk
wget --no-check-certificate https://gh-proxy.com/https://github.com/sirpdboy/luci-app-parentcontrol/releases/download/v1.7.2/luci-i18n-parentcontrol-zh-cn_git-24.093.53077-0cf652c_all.ipk

opkg install luci-app-parentcontrol_1.7.1_all.ipk
opkg install luci-i18n-parentcontrol-zh-cn_git-24.093.53077-0cf652c_all.ipk

参考:https://github.com/sirpdboy/luci-app-parentcontrol

应用过滤(OAF)

插件安装说明特征库下载

wget http://111.230.32.167:8086/files/ipk/luci-app-oaf-helper_1.0.1_all.ipk

opkg install luci-app-oaf-helper_1.0.1_all.ipk

然后重新登陆页面,在服务中即可看到防沉迷助手,根据提示安装对应的版本即可。

网络唤醒

opkg update
opkg install luci-app-wol
opkg install luci-i18n-wol-zh-cn

配置主板驱动和有线网卡驱动

灰色网易云

https://github.com/UnblockNeteaseMusic/luci-app-unblockneteasemusic

如果报错dnsmasq相关问题,需要先写在dnsmasq,再安装dnsmasq-full

# 参考:https://github.com/allenkey666/openwrt-shadowsocksR-libev-full/issues/20
opkg remove dnsmasq && opkg install dnsmasq-full

另外:我尝试了IOS18安装的网易云APP,用不了这个,会提示网络连接问题。Windows下的UWP网易云可以。

科学上网

nikkinikki-org/OpenWrt-nikki: Transparent Proxy with Mihomo on OpenWrt.

路由器中使用Redir-Host和TPROXY代替Fake-ip和TUN - 薇尔薇

1.Openwrt‐nikki · levi882/Custom_OpenWrt-nikki_Rules Wiki

# 执行成功一次即可
wget -O - https://gh-proxy.com/https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/feed.sh | ash
# you can install from shell or `Software` menu in LuCI
opkg install nikki
opkg install luci-app-nikki
opkg install luci-i18n-nikki-zh-cn

# 卸载或重置
wget -O - https://gh-proxy.com/https://github.com/nikkinikki-org/OpenWrt-nikki/raw/refs/heads/main/uninstall.sh | ash

温度监控

https://github.com/izilzty/luci-app-temp-status

opkg update
wget --no-check-certificate -O /tmp/luci-app-temp-status_0.4.1-r1_all.ipk https://gh-proxy.org/https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-temp-status_0.4.1-r1_all.ipk
opkg install /tmp/luci-app-temp-status_0.4.1-r1_all.ipk
rm /tmp/luci-app-temp-status_0.4.1-r1_all.ipk
/etc/init.d/rpcd reload

wget --no-check-certificate -O /tmp/luci-i18n-temp-status-ru_0.4.1-r1_all.ipk https://gh-proxy.com/https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-temp-status-ru_0.4.1-r1_all.ipk
opkg install /tmp/luci-i18n-temp-status-ru_0.4.1-r1_all.ipk
rm /tmp/luci-i18n-temp-status-ru_0.4.1-r1_all.ipk

网络流量监控

timsaya/luci-app-bandix

wget --no-check-certificate -O /tmp/bandix_0.8.2-r1_aarch64_cortex-a53.ipk https://gh-proxy.com/https://github.com/timsaya/openwrt-bandix/releases/download/v0.8.2/bandix_0.8.2-r1_aarch64_cortex-a53.ipk
opkg install /tmp/bandix_0.8.2-r1_aarch64_cortex-a53.ipk

wget --no-check-certificate -O /tmp/luci-app-bandix_0.8.2-r1_all.ipk https://gh-proxy.com/https://github.com/timsaya/luci-app-bandix/releases/download/v0.8.2/luci-app-bandix_0.8.2-r1_all.ipk
opkg install /tmp/luci-app-bandix_0.8.2-r1_all.ipk

wget --no-check-certificate -O /tmp/luci-i18n-bandix-zh-cn_25.320.33662.61c987e_all.ipk https://gh-proxy.org/https://github.com/timsaya/luci-app-bandix/releases/download/v0.8.2/luci-i18n-bandix-zh-cn_25.320.33662.61c987e_all.ipk
opkg install /tmp/luci-i18n-bandix-zh-cn_25.320.33662.61c987e_all.ipk

配置HTTPS访问

OpenWrt 使用 Lets Encrypt 证书开启 HTTPS 访问

在 OpenWRT 上使用 acme.sh 配置 SSL 证书

使用ACME部署HTTPS证书

opkg install luci-app-uhttpd luci-i18n-uhttpd-zh-cn
opkg install acme luci-app-acme luci-i18n-acme-zh-cn acme-acmesh acme-acmesh-dnsapi

其他技能

实时抓包

opkg update
opkg install tcpdump

Windows 实测只能用 cmd 而不能用 Powershell

plink.exe -batch -ssh -pw 123456 root@192.168.1.1 "tcpdump -ni br-lan -s 0 -w - not port 22" | "D:\Program Files\Wireshark\Wireshark.exe" -k -i -
-pw 123456 : Openwrt的ssh密码
root@192.168.1.1 : Openwrt的USER@IP
-ni br-lan : Openwrt上要嗅探的网卡
"D:\Program Files\Wireshark\Wireshark.exe" : Windows中Wireshark的路径

源码编译插件包

OpenWrt 编译步骤与命令详解教程 - P3TERX ZONE

sirpdboy/luci-app-ddns-go: luci-app-ddns-go

iamxiaojianzheng/luci-app-temp-status: Temperature sensors data for the LuCI status page (OpenWrt webUI)