大网数据广告活动
服务器运维问答

OpenVPN - Client is not able to connect to the server from command line

· 52CE 我爱测

I set up an OpenVPN server myself. My client system is using Ubuntu 16.04. I can successfully connect the client to the VPN server using network-manager UI. But when I try to connect to the VPN from the terminal, it is not gettin…

问题原文

原帖链接 · AKA · CC BY-SA 3.0

I set up an OpenVPN server myself. My client system is using Ubuntu 16.04. I can successfully connect the client to the VPN server using network-manager UI. But when I try to connect to the VPN from the terminal, it is not getting connected.

This is the command I am using to connect:

sudo openvpn --config client1.ovpn

This is the log generated by running the command (last few lines):

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

Any clues on whats going wrong?

已采纳解答

原帖链接 · JesseCloutier · CC BY-SA 3.0

By the looks of your log your VPN is connecting successfully. So going on the assumption that you are unable to connect to whatever is on the remote side of your VPN it might be that network manager is setting your default route to be the VPN.

Try adding

redirect-gateway def1

To your client config to see if it resolves the issue. This option is outlined here: https://openvpn.net/index.php/open-source/documentation/howto.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。