A simple bash script for autoreconnect to OpenVPN via NetworkManager command-line (nmcli).
- Clone the repository:
git clone https://github.com/johanneszab/vpn-auto-reconnect.sh.git
- Change directory inside that directory:
cd vpn-auto-reconnect.sh
- Make the script executable
chmod +x vpn-auto-reconnect.sh
- Copy
vpn-config-sample.sh
tovpn-config.sh
. Simply run
cp vpn-config-sample.sh vpn-config.sh
-
Configure
vpn-config.sh
. All the needed info on how to do that, is shown in the config comments. -
Start monitoring VPN connection
./vpn-auto-reconnect.sh start
- Stop the monitoring and also the VPN connection
./vpn-auto-reconnect.sh stop
Fork from with changes for nmcli v0.9.10.
Script tested on fedora 21 with airvpn (OpenVPN).
A simple bash script to toggle an OpenVPN connection on and off via NetworkManager command-line (mncli). You can use it instead of typing vpn-auto-reconnect.sh start/stop
:
chmod +x vpn-toggle.sh
./vpn-toggle.sh