Ubuntu 24.04上的Cisco安全客户端成功建立VPN连接,但将在数秒内断开连接。断开连接时始终伴有终止原因代码7和涉及libvpnapi的崩溃。因此,会阻止正常业务访问所需的稳定VPN连接。
连接序列显示客户端到达“已连接”状态,但在检查状态时立即转换回已断开状态。VPN客户端显示“Termination reason code 7:代理已停止”,同时还有隧道状态更改条目和消息,指示通过“关闭通知”警报断开的DTLS/SSL连接。
此命令序列演示了问题:
/opt/cisco/secureclient/bin/vpn connect
连接输出显示成功建立:
Cisco Secure Client (version 5.1.12.146) release.
Copyright (c) 2004 - 2025, Cisco Systems, Inc. All rights reserved.
>> state: Unknown
>> state: Disconnected
>> state: Disconnected
>> notice: Ready to connect.
>> registered with local VPN subsystem.
>> contacting host (vpn.sse.cisco.com) for login information...
>> notice: Contacting vpn.sse.cisco.com.
>> Your client certificate will be used for authentication
Group:
>> state: Connecting
>> notice: Establishing VPN session...
The Cisco Secure Client - Downloader is analyzing this computer. Please wait...
Initializing the Cisco Secure Client - Downloader...
The Cisco Secure Client - Downloader is performing update checks...
The Cisco Secure Client - Downloader update checks have been completed.
>> notice: The Cisco Secure Client - Downloader is performing update checks...
>> notice: Checking for profile updates...
>> notice: Checking for customization updates...
>> notice: Performing any required updates...
>> notice: The Cisco Secure Client - Downloader update checks have been completed.
Please wait while the VPN connection is established...
>> state: Connecting
>> notice: Establishing VPN session...
>> notice: Establishing VPN - Initiating connection...
>> notice: Establishing VPN - Examining system...
>> notice: Establishing VPN - Activating VPN adapter...
>> notice: Establishing VPN - Configuring system...
>> notice: Establishing VPN...
>> state: Connected
但是,在连接后立即检查状态时:
/opt/cisco/secureclient/bin/vpn status
客户端显示断开连接状态:
Cisco Secure Client (version 5.1.12.146) release.
Copyright (c) 2004 - 2025, Cisco Systems, Inc. All rights reserved.
>> state: Unknown
>> state: Disconnected
>> state: Disconnected
>> state: Disconnected
>> notice: Ready to connect.
>> registered with local VPN subsystem.
VPN>
操作系统:Ubuntu 24.04
思科安全客户端版本:5.1.12.146
认证方法:客户端证书身份验证
virtual 接口:cscotun0(或类似的思科安全客户端虚拟接口)
环境包括用于系统管理的自动化脚本
通过识别并更正错误地将Cisco安全客户端虚拟接口(cscotun0)标识为新物理设备的自动化脚本并应用HTTP/透明代理配置,解决了此问题。接下来的步骤将概述解析过程。
从受影响的终端生成DART(诊断和报告工具)捆绑包,以捕获详细的VPN客户端日志和系统信息:
Generate DART bundle from Cisco Secure Client interface or command line
DART捆绑包包含显示接口和配置文件配置步骤的VPN代理日志条目,包括接口cscotun0的DNS设置、VPN适配器配置和路由表更改。
Mar 13 16:41:08 Message type information sent to
> the user: Contacting vpn.sse.cisco.com.
> Mar 13 16:41:08 : VPN SESSION START: Initiating
> VPN connection to the secure gateway hvpn.sse.cisco.com
> Mar 13 16:41:08 The Cisco Secure Client -
> AnyConnect VPN has obtained the following proxy server configuration from
> the operating system: http://x.x.x.x:3128/
> Mar 13 16:41:08 The Cisco Secure Client -
> AnyConnect VPN has obtained the following proxy exception list from the
> operating system: localhost,127.0.0.0/8,::1
> Mar 13 16:41:11 Termination reason code 7: The
> agent has been stopped.
研究管理网络接口和代理配置的本地自动化脚本。查找可自动检测新网络接口并应用配置策略的脚本。
确定自动化脚本是否将Cisco安全客户端虚拟接口视为新的物理设备并应用不适当的代理设置。虚拟接口(cscotun0或类似接口)不能应用HTTP/透明代理配置。
删除或更正由自动化脚本自动应用于Cisco安全客户端虚拟接口的代理分配。这样可以防止代理干扰VPN流量。
修改自动化脚本以从自动代理配置策略中排除Cisco安全客户端虚拟接口(通常命名为cscotun0、cscotun1)。添加逻辑以在自动网络配置过程中识别和跳过VPN虚拟接口。
在删除代理配置后测试VPN连接以确认稳定的连接:
/opt/cisco/secureclient/bin/vpn connect vpn.sse.cisco.com
通过检查连接建立后的状态,验证连接是否保持稳定:
/opt/cisco/secureclient/bin/vpn status
如果问题仍然存在,或发生在类似环境中,请考虑以下其他故障排除方法:
在无自动化脚本的全新Linux终端上测试Cisco安全客户端
暂时禁用可能干扰libvpnapi或VPN代理的第三方服务
将Cisco安全客户端升级到最新可用版本
查看系统日志,了解与VPN虚拟接口创建和配置相关的冲突
根本原因是内部自动化脚本错误地将Cisco安全客户端虚拟接口(cscotun0或类似)标识为新物理网络设备。脚本自动将HTTP/透明代理配置应用到此虚拟接口,这干扰了VPN流量并导致连接终止,原因代码为7。
当VPN客户端建立连接时,它会创建虚拟网络接口来处理加密流量。自动化脚本检测到此接口创建为加入系统的新网络设备,并应用了专用于物理网络接口的标准代理策略。此代理配置破坏了VPN隧道正确路由加密流量的能力,导致连接成功建立后立即断开连接。
终止原因代码7(“代理已停止”)和libvpnapi.so崩溃是底层代理干扰的症状,而不是直接VPN客户端软件问题。
| 版本 | 发布日期 | 备注 |
|---|---|---|
1.0 |
26-May-2026
|
初始版本 |