【求助】wireguard组网问题

15次阅读

共计 681 个字符,预计需要花费 2 分钟才能阅读完成。

本帖最后由 JustForFun 于 2024-2-2 20:45 编辑

想用京东云服务器作为国内两处异地 nat 组网中转端,配置好 wireguard 后发现在京东云 ping 得同两地 nat,但是两地 nat 无法互通,已经在服务器配置了 ipv4 转发,求问大佬这是什么问题,感觉像是京东云的问题.
云服务器上的配置如下
#公网 gateway 配置
[Interface]
#wireguard 网段
Address = 10.0.2.1/32
ListenPort = 12345
PrivateKey =
#通过 `ip addr` 获得主网卡名称,一般为 eth0
#放行虚拟网卡
PostUp   = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostUp = sysctl -w net.ipv4.ip_forward=1
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE

[Peer]
PublicKey =
AllowedIPs = 10.0.2.6/32, 192.168.122.1/24
PersistentKeepalive = 25
[Peer]
PublicKey =
AllowedIPs = 10.0.2.7/32,192.168.123.1/24
PersistentKeepalive = 25

正文完
 0