cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
578
Views
0
Helpful
4
Replies

Auto-Reconnecting Cisco AnyConnect VPN

jimbrown-dm
Level 1
Level 1

Is there a way to automatically reconnect Cisco AnyConnect VPN after a network interruption?

4 Replies 4

@jimbrown-dm unsure what version you are using here, the last number of years the versions of Cisco AnyConnect have a built-in auto-reconnect feature. You can enable this in the client settings. You could also write a script local to reconnect if this feature isn’t enabled by your company policy.

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Like was mentioned, this typically happens automatically. Here's some background on it from the Cisco website.
https://www.cisco.com/c/en/us/support/docs/security/anyconnect-secure-mobility-client/116312-qanda-anyconnect-00.html#toc-hId--1618565854

ccieexpert
Spotlight
Spotlight

By default it should automatically reconnect as others have pointed out.. are you not seeing that ?

a quick test would be to disconnect wifi or ethernet connection and reconnect, and anyconnect should reconnect automatically.

There is also reconnect option to reconnect after a pc suspended and resumed from sleep.

for that you need a profile setting:

The Auto-Reconnect behavior for AnyConnect can be controlled through the AnyConnect XML profile with this setting:

       <AutoReconnect UserControllable="true">true
<AutoReconnectBehavior>ReconnectAfterResume</AutoReconnectBehavior>
</AutoReconnect>

vishalbhandari
Spotlight
Spotlight

Yes, there are ways to configure Cisco AnyConnect VPN to automatically reconnect after a network interruption. The automatic reconnect feature can be enabled and customized using both client-side settings and server-side policies.

1. Client-Side Configuration

  • Auto Reconnect: This feature is enabled by default in Cisco AnyConnect. The VPN client will attempt to reconnect automatically after a network interruption. To check or adjust this setting:
    • Navigate to the Cisco AnyConnect VPN Client configuration file, usually found in the directory:
      • Windows: C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile
      • macOS: /opt/cisco/anyconnect/profile
    • Open the .xml profile file associated with your connection.
    • Look for the <AutoReconnect> tag. It should be set to true to enable auto-reconnection.
      xml

<AutoReconnect>true</AutoReconnect>
<AutoReconnectBehavior>ReconnectAfterResume</AutoReconnectBehavior>

  • Auto Reconnect Behavior:
    • The <AutoReconnectBehavior> tag can be set to various values, such as:
      • ReconnectAfterResume: Reconnect automatically after the device resumes from sleep or hibernation.
      • ReconnectImmediately: Reconnect immediately after a disconnection.

2. Server-Side Configuration

  • Session Persistence: The VPN server can be configured to allow session persistence, which helps the client reconnect without requiring the user to re-authenticate after a brief disconnection.
  • Idle Timeout: The idle timeout on the server can be adjusted to allow more time for the client to reconnect without the session being terminated.
  • DTLS (Datagram Transport Layer Security): If DTLS is enabled, it can improve the robustness of the connection during network interruptions. Ensure that DTLS is enabled on both the server and the client.

3. Scripting Solutions

  • Batch or Shell Script: For advanced users, scripting can automate the reconnection process. For example, a script can monitor the network state and trigger the AnyConnect client to reconnect if a disconnection is detected.

4. Third-Party Tools

  • Some third-party tools or scripts can also monitor VPN connections and attempt to reconnect them automatically. These might offer more customization and control.

By implementing these methods, you can improve the resilience of your Cisco AnyConnect VPN connection in the face of network interruptions.