OpenWrt 手动安装 EasyTier

最近在 OpenWrt 上跑 EasyTier,对 EasyTier 的 LuCI 插件加入**AI“味真族”**感到不爽,因此需要研究怎么手动安装。

为什么不用官方 LuCI?

  1. easytier-cli 不支持 OpenWrt 的 /etc/init.d(procd) 自动配置,逼你用它的 LuCI 受着呗🥴(bushi)
  2. luci-app-easytier 这个 GitHub 仓库,但是我个人觉的这个写的太乱太杂,首页 AI“味真足”🤢(之前好好的,突然加了这个“神金”AI主页💩,真的yue了🤮),还带上传功能👿,感觉路由器被强j了
  3. 有中心配置服务器,不需要配置,直接 easytier-core -w tcp://xxx.xxx.xxx.xxx:xxxxx/xxxx 就可以启,没必要OpenWrt 上面调,加载状态信息还要加载半天🤥
  4. 之前用 EasyTier LuCI 改完配置给我自动清空 /etc/config/network 过💥🧨,有心理阴影😰,一日被蛇咬,十年怕井绳🐍

下载安装 EasyTier 核心

这里我们直接下载、解压、安装 GitHub Release 里面的二进制。

确认路由器架构

使用 uname -m 等命令确认路由器架构🤖:

1
2
root@ImmortalWrt:~# uname -m
x86_64

下载对应的 EasyTier 二进制

这边建议使用最新版因为稳定版肯定有最新测试版修了的严重bug😅()

准备一下依赖(这里我用的是 24.10+opkg,如果是新版得用 apk add 命令安装):

1
2
opkg update
opkg install curl unzip kmod-tun

下载(个人喜欢curlwget 应该 busybox 会自带):

