Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to write a script to avoid VPN from getting timeout

I recently connected to VPN using Nortel client.

The problem that i faced, I borrowed RSA from somebody connected to VPN , had to leave pc idle for 30min or so and VPN timed out. So i had to wake people up and ask for keys to connect.

So I was wondering if its possible to write a script (I am familiar with Batch and javaScript ) that do not let the connection timeout? What I could think of : keep on sending inputs after a time and do not let it get idle enough to avoid the timeout period. is that a feasible approach ? if not anything better?

I have not tried anything yet, except for googling and that too with not much positive outcomes. and I do not know where to start.

I am not asking for a cooked up solutions(though if someone has it would be great , lol ) , just little guidance, the right direction? or references to some resources maybe?

I would really appreciate some guidance and not downvotes.

like image 676
Mukul Goel Avatar asked Nov 29 '12 14:11

Mukul Goel


People also ask

How do I stop VPN timeout?

VPN timeout issues could also potentially arise from out-of-date software, so security admins must ensure the VPN software on the user device is updated properly. Consideration should be made to users' firewall settings on their device or router, as well as router settings.

Is there a time limit for VPN?

You can configure a shorter maximum VPN session duration to meet security and compliance requirements. By default, the maximum VPN session duration is 24 hours. When the maximum VPN session duration value is decreased, active VPN sessions older than the new timeout value will be disconnected.

What is VPN idle timeout?

The default value of 'vpn idle timeout' is set to 30 minutes. So, if the device finds no activity for more than 30 minutes, it will be breaking the connection and reset the timer.

Does Cisco VPN timeout?

Yes, session timeout will terminate VPN session as per the minutes you set.


2 Answers

Well, if it is a matter of timing out because idle standby, the solution is rather simple. The following pseudocode can be be implemented in many ways

repeat:
   ping once gateway_ip  
   wait n seconds

You can do this as a bash or batch script. Here's an example in bash:

while true
do
   ping -c 1 gateway_ip
   sleep 3
done

Or as a batch script:

:loop
ping -n 1 gateway_ip
ping -n 3 127.0.0.1 
goto loop
like image 123
Candide Avatar answered Oct 24 '22 18:10

Candide


$ ping -i 30 127.0.0.1

ping provides an interval option, so you don't even need to use a script to create a VPN stay-alive.

$ man ping   
...   
OPTIONS  
...  
    -i interval
        Wait interval seconds between sending each packet.  The default is to wait
        for one second between each packet normally, or not to wait in flood mode. 
        Only super-user may set interval to values less 0.2 seconds.
like image 33
Lomky Avatar answered Oct 24 '22 20:10

Lomky