6

How would you go about making OpenVPN automatically restart upon connecting to a network?

The issue is that every time a network connection is lost, or if the computer is booted without a network connection and then connects, OpenVPN does not work — at least until I manually restart openvpn.

Running Arch Linux (thus using systemd)

2 Answers 2

0

Use the --ping and --ping-restart (or --keepalive) options and openvpn will reconnect when it looses the connection.

0

In addition to the ping/ping-restart answer, make sure you don't use persist-tun in your configuration file, so you'll start with a "clean" routing tables regarding the VPN on every reconnect.

The best configuration for dynamic networks is via NetworkManager, it supports OpenVPN, and also supports bringing up another connection (VPN in this case) upon connecting to any hardware interface.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .