8.10. 使用命令行在 WireGuard 服务器上配置 firewalld
在 WireGuard 服务器上配置 firewalld 服务,允许来自客户端的传入连接。如果客户端需要使用服务器作为其默认网关,并通过隧道路由所有流量,则还要启用伪装。
流程
为
firewalld服务中的传入连接打开 WireGuard 端口:# firewall-cmd --permanent --add-port=51820/udp --zone=public如果您希望客户端通过隧道路由所有流量,并使用 WireGuard 服务器作为默认网关,请为
公共区启用伪装:# firewall-cmd --permanent --zone=public --add-masquerade重新加载
firewalld规则。# firewall-cmd --reload
验证
显示
public区域的配置:# firewall-cmd --list-all public (active) ... ports: 51820/udp masquerade: yes ...