我正在尝试使用 OpenVPN 建立 VPN 隧道来访问远程 Kubernetes 集群。连接本身可以建立,并且我被分配了一个 IP 地址。
连接日志:
Sat Apr 27 12:42:39 2019 OpenVPN 2.4.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep 5 2018 Sat Apr 27 12:42:39 2019 library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.08 Sat Apr 27 12:42:39 2019 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info. Sat Apr 27 12:42:39 2019 TCP/UDP: Preserving recently used remote address: [AF_INET] ADDR Sat Apr 27 12:42:39 2019 Attempting to establish TCP connection with [AF_INET]ADDR [nonblock] Sat Apr 27 12:42:40 2019 TCP connection established with [AF_INET]ADDR Sat Apr 27 12:42:40 2019 TCP_CLIENT link local: (not bound) Sat Apr 27 12:42:40 2019 TCP_CLIENT link remote: [AF_INET]ADDR Sat Apr 27 12:42:40 2019 WARNING: 'keydir' is present in remote config but missing in local config, remote='keydir 0' Sat Apr 27 12:42:40 2019 [server] Peer Connection Initiated with [AF_INET]ADDR Sat Apr 27 12:42:41 2019 TUN/TAP device tun0 opened Sat Apr 27 12:42:41 2019 do_ifconfig, tt->did_ifconfig_ipv6_setup=0 Sat Apr 27 12:42:41 2019 /sbin/ip link set dev tun0 up mtu 1500 Sat Apr 27 12:42:41 2019 /sbin/ip addr add dev tun0 local 10.240.0.26 peer 10.240.0.25 Error: Invalid prefix for given prefix length. Sat Apr 27 12:42:41 2019 ERROR: Linux route add command failed: external program exited with error status: 2 Sat Apr 27 12:42:41 2019 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this Sat Apr 27 12:42:41 2019 Initialization Sequence Completed
以下几行暗示了这个问题:
Error: Invalid prefix for given prefix length. Sat Apr 27 12:42:41 2019 ERROR: Linux route add command failed: external program exited with error status: 2
我目前正在使用 Ubuntu 18.04.2 LTS。在我的 Ubuntu 系统内,另一个装有 Arch Linux 的系统以及装有 Ubuntu 的 VM 上也发生了同样的错误。
此外,我已在整个系统范围内禁用 IPv6,但没有成功。
我的一位同事正在使用 Windows,他能够建立具有有效 DNS 的 VPN 隧道。
你有什么建议吗?
答案1
您的问题不是关于 DNS 的,而是当开放 VPNadd route
调用返回错误状态 2时。
您应该查看您的配置文件以确保正确添加了路由。