OpenVPN 随机断开连接,拒绝重新连接

OpenVPN 随机断开连接,拒绝重新连接

我在 Debian 虚拟机上运行 OpenVPN 服务器。

OpenVPN 2.1.0 x86_64-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [MH] [PF_INET6] [eurephia] built on Jul  9 2010
Originally developed by James Yonan
Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <[email protected]>

我最近从 TCP 协议切换到了 UDP。我不得不使用 TCP,因为这是我使用 VPN 的网络中唯一未被阻止的协议。不过我不会再使用该网络了,现在所有我将使用 VPN 的网络都应该允许使用 UDP。

然而,我最近开始注意到 VPN 客户端(Mac 和 Windows 7 上都有)会随机断开连接。我有时能保持连接一个多小时,有时只有几分钟。而且尝试重新连接很少奏效,我需要重新加载或重新启动 VPN 服务才能使其正常工作。

这是服务器日志中的内容:

Sun Jul 25 12:54:29 2010 us=83586 vpn.rootspirit.com/85.234.196.37:59101 PUSH: Received control message: 'PUSH_REQUEST'
Sun Jul 25 12:54:29 2010 us=83660 vpn.rootspirit.com/85.234.196.37:59101 SENT CONTROL [vpn.rootspirit.com]: 'PUSH_REPLY,route 85.12.6.190 255.255.255.0,dhcp-option DOMAIN vpn.tuinslak.org,dhcp-option DNS 10.19.88.1,dhcp-option DNS 85.12.6.171,dhcp-option DNS 208.67.222.222,dhcp-option DNS 208.67.220.220,dhcp-option NTP 85.12.6.130,redirect-gateway def1,route 10.19.88.0 255.255.255.0,topology net30,ping 10,ping-restart 120,ifconfig 10.19.88.6 10.19.88.5' (status=1)
Sun Jul 25 13:49:23 2010 us=593925 MULTI: multi_create_instance called
Sun Jul 25 13:49:23 2010 us=593996 85.234.196.37:63398 Re-using SSL/TLS context
Sun Jul 25 13:49:23 2010 us=594028 85.234.196.37:63398 LZO compression initialized
Sun Jul 25 13:49:23 2010 us=594125 85.234.196.37:63398 Control Channel MTU parms [ L:1542 D:166 EF:66 EB:0 ET:0 EL:0 ]
Sun Jul 25 13:49:23 2010 us=594140 85.234.196.37:63398 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
Sun Jul 25 13:49:23 2010 us=594175 85.234.196.37:63398 Local Options String: 'V4,dev-type tun,link-mtu 1542,tun-mtu 1500,proto UDPv4,comp-lzo,keydir 0,cipher DES-EDE3-CBC,auth SHA1,keysize 192,tls-auth,key-method 2,tls-server'
Sun Jul 25 13:49:23 2010 us=594188 85.234.196.37:63398 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1542,tun-mtu 1500,proto UDPv4,comp-lzo,keydir 1,cipher DES-EDE3-CBC,auth SHA1,keysize 192,tls-auth,key-method 2,tls-client'
Sun Jul 25 13:49:23 2010 us=594206 85.234.196.37:63398 Local Options hash (VER=V4): 'b5edb94e'
Sun Jul 25 13:49:23 2010 us=594222 85.234.196.37:63398 Expected Remote Options hash (VER=V4): '53f7fc82'
Sun Jul 25 13:49:23 2010 us=594255 85.234.196.37:63398 TLS: Initial packet from 85.234.196.37:63398, sid=ad75fbfb 003c5c1f
Sun Jul 25 13:50:23 2010 us=47907 85.234.196.37:63398 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Sun Jul 25 13:50:23 2010 us=47956 85.234.196.37:63398 TLS Error: TLS handshake failed
Sun Jul 25 13:50:23 2010 us=48048 85.234.196.37:63398 SIGUSR1[soft,tls-error] received, client-instance restarting
Sun Jul 25 13:53:09 2010 us=208133 vpn.rootspirit.com/85.234.196.37:59101 [vpn.rootspirit.com] Inactivity timeout (--ping-restart), restarting
Sun Jul 25 13:53:09 2010 us=208192 vpn.rootspirit.com/85.234.196.37:59101 SIGUSR1[soft,ping-restart] received, client-instance restarting

一切似乎都会导致 ping 超时或互联网连接中断。但是,此网络中的其他 PC 仍能正常连接到互联网。因此,我认为不是我的 vDSL 连接断开了。服务器的数据包丢失也是如此;丢失率接近 0%。

Keep alive 设置为:

keepalive 10 120

知道什么可能导致这个问题吗?

诚挚的问候,Tuinslak

答案1

当我碰巧有多个客户端具有相同证书或具有相同通用名称的证书而duplicate-cn设置未启用时,我也遇到了类似的行为。解决这两个原因中的任何一个都会使连接稳定。

来自 OpenVPN 服务器配置的信息:

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

答案2

由于上述原因,我有一段时间没有使用 VPN 了。

不过,我最近又用了一次,似乎不再断线了。我猜是更新软件时修复了某个地方的错误。不久前我也从 Lenny 升级到了 Squeeze。

相关内容