OpenVPN shortcut

This script will show your current WAN IP address before and after connecting to your VPN.

VALID_IP="123.123.123.123" #this is the correct IP you should be connected to
myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
echo "My current WAN/Public IP address: ${myip}"
echo "Starting OpenVPN connection"

sleep 1
sudo openvpn --config ~/path/to/VPNConfig.ovpn --daemon
echo "Establishing connection..."
sleep 8
myip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
echo "Now connected to WAN/Public IP address: ${myip}"
if [ "$myip" == "$VALID_IP" ]; then
echo "Succesfull connected to VPN-server!"
sleep 1
fi;
exit


Posted

in

,

by

Tags:

Comments

Leave a Reply