我自己搭建了一个OpenVPN服务器,我的客户端系统是Ubuntu 16.04。
我可以成功连接客户端使用 UI 连接到 VPN 服务器network-manager
。但是当我尝试从终端连接到 VPN 时,却无法连接。
这是我用来连接的命令:
sudo openvpn --config client1.ovpn
这是运行命令生成的日志(最后几行):
Tue Aug 22 15:42:17 2017 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Tue Aug 22 15:42:17 2017 PUSH: Received control message: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5'
Tue Aug 22 15:42:17 2017 OPTIONS IMPORT: timers and/or timeouts modified
Tue Aug 22 15:42:17 2017 OPTIONS IMPORT: --ifconfig/up options modified
Tue Aug 22 15:42:17 2017 OPTIONS IMPORT: route options modified
Tue Aug 22 15:42:17 2017 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=wlp2s0 HWADDR=b0:c0:90:a4:4e:9c
Tue Aug 22 15:42:17 2017 TUN/TAP device tun0 opened
Tue Aug 22 15:42:17 2017 TUN/TAP TX queue length set to 100
Tue Aug 22 15:42:17 2017 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Tue Aug 22 15:42:17 2017 /sbin/ip link set dev tun0 up mtu 1500
Tue Aug 22 15:42:17 2017 /sbin/ip addr add dev tun0 local 10.8.0.6 peer 10.8.0.5
Tue Aug 22 15:42:17 2017 /etc/openvpn/update-resolv-conf tun0 1500 1572 10.8.0.6 10.8.0.5 init
Tue Aug 22 15:42:17 2017 /sbin/ip route add 10.8.0.1/32 via 10.8.0.5
Tue Aug 22 15:42:17 2017 GID set to nogroup
Tue Aug 22 15:42:17 2017 UID set to nobody
Tue Aug 22 15:42:17 2017 Initialization Sequence Completed
有任何线索表明哪里出了问题吗?
答案1
从日志来看,您的 VPN 连接成功。因此,假设您无法连接到 VPN 远端的任何内容,则可能是网络管理员将您的默认路由设置为 VPN。
尝试添加
redirect-gateway def1
转到您的客户端配置,查看是否能解决问题。此选项概述如下:https://openvpn.net/index.php/open-source/documentation/howto.html