本文最后更新于 779 天前,其中的信息可能已经有所发展或是发生改变。
- 软件下载,单击此处,找到最新的安装包,复制链接替换下面wget后链接进行下载
wget https://github.com/adyanth/openwrt-tailscale-enabler/releases/download/v1.32.2-98e126e-autoupdate/openwrt-tailscale-enabler-v1.32.2-98e126e-autoupdate.tgz
- 解压
tar x -zvC / -f openwrt-tailscale-enabler-v1.32.2-98e126e-autoupdate.tgz
- 安装依赖
opkg update
opkg install libustream-openssl ca-bundle kmod-tun
- 设置开机启动,并验证
/etc/init.d/tailscale enable
ls /etc/rc.d/S*tailscale*
- 启动tailscale
/etc/init.d/tailscale start
- 获取登录链接,配置软路由
tailscale up
复制显示的地址,并在浏览器中打开,使用谷歌或微软帐号登录Tailscale的管理主页进行验证
- 开启子网网路由,子网地址根据openwrt的lan口地址修改
tailscale up --advertise-routes=192.168.18.0/24 --accept-dns=false
在Tailscale的管理页面上,单击设备列表右侧的更多图标,禁用密钥过期,并打开子网路由
- 添加接口
在OpenWrt上新建一个接口,协议选静态地址,设备选tailscale0,地址为Taliscale管理页面上分配的地址,掩码255.0.0.0。防火墙区域选lan区域
- 添加防火墙规则
将以下内容,加到防火墙的自定义规则当中,并重启防火墙
iptables -I FORWARD -i tailscale0 -j ACCEPT
iptables -I FORWARD -o tailscale0 -j ACCEPT
iptables -t nat -I POSTROUTING -o tailscale0 -j MASQUERADE