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

Mukul Goel picture Mukul Goel · Nov 29, 2012 · Viewed 11k times · Source

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.

Answer

Candide picture Candide · Nov 29, 2012

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