我真的是Wiregaurd的新手,但是我想在Ubuntu 18.04上本地使用Wiregaurd VPN设置链式设置,并使用2个运行Ubuntu 16.04的虚拟机。我的本地计算机将其称为客户端,第一个VM将其称为服务器,第二个VM将其称为Gate。
我的计算机的IP地址是192.168.100.72
我的服务器的IP地址是192.168.100.79
我的门的IP地址是192.168.100.80
我的目标是创建一个隧道,在该隧道中,我可以从通过服务器的客户端ping通网关。那是
客户端->服务器->门
这时,我可以从Server ping Gate,也可以从Client ping Server。
服务器->门和客户端->服务器
我的客户端wg0.conf文件看起来像这样
[Interface]
Address = 10.0.2.2/32
Address = fd86:ea04:1111::2/128
SaveConfig = true
PrivateKey =< Private key of client>
DNS = 10.0.0.1
[Peer]
PublicKey =< Public key of Gate >
AllowedIPs = 0.0.0.0/0
PersistentKeepalive =5
[Peer]
PublicKey = < Public key of server>
Endpoint = <server IP:2222>
AllowedIPs = 10.0.0.1/24
我的wg0.conf用于登机门外观
[Interface]
Address = 10.0.3.3/32
Address = fd86:ea04:1111::3/128
SaveConfig = true
PrivateKey = <gate's private key>
DNS = 10.0.0.1
[Peer]
PublicKey = < server's public key>
Endpoint = <servers IP address:2222>
PersistentKeepalive =5
AllowedIPs = 10.0.0.1/24
[Peer]
PublicKey = < Client public key>
Endpoint = <Client IP address:2222>
PersistentKeepalive =5
AllowedIPs = 0.0.0.0/0
我的服务器wg0.conf文件看起来是这样;
[Interface]
Address = 10.0.0.1/32
Address = fd86:ea04:1111::1/128
SaveConfig = true
PrivateKey = < server's private key>
DNS = 10.0.0.1
[Peer]
PublicKey = < client's public key>
Endpoint = < Client Public IP:2222>
PersistentKeepalive =5
AllowedIPs = 10.0.2.2/24
[Peer]
PublicKey = < gates public key>
Endpoint = 192.168.100.80:2222
Persistent
Keepalive =5
AllowedIPs = 0.0.0.0/0
我已经在服务器上运行了以下命令
echo "1 middleman" >> /etc/iproute2/rt_tables
ip route add 0.0.0.0/0 dev wg0 table middleman
ip rule add from <IP of the Client> lookup middleman
wg set gate0 peer < publickey of the gate > allowed-ips 0.0.0.0/0
客户端与门之间的ping不起作用,但是服务器与门之间的ping有效,而客户端与服务器之间的ping有效。我想对通过服务器的客户端执行ping操作。
我错过了一些非常关键的东西,但我不知道那是什么。我从事这项特殊任务已经好几天了,任何帮助将不胜感激