使用Windows Server 2012 R2的OpenVPN站点到站点VPN隧道

这是我的客户端设置:

Site A Site B 192.168.2.0/24 192.168.0.0/24 Client A1 --|-- Server A Server B --|-- Client B1 | (192.168.2.2) (192.168.0.2) | | (10.8.0.6) (10.8.0.1) | Client A2 --|-- Router A ---- Internet ---- Router B --|-- Client B2 | (192.168.2.1) (192.168.0.254) | Client A3 --| |-- Client B3 

服务器A通过OpenVPN连接到服务器B,将两个站点相互连接。 服务器A和服务器B是Windows Server 2003,现在用Windows 2012 R2重新安装。 现在,用于使用2003configuration的路由不再起作用。

我在服务器上添加了以下路由:

 Server A: 192.168.0.0 mask 255.255.255.0 gw 10.8.0.1 Server B: 192.168.2.0 mask 255.255.255.0 gw 10.8.0.6 

通过DHCP推送给客户的路由:

 Clients A: 192.168.0.0 mask 255.255.255.0 gw 192.168.2.2 default gw 192.168.2.1 Clients B: 192.168.2.0 mask 255.255.255.0 gw 192.168.0.2 default gw 192.168.0.254 

服务器A上的OpenVPNconfiguration(OpenVPN客户端)

 client dev tun proto udp remote dyndns.example.com 1194 resolv-retry infinite nobind persist-key persist-tun ca ca.crt cert server-sb.crt key server-sb.key remote-cert-tls server comp-lzo verb 3 

服务器B(OpenVPN服务器)上的OpenVPNconfiguration

 port 1194 proto udp dev tun ca ca.crt cert server.crt key server.key # This file should be kept secret dh dh1024.pem server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt client-to-client keepalive 10 120 comp-lzo persist-key persist-tun status openvpn-status.log verb 3 

坪:

  • 服务器A – > 10.8.0.1 OK
  • 服务器B – > 10.8.0.6确定
  • 服务器A – > 192.168.2.2失败
  • 服务器B – > 192.168.0.2失败
  • 任何设备A – >任何设备B故障
  • 任何设备B – >任何设备A失败

在testing过程中,所有Windows机器上的防火墙都被禁用。 我的诊断是VPN隧道工作,但问题是要么在OpenVPN的设置,防止路由,或我的路由表中的东西closures。

我敢肯定,这与Windows 2003的configuration相同,每台设备都可以访问这两个站点上的其他设备。

在路由和远程访问中启用IPv4转发和LAN路由。

在阅读了很多手册之后,我发现:在OpenVPN服务器configuration中,我irouteiroute指令。

将这些条目添加到configuration后,它工作:

为server.ovpn

 client-config-dir ccd route 192.168.0.0 255.255.255.0 10.8.0.1 

CCD \客户端

 iroute 192.168.2.0 255.255.255.0