I have stumbled upon a problem.
We have a VPN connection between two servers that are on different locations so in order for them to communicate they need a VPN connection.
My coworker has setup an L2TP with IPsec connection between the servers and it connects and works.
About once per day the connection fails, re-establishes but doesn't work anymore. If i manually disconnect and reconnect the VPN it works once again.
The connection isn't mission critical to be always on, as it is only used to sync some data few times per day, but it is a hassle to connect it every day again and again.
I have done my research and have concluded that a batch file with a rasdial command is the way to go, but i cannot get it to work.
i want to run a command:
ping -n 1 126.96.36.199 && rasdial myvpn /disconnect || rasdial myvpn
If it pings the server and the server isn't online, i want it to disconnect and reconnect again.
But the command doesn't seem to work for me.
When it will be working i'll put it in a schedule to run every 2 hours.
Could anyone help me write a working batch file?