1
2
3
4
5
6
# ET_VERSION="2.6.4"
ET_VERSION=$(curl -sL https://api.github.com/repos/EasyTier/EasyTier/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
ET_TARGET="x86_64"
ET_ZIPURL="https://github.com/EasyTier/EasyTier/releases/download/v$ET_VERSION/easytier-linux-$ET_TARGET-v$ET_VERSION.zip"
# wget "$ET_ZIPURL" -O /tmp/et.zip
curl "$ET_ZIPURL" -Lo /tmp/et.zip

解压并安装 EasyTier 到系统

unzip -l look look内容👀,不然到时候解压一锅糟🤯:

1
2
3
4
5
6
7
8
9
10
11
root@ImmortalWrt:~# unzip -l /tmp/et.zip
Archive:  /tmp/et.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  05-12-2026 21:43   easytier-linux-x86_64/
  7558408  05-12-2026 21:26   easytier-linux-x86_64/easytier-core
  7103316  05-12-2026 21:26   easytier-linux-x86_64/easytier-web
  7749796  05-12-2026 21:18   easytier-linux-x86_64/easytier-web-embed
  3095200  05-12-2026 21:24   easytier-linux-x86_64/easytier-cli
---------                     -------
 25506720                     5 files

可以看到这个压缩包里面有个文件夹,然后执行 unzip /tmp/et.zip -d /tmp 解压📦:

1
2
3
4
5
6
7
root@ImmortalWrt:~# unzip /tmp/et.zip -d /tmp
Archive:  /tmp/et.zip
   creating: /tmp/easytier-linux-x86_64/
  inflating: /tmp/easytier-linux-x86_64/easytier-core
  inflating: /tmp/easytier-linux-x86_64/easytier-web
  inflating: /tmp/easytier-linux-x86_64/easytier-web-embed
  inflating: /tmp/easytier-linux-x86_64/easytier-cli

这里我们不需要所有的文件,只要一个easytier-core 即可,给它拷到系统里面(如果你要其他的也可以自己拷):

1
2
3
ET_TARGET="x86_64"
cp /tmp/easytier-linux-$ET_TARGET/easytier-core /usr/sbin/easytier-core
chmod +x /usr/sbin/easytier-core

验证一下能不能用🧐:

1
2
3
4
root@ImmortalWrt:~# which easytier-core
/usr/sbin/easytier-core
root@ImmortalWrt:~# easytier-core --version
easytier-core 2.6.4-8428a89d

要是这里打不开了,说明你下错了架构,折回去重新下🤣。

删除安装文件🗑️:

1
2
ET_TARGET="x86_64"
rm -rf /tmp/easytier-linux-$ET_TARGET /tmp/et.zip

创建 EasyTier 配置

如果有 EasyTier Web 中心配置服务器可以跳过♿️,这个不是重点😶‍🌫️。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
mkdir -p /etc/easytier
cat > /etc/easytier/config.toml << 'EOF'
instance_name = "openwrt-node"
hostname = "openwrt"
ipv4 = "10.144.144.1"

[network_identity]
network_name = "你的网络名"
network_secret = "你的密钥"

[[peer]]
uri = "tcp://1.2.3.4:11010"

EOF

创建 init.d 自启服务

OpenWrt 的 init 脚本需要 source /etc/rc.common 作为 wrapper,脚本放在 /etc/init.d/ 下,用 enable 命令创建 /etc/rc.d/ 中的符号链接实现开机自启。TL;DR

参考:https://openwrt.org/docs/techref/initscripts

下面是用配置文件的情况:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
cat > /etc/init.d/easytier << 'EOF'
#!/bin/sh /etc/rc.common

START=95
STOP=10
USE_PROCD=1

PROG=/usr/sbin/easytier-core
CONFIG=/etc/easytier/config.toml

start_service() {
    procd_open_instance
    procd_set_param command "$PROG" --config-file "$CONFIG"
    procd_set_param respawn 3600 5 5
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_close_instance
}

reload_service() {
    procd_kill easytier
    start_service
}
EOF

chmod +x /etc/init.d/easytier

如果有 EasyTier Web 中心配置服务器,不需要配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cat > /etc/init.d/easytier << 'EOF'
#!/bin/sh /etc/rc.common

START=95
STOP=10
USE_PROCD=1

PROG=/usr/sbin/easytier-core

start_service() {
    procd_open_instance
    procd_set_param command "$PROG" -w tcp://xxx.xxx.xxx.xxx:xxxxx/xxxx # 这里换成你的中心配置服务器
    procd_set_param respawn 3600 5 5
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_close_instance
}
EOF

chmod +x /etc/init.d/easytier

启用并启动服务

service easytier xxx 命令和 LuCI Web UI 里面那个系统->启动项应该也能用。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 开机自启
/etc/init.d/easytier enable

# 立即启动
/etc/init.d/easytier start

# 查看状态
/etc/init.d/easytier status

# 重启服务器
/etc/init.d/easytier restart

# 停止服务
/etc/init.d/easytier stop

# 禁用服务
/etc/init.d/easytier disable

# 看日志(procd 会转发到 logd)
logread | grep easytier

sysupgrade 持久化

如果使用 sysupgrade 升级固件⬆️,需要在 /etc/sysupgrade.conf 中配置要保留的文件,否则升级后会丢失配置😨

参考:https://openwrt.org/docs/guide-user/installation/generic.sysupgrade

把以下内容追加到 /etc/sysupgrade.conf

1
2
3
/usr/sbin/easytier-core
/etc/easytier/
/etc/init.d/easytier

不过搞不好升级以后硬件ID又变了,会获取不到配置,要么你自己弄个文件存一下,不要默认 /etc/machine-id,要么你就不要远程通过 EasyTier 网络升级,反正我不敢这么做🫠

放行 EasyTier 的 WAN 入站端口

正常情况下,OpenWrt 对 WAN 默认封禁入站,外部无法访问到 EasyTier 核心监听的端口,会导致无法打洞直连,因此需要增加防火墙规则。

如果你的环境本身就无法P2P直连,那这步可以不做🤨。

假设配置文件片段为:

1
2
3
4
5
6
7
listeners = [
    "tcp://0.0.0.0:11010",
    "udp://0.0.0.0:11010",
    "wg://0.0.0.0:11011",
    "quic://0.0.0.0:11012",
    "faketcp://0.0.0.0:11013",
]

执行UCI命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 端口:协议 列表
ports="11010:tcp 11010:udp 11011:udp 11012:udp 11013:tcp"
for p in $ports;do
  port=${p%:*};proto=${p#*:}
  uci add firewall rule
  uci set firewall.@rule[-1].name="easytier-$proto-$port"
  uci set firewall.@rule[-1].src=wan
  uci set firewall.@rule[-1].dest_port=$port
  uci set firewall.@rule[-1].proto=$proto
  uci set firewall.@rule[-1].target=ACCEPT
done

uci commit firewall
service firewall restart

/etc/config/firewall

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
config rule
    option name 'easytier-tcp-11010'
    option src 'wan'
    option dest_port '11010'
    option proto 'tcp'
    option target 'ACCEPT'

config rule
    option name 'easytier-udp-11010'
    option src 'wan'
    option dest_port '11010'
    option proto 'udp'
    option target 'ACCEPT'

config rule
    option name 'easytier-wg-11011'
    option src 'wan'
    option dest_port '11011'
    option proto 'udp'
    option target 'ACCEPT'

config rule
    option name 'easytier-quic-11012'
    option src 'wan'
    option dest_port '11012'
    option proto 'udp'
    option target 'ACCEPT'

config rule
    option name 'easytier-faketcp-11013'
    option src 'wan'
    option dest_port '11013'
    option proto 'tcp'
    option target 'ACCEPT'

然后执行:service firewall restart 重启防火墙。

LuCI Web UI

网络 → 防火墙 → 通信规则 → 添加,按下表逐条填写,每条保存后再加下一条:

Name 协议 源区域 目标端口 动作
easytier-tcp-11010 TCP wan 11010 接受
easytier-udp-11010 UDP wan 11010 接受
easytier-wg-11011 UDP wan 11011 接受
easytier-quic-11012 UDP wan 11012 接受
easytier-faketcp-11013 TCP wan 11013 接受

填完所有条目后点右下角保存并应用

不用命令,要加这么多,手都点麻了🤡,我觉得还是用命令刷吧😂

增加EasyTier防火墙区域

OpenWrt 系统默认防火墙区域转发策略为 DROP(丢弃)。EasyTier 虚拟网卡(默认设备名 tun0)初始无绑定任何防火墙区域,所有流量会被系统默认拦截,导致内网互通、设备访问异常。所以需要增加防火墙区域转发规则📝。如果你不做这步就能访问内网,那应该是用了用户态协议、软件NAT。

下面提供了UCI命令和改配置文件两种方式:

配置 EasyTier 网络接口

首先需要配置网络接口(interface),将tun0虚拟网卡设备绑定到逻辑接口,才能被 OpenWrt 管理。

/etc/config/network 里加上对应接口 easytier

1
2
3
config interface 'easytier'
    option device 'tun0'
    option proto 'none'

对应 UCI 命令:

1
2
3
4
5
6
7
# 新建 easytier 网络接口,绑定 tun0 虚拟网卡,无IP协议
uci set network.easytier='interface'
uci set network.easytier.device='tun0'
uci set network.easytier.proto='none'

# 保存网络配置
uci commit network

当然也可以 LuCI Web UI 里面自己加,我觉得还是命令刷方便🤓。

配置 EasyTier 防火墙区域及双向转发

这里解释一下一些概念:

  • 入站:允许区域(内的主机)访问本机(路由器)
  • 出站:允许本机(路由器)访问区域(内的主机)
  • 转发:允许区域(内的主机)通过本机(路由器)访问其他区域(内的主机)
  • IP 动态伪装:在区域通过本机访问其他区域时进行网络地址转换(NAT)

/etc/config/firewall 追加:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 新建 easytier 区域
config zone
    option name 'easytier'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'ACCEPT'
    list network 'easytier'   # 对应 /etc/config/network 里的接口名

# 允许 easytier ↔ lan 双向转发
config forwarding
    option src 'easytier'
    option dest 'lan'

config forwarding
    option src 'lan'
    option dest 'easytier'

对应 UCI 命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 新建 easytier 防火墙区域,放行所有入站、出站、转发流量
uci set firewall.easytier='zone'
uci set firewall.easytier.name='easytier'
uci set firewall.easytier.input='ACCEPT'
uci set firewall.easytier.output='ACCEPT'
uci set firewall.easytier.forward='ACCEPT'
uci add_list firewall.easytier.network='easytier'

# 配置 easytier 访问 LAN 区域转发
uci set firewall.fwd_easytier_lan='forwarding'
uci set firewall.fwd_easytier_lan.src='easytier'
uci set firewall.fwd_easytier_lan.dest='lan'

# 配置 LAN 访问 easytier 区域转发(双向互通)
uci set firewall.fwd_lan_easytier='forwarding'
uci set firewall.fwd_lan_easytier.src='lan'
uci set firewall.fwd_lan_easytier.dest='easytier'

# 保存防火墙配置
uci commit firewall

你可能需要根据实际情况更改一下你的防火墙区域互访配置,比如说 lan 不能访问 easytier 区域。这一步可能在 LuCI Web UI 配置起来比较直观。

配置完后在EasyTier配置里面勾选上“系统转发”,性能可能会好些,也可能更差(Bug)

应用配置

重启网络、防火墙服务使配置生效:

1
2
/etc/init.d/network restart
/etc/init.d/firewall restart

个人感受

这些插件其实就是个守护进程的事,不需要可视化管理的,以后能自己手搓就尽量避免插件,尤其是 APK 以后的 OpenWrt。手搓配置+AI帮写 init.d 📃,要是有 Docker 🐳 的话用 Docker Compose。OpenWrt 下的组网/内穿插件,我用过的感觉就 Zerotier 的 LuCI 插件我还能勉强接受,其他 Frp、Tailscale 的,感觉一个能打的都没有,连上游更新了配置,几年都跟不上,比如那个 Frp LuCI 还在用 ini。EasyTier 的这个 LuCI 功能其实还行,但就是首页太杂了,之前都没这么花里胡哨。

总之还是希望这些插件能越做越好,OpenWrt 路由器上跑组网插件还是比较正常的,这些东西放普通 Linux 发行版下反倒更难管理。