Keeping an OpenConnect SSL VPN Tunnel Open (Hack to avoid inactivity timeout)

Written by James McDonald

February 17, 2012

I have a suspicion that my Remote SSL VPN server has an inactivity timeout on it and so I lose connectivity because of no traffic passing so it disconnects.

Here is a one line bash script that wakes up every 60 seconds and pings a host at the other end of the tunnel so that it doesn’t timeout and shutdown

Here is the code:

while [ 1 ] ; do ping -c 2 10.11.12.13 ; sleep 60 ; done
# while true (always true) 
# ping the remote host with 2 icmp echo requests
# sleep for 60 seconds or however much you want
# your done

Here is the result of it running:

[me@mybox ~]$ while [ 1 ] ; do ping -c 2 10.11.12.13 ; sleep 60 ; done
PING 10.11.12.13 (10.11.12.13) 56(84) bytes of data.
64 bytes from 10.11.12.13: icmp_req=1 ttl=128 time=527 ms
64 bytes from 10.11.12.13: icmp_req=2 ttl=128 time=627 ms

--- 10.11.12.13 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 527.933/577.719/627.505/49.786 ms
PING 10.11.12.13 (10.11.12.13) 56(84) bytes of data.
64 bytes from 10.11.12.13: icmp_req=1 ttl=128 time=1534 ms
64 bytes from 10.11.12.13: icmp_req=2 ttl=128 time=1306 ms

--- 10.11.12.13 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 1306.834/1420.648/1534.463/113.820 ms, pipe 2
PING 10.11.12.13 (10.11.12.13) 56(84) bytes of data.
64 bytes from 10.11.12.13: icmp_req=1 ttl=128 time=221 ms
64 bytes from 10.11.12.13: icmp_req=2 ttl=128 time=119 ms

--- 10.11.12.13 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 119.480/170.552/221.625/51.074 ms

1 Comment

  1. vijay

    thanks for this, life saver

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…