I have a VPN setup on my pi to connect on boot but the connection is unstable due to my on network issues. The "Keepalive 120 600" command doesn't help. When connection returns after an outage I have no access to the interent at all until I reboot. This is fine as I only want it to communicate through the VPN, but I think it is what prevents the keep alive from working.
So what I'd like to do is setup a script instead to ping something (like google 22.214.171.124) every 2 minutes and if no responses heard in 10 to reboot. Just like the keepalive would do but reboot instead of try to restart the VPN. I'm rather inexperienced with linux so need some advise. I'd like a script to do this, and if you have some extra time some explanation on it as I'm trying to learn. Though with just the script I could tinker with it and figure it all out.
Thanks for your help.
Below is the start script of my VPN in case there is simply something missing from there to make it work right.
keepalive 120 600