是否可以编写脚本以避免VPN超时

Muk*_*oel 8 vpn timeout session-timeout

我最近使用Nortel客户端连接到VPN.

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?

我真的很感激一些指导,而不是downvotes.

Can*_*ide 7

好吧,如果由于空闲待机而导致超时问题,解决方案相当简单.以下伪代码可以以多种方式实现

repeat:
   ping once gateway_ip  
   wait n seconds
Run Code Online (Sandbox Code Playgroud)

您可以将此作为bash或批处理脚本执行.这是bash中的一个例子:

while true
do
   ping -c 1 gateway_ip
   sleep 3
done
Run Code Online (Sandbox Code Playgroud)

或者作为批处理脚本:

:loop
ping -n 1 gateway_ip
ping -n 3 127.0.0.1 
goto loop
Run Code Online (Sandbox Code Playgroud)


Lom*_*mky 5

$ ping -i 30 127.0.0.1
Run Code Online (Sandbox Code Playgroud)

ping 提供间隔选项,因此您甚至不需要使用脚本来创建VPN保持活动状态。

$ 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.
Run Code Online (Sandbox Code Playgroud)