Windows 7上的OpenVPN客户端 – 无法从configuration脚本添加路由

我从Windows 7笔记本电脑连接到openvpn服务器,无法自动添加路由。 在我的脚本中,我有一行:

路由“路由添加192.168.33.0掩码255.255.255.0 10.0.33.1”

但是连接build立后有一个错误信息:

Sat Feb 06 20:30:07 2010 us=974000 openvpn_execve: CreateProcess route failed: Cannot find file specified. (errno=2) Sat Feb 06 20:30:07 2010 us=989000 Route script failed: external program did not execute -- returned error code -1 

openvpn.exe以pipe理员身份运行。 有任何想法吗?

呃,终于find了一个解决scheme(特定于Windows)。

放入OpenVPN客户端configuration参数:

 script-security 2 system 

来自openvpn.net手册( https://community.openvpn.net/openvpn/wiki/Openvpn22ManPage )的说明解释说:

–script-security level [method]这个指令提供了对OpenVPN使用外部程序和脚本的策略级控制。 较低的价值观更具限制性,价值较高的则更宽容。 关卡设置:

 0 -- Strictly no calling of external programs. 1 -- (Default) Only call built-in executables such as ifconfig, ip, route, or netsh. 2 -- Allow calling of built-in executables and user-defined scripts. 3 -- Allow passwords to be passed to scripts via environmental variables (potentially unsafe). 

方法参数指示OpenVPN如何调用外部命令和脚本。 方法的设置:

 execve -- (default) Use execve() function on Unix family OSes and CreateProcess() on Windows. system -- Use system() function (deprecated and less safe since the external program command line is subject to shell expansion). 

–script-security选项是在OpenVPN 2.1_rc9中引入的。 为了configuration文件与以前的OpenVPN版本兼容,请使用:– --script-security 3 system

更好地使用:

路由192.168.33.0 255.255.255.0 10.0.33.1

这种方式路由将被添加和删除,当你连接和断开VPN

您需要运行您的OpenVNP客户端作为pipe理员命令运行它的工作。