Ubuntu 23.10导入.ovpn文件后无法连接的问题求助
Ubuntu 23.10导入.ovpn文件后无法连接的问题求助
各位好,我最近在Ubuntu 23.10上尝试用系统自带的VPN功能导入.ovpn文件,但始终无法成功连接,想请大家帮忙排查下问题。
我的操作步骤是这样的:
- 打开系统设置 → 网络 → 点击VPN右侧的“+”按钮
- 选择“从文件导入...”,找到我的.ovpn文件完成导入
- 导入过程看起来没问题,但点击连接后就是连不上
奇怪的是,同一台机器上的Windows虚拟机用OpenVPN客户端导入同一个.ovpn文件却能正常连接,所以肯定不是文件本身的配置问题。
我翻了一些老帖子,但大多是针对旧版本Ubuntu的,和现在的23.10不太匹配。想问下有没有朋友知道,是不是需要在VPN的高级设置里调整什么参数才能解决?
另外我也试过用命令行导入:
nmcli connection import type openvpn file <.ovpn file>
结果和GUI一样——导入成功,但连接失败,现象完全相同。
查看syslog时,我看到这条错误信息:
nm-openvpn[22624]: read UDPv4 [EHOSTUNREACH]: No route to host (fd=5,code=113)
不过我确认UFW没有启用,端口是开放的,而且Windows虚拟机能正常连,所以网络层面应该没问题。
后续更新
后来我换成了1193端口测试,用nc命令验证连通性是正常的:
~$ nc -v -u -z -w 3 <myIP> 1193 Connection to <myIP> 1193 port [udp/*] succeeded!
查看journal的日志输出,发现了关键错误:
Jan 29 16:46:49 markswift3 nm-openvpn[6429]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts Jan 29 16:46:49 markswift3 nm-openvpn[6429]: TCP/UDP: Preserving recently used remote address: [AF_INET]<myIP>:1193 Jan 29 16:46:49 markswift3 nm-openvpn[6429]: UDPv4 link local: (not bound) Jan 29 16:46:49 markswift3 nm-openvpn[6429]: UDPv4 link remote: [AF_INET]<myIP>:1193 Jan 29 16:46:55 markswift3 nm-openvpn[6429]: [server] Peer Connection Initiated with [AF_INET]<myIP>:1193 Jan 29 16:46:56 markswift3 nm-openvpn[6429]: AUTH: Received control message: AUTH_FAILED,Data channel cipher negotiation failed (no shared cipher) Jan 29 16:46:56 markswift3 nm-openvpn[6429]: SIGUSR1[soft,auth-failure] received, process restarting Jan 29 16:46:57 markswift3 nm-openvpn[6429]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts Jan 29 16:46:57 markswift3 nm-openvpn[6429]: TCP/UDP: Preserving recently used remote address: [AF_INET]<myIP>:1193 Jan 29 16:46:57 markswift3 nm-openvpn[6429]: UDPv4 link local: (not bound) Jan 29 16:46:57 markswift3 nm-openvpn[6429]: UDPv4 link remote: [AF_INET]<myIP>:1193 Jan 29 16:47:08 markswift3 systemd[1]: systemd-hostnamed.service: Deactivated successfully.
我的.ovpn文件内容如下(文件末尾附带了密钥):
client dev tun proto udp remote <myIP> 1193 resolv-retry infinite nobind persist-key persist-tun remote-cert-tls server auth SHA512 cipher AES-256-CBC ignore-unknown-option block-outside-dns verb 3
备注:内容来源于stack exchange,提问作者Mark Smith




