我正在尝试几天来解决我的问题。我已经在 windows 上使用 openvpn 有一段时间了,在用 ubuntu 13.10 替换 windows 之后,我很高兴看到 openvpn 也可用于 ubuntu。
我从 Windows 和 /var/log/syslog 中复制了我的设置,我看到我的连接已成功创建。但是,无论我做什么,我都无法设置路线。在 Windows 中,这只是由脚本完成,其工作方式如下(IP 地址略有不同,因为我必须将它们保密):
c:\windows\system32\route.exe delete 55.78.16.20
c:\windows\system32\route.exe delete 55.78.16.0
del tmp.cmd
c:\windows\system32\route.exe print | grep.exe -m1 "^ *0.0.0.0" | sed.exe s/\x20\x20*/\t/g | cut.exe -f4 | sed "s/.*/c:\\windows\\system32\\route.exe add 55.78.16.20 mask 255.255.255.255 &/" > tmp.cmd
c:\windows\system32\route.exe print | grep "^ *172.16.0.1" | sed s/\x20\x20*/\t/g | cut -f4 | sed "s/.*/c:\\windows\\system32\\route.exe add 55.78.16.0 mask 255.255.255.0 &/" >> tmp.cmd
tmp.cmd
Run Code Online (Sandbox Code Playgroud)
设置连接并执行上述脚本后,与我的服务器的连接通过 VPN,而其他一切正常。
由于这个脚本使用了 grep、sed 和 …