我有一个星型拓扑的 wireguard 设置:
主机 A 正在运行用于测试的 Web 服务 [Xampp]
- 从主机 B ping 到主机 A ping 10.0.0.5 – OK
- 从主机 A ping 到主机 B ping 10.0.0.4 – OK
- 从主机 B ping 到 A 到本地 LAN 接口 ping 192.168.1.100 - NOK
- 从主机 A ping 到主机 B 再到本地 LAN 接口 ping 192.168.0.20 - NOK
- 通过 10.0.0.5 从主机 B 到主机 A 的 RDP 运行正常 - 没问题
- http://10.0.0.5从主机 B 到主机 A 不起作用 - NOK
主机 A
netsh interface ipv4 set subinterface "wireguard" mtu=1280 store=persistent
主机B
netsh interface ipv4 set subinterface "wireguard" mtu=1280 store=persistent
无法访问 LAN 接口(LAN 子网)
我的配置文件:
服务器
[Interface]
PrivateKey =
ListenPort = 6543
DNS = 8.8.8.8
PreUp = sysctl -w net.ipv4.ip_forward=1
PostUp = iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -o wg0 -j ACCEPT
[Peer]
PublicKey =
AllowedIPs = 10.0.0.5/32
AllowedIPs = 192.168.1.100/32
[Peer]
PublicKey =
AllowedIPs = 10.0.0.4/32
AllowedIPs = 192.168.0.20/32
主机 A
[Interface]
PrivateKey =
Address = 10.0.0.5/32
DNS = 8.8.8.8
[Peer]
AllowedIPs = 10.0.0.0/29, 192.168.1.100/32, 192.168.0.20/32, 0.0.0.0/1
Endpoint = cloud-wg-server:6543
主机B
[Interface]
PrivateKey =
Address = 10.0.0.4/32
DNS = 8.8.8.8
[Peer]
AllowedIPs = 10.0.0.0/29, 192.168.1.100/32, 192.168.0.20/32, 0.0.0.0/1
Endpoint = cloud-wg-server:6543