我有两个openvpn客户端和一个使用共享密钥的服务器。 我有两个客户端在ccd目录中指定的内部路由,但是当它们连接时,服务器只为其中一个创build内部路由,尽pipe日志说它正在创build两者。 客户端和服务器都使用“–script-security 2”命令行选项。 任何人都可以想到为什么会这样做?
我的ccd文件是:
客户端1:
iroute 192.168.0.0 255.255.255.0
客户机程序:
iroute 10.0.1.0 255.255.255.0
我的日志文件显示以下(裁剪):
May 3 17:22:59 kino openvpn[2416]: 118.208.58.60:48730 [client1] Peer Connection Initiated with 118.208.58.60:48730 May 3 17:22:59 kino openvpn[2416]: client1/118.208.58.60:48730 OPTIONS IMPORT: reading client specific options from: ccd/client1 May 3 17:22:59 kino openvpn[2416]: client1/118.208.58.60:48730 MULTI: Learn: 192.168.150.10 -> client1/118.208.58.60:48730 May 3 17:22:59 kino openvpn[2416]: client1/118.208.58.60:48730 MULTI: primary virtual IP for client1/118.208.58.60:48730: 192.168.150.10 May 3 17:22:59 kino openvpn[2416]: client1/118.208.58.60:48730 MULTI: internal route 192.168.0.0/24 -> client1/118.208.58.60:48730 May 3 17:22:59 kino openvpn[2416]: client1/118.208.58.60:48730 MULTI: Learn: 192.168.0.0/24 -> client1/118.208.58.60:48730 May 3 17:23:01 kino openvpn[2416]: client1/118.208.58.60:48730 PUSH: Received control message: 'PUSH_REQUEST' May 3 17:23:01 kino openvpn[2416]: client1/118.208.58.60:48730 SENT CONTROL [client1]: 'PUSH_REPLY,route 192.168.150.1,topology net30,ping 10,ping-restart 120,ifconfig 192.168.150.10 192.168.150.9' (status=1) May 3 17:21:36 kino openvpn[2416]: 124.148.1.90:59277 [client2] Peer Connection Initiated with 124.148.1.90:59277 May 3 17:21:36 kino openvpn[2416]: client2/124.148.1.90:59277 OPTIONS IMPORT: reading client specific options from: ccd/client2 May 3 17:21:36 kino openvpn[2416]: client2/124.148.1.90:59277 MULTI: Learn: 192.168.150.14 -> client2/124.148.1.90:59277 May 3 17:21:36 kino openvpn[2416]: client2/124.148.1.90:59277 MULTI: primary virtual IP for client2/124.148.1.90:59277: 192.168.150.14 May 3 17:21:36 kino openvpn[2416]: client2/124.148.1.90:59277 MULTI: internal route 10.0.1.0/24 -> client2/124.148.1.90:59277 May 3 17:21:36 kino openvpn[2416]: client2/124.148.1.90:59277 MULTI: Learn: 10.0.1.0/24 -> client2/124.148.1.90:59277 May 3 17:21:39 kino openvpn[2416]: client2/124.148.1.90:59277 PUSH: Received control message: 'PUSH_REQUEST' May 3 17:21:39 kino openvpn[2416]: client2/124.148.1.90:59277 SENT CONTROL [client2]: 'PUSH_REPLY,route 192.168.150.1,topology net30,ping 10,ping-restart 120,ifconfig 192.168.150.14 192.168.150.13' (status=1)
在两个客户端连接之后,路由表如下所示:
192.168.150.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0 203.209.167.192 0.0.0.0 255.255.255.224 U 0 0 0 eth0 192.168.150.0 192.168.150.2 255.255.255.0 UG 0 0 0 tun0 192.168.0.0 192.168.150.2 255.255.255.0 UG 0 0 0 tun0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 203.209.167.193 0.0.0.0 UG 0 0 0 eth0
正如你所看到的,它创build了到192.168.0.0/24(client1)的路由,但是不到10.0.1.0/24(client2),尽pipe日志说它已经被创build。 任何build议为什么?
有人在IRC指出,我需要在服务器configuration文件中手动声明路由。 我这样做,它启动时创build的路线。 我想我不太明白这是什么意思。
我认为文档的范围部分详细解释了它。
我也为此而挣扎。 在我的设置中,OpenVPN服务器是一个独立于路由器的机器,不pipe我做了什么configuration,我都无法ping通ping到networking上的其他机器。 最终我发现这个线程: http : //ubuntuforums.org/archive/index.php/t-951733.html
这就明确了实际需要的是路由器上的一个静态路由,以允许数据包尝试返回到OVPN服务器路由到该机器。
所以,例如:
Router: 192.168.9.1 OVPN Server: 192.168.9.254 OVPN subnet: 10.101.1.0/24 Client Subnet: 192.168.231.0/24
为了从192.168.231.x ping到192.168.9.x(不是254),我需要确定这三件事情已经完成:
在OVPN ccd / client.conf中创build“iroute 192.168.231.0 255.255.255.0”。 (另外:OVPN server.conf中的“push”路由192.168.9.0 255.255.255.0“
(丢失的成分)在路由器上添加10.101.1.0/24 gw 192.168.9.254的静态路由。