How to auto reconnect to openvpn upon reconnect to wifi on Linux terminal?

2

I'm on an Ubuntu 18.04 laptop and I always need to connect to an openvpn server. Since I'm unable to setup the VPN from the GUI I always need to manually run

sudo openvpn --config theconfig.ovpn

When I'm away from my laptop it goes into sleep mode, disconnects from wifi and when it wakes up again it reconnects to wifi again. After that I'm disconnected from the internet until I stop the openvpn and reconnect it again.

Is there a way that I can make this reconnection happen automatically when it finds a connection to wifi again?

kramer65

Posted 2018-07-12T14:01:57.187

Reputation: 1 335

Have you tried using the "gnome-nettool" package? – Tim_Stewart – 2018-07-12T14:10:21.633

Answers

0

Openvpn (when kept running) will reconnect automagically.

Ralf Hildebrandt

Posted 2018-07-12T14:01:57.187

Reputation: 131