试图在两个openvpn客户端之间路由

我在10.0.1.0(client1)和192.168.0.0(client2)子网上有两个openvpn客户端,服务器的openvpn连接的IP为192.168.150.1

服务器启用了IP转发。

目前client1的vpn ip是192.168.150.10,PtP ip是192.168.150.9。我在client1上创build了以下静态路由:

route add -net 10.0.1.0 netmask 255.255.255.0 gw 192.168.150.9 

client1上的路由表如下所示:

 Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.150.9 0.0.0.0 255.255.255.255 UH 0 0 0 tun0 192.168.150.1 192.168.150.9 255.255.255.255 UGH 0 0 0 tun0 10.0.1.0 192.168.150.9 255.255.255.0 UG 0 0 0 tun0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 

我认为这是正确的,以允许客户端1的stream量到达客户端2的networking上的计算机,但它不起作用。 是192.168.150.9(PtP地址)正确的路由通过? 我尝试使用192.168.150.1,但我无法创build路由。

我也尝试添加到服务器configuration,而不是:

 push "route 192.168.0.0 255.255.255.0" push "route 10.0.1.0 255.255.255.0" 

它在client1上创build以下路由:

 10.0.1.0 192.168.150.9 255.255.255.0 UG 0 0 0 tun0 

但它不起作用。 当然,“推”路线的例子是正确的? 还有什么我需要做的吗? 没有在服务器上? 只需启用IP转发?

防火墙日志中是否有任何内容? 你能确切地使用tcpdump诊断交通刹车的位置吗? 你在用什么系统(linux,freebsd,哪个版本)?

也可以在服务器configuration(从OpenVPN 文档 )尝试这个:

 # Uncomment this directive to allow different # clients to be able to "see" each other. # By default, clients will only see the server. # To force clients to only see the server, you # will also need to appropriately firewall the # server's TUN/TAP interface. ;client-to-client 

为了让我的客户通过OpenVPN服务器相互通话,我需要在我的configuration中取消client-to-client注释,就像@kyrisu所build议的那样,但是我还必须将topology subnet添加到我的服务器configuration中:

 # Configure server mode and supply a VPN subnet # for OpenVPN to draw client addresses from. # The server will take 10.8.0.1 for itself, # the rest will be made available to clients. # Each client will be able to reach the server # on 10.8.0.1. Comment this line out if you are # ethernet bridging. See the man page for more info. server 10.8.0.0 255.255.255.0 topology subnet