Jump to content
Not connected, Your IP: 18.227.72.24
Sign in to follow this  
imatt

Re: Win - Mac - BSD Block traffic when VPN disconnects

Recommended Posts

Using the post below, all my traffic dies except internal when the VPN is inactive. Thank you!

https://airvpn.org/index.php?option=com_kunena&func=view&catid=3&id=1713&limit=6&limitstart=30&Itemid=142#2010

Beyond that, I have added the below script to my crontab, it runs every 10 minutes. If the vpn is down, it restarts it and checks for status.

I know it should be in a try loop, but this was quick & dirty.

<code>

#!/bin/bash

function pingtest {

echo

if ping -c 2 google.com > /dev/null; then

echo '-----------------------------------------------------------------------'

echo `date` 'VPN operational'

echo '-----------------------------------------------------------------------'

else

echo '-----------------------------------------------------------------------'

echo `date` 'VPN not operational, reconnecting to VPN.'

echo '-----------------------------------------------------------------------'

# killing openvpn if it is still running

killall openvpn

sleep 10

# starting openvpn

openvpn /archives/scripts/Air443.ovpn >> /var/log/openvpn.log &

sleep 15

pingtest

fi

}

pingtest >> /var/log/openvpn.log

</code>

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image
Sign in to follow this  

×
×
  • Create New...