Loading... [ ](https://www.bilibili.com/video/BV1Ka411q7hx/) # 序 TrueNAS SCALE实际上系统里已经有了wireguard,只不过webUI没有开发。所以我们利用一个开源的wireguard-UI可视化生成配置,然后在系统上启用wireguard # 安装 我们先使用 custom-app 安装UI  - Container Repository:ngoduykhanh/wireguard-ui - Container Tag:latest  设置账号密码 - WGUI_USERNAME:admin - WGUI_PASSWORD:12345678  健康检查关闭  Target Port:除了5000都可以 端口大家可以随便  开启主机网络  挂载系统wireguard配置目录 - hostPath:/etc/wireguard - mountPath:/etc/wireguard  - mountPath:/app/db   给网络管理权限`NET_ADMIN` 等待部署成功 # 配置 安装成功后浏览器输入NASIP:5000,访问UI  - Post Up Script:`iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE` - Post Down Script:`iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o br0 -j MASQUERADE` **注意:把br0改成自己的网口** 点击save,点击apply config  点击新建一个客户端,创建好之后要apply config # 启动  启动 ``` wg-quick up wg0 ``` 关闭 ``` wg-quick down wg0 ``` 每次修改配置都需要重启一下,可以写个脚本 ``` #!/bin/bash wg-quick down wg0 wg-quick up wg0 ``` # 排错 如果有报错就把默认的IP段,端口换换不要有重复  最后修改:2022 年 06 月 02 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 3 如果觉得我的文章对你有用,请随意赞赏
4 条评论
我没有 Add Capabilities 的选项,无法Add NET_ADMIN
我的custom-app version 是 0.20.2297_7.0.23
在那个Capabilities 的地方只有 Supplemental Groups
Add Supplemental Groups, 只能输入号码, 不能加 NET_ADMIN
Wireguard UI 能启动,可以用。只是不能看见Status
我的Truenas scale Version 是 22.12.0
谢谢你分享~跟着做也成功了链接。
可是每当我重启truenas wg0.conf 文件会消失。
然后需要手动创建 和 启动wg-quick。有什么方法可以然这操作变得自动吗?
I have managed to do it in the following way and it works.
create two Init/Shutdown Scripts
Type: Command Command: sudo -u root /usr/bin/wg-quick down wg01.- Description: Wireguard Down
2.- Description: Wireguard Up
Type: Command Command: sudo -u root cp /root/wireguard/wg0.conf /etc/wireguard/ ; /usr/bin/wg-quick up wg0In the Wireguard interface, I've set it to save the wg0.conf file in /root/wireguard/
This is how it works for me, I hope it works for you.
不能