A simple systemd service, intended to maintain a persistent VPN connection.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE.md
README.md
persistentvpn
persistentvpn.service

README.md

PersistentVPN.service

This is a simple systemd service, built to help learn the basics of systemd, while solving an annoyance with Ubuntu.

It is intended to ensure that a particular VPN connection remains persistently connected.

Requirements

  • Linux running systemd (tested on Ubuntu 16.04)
  • Ruby
  • An active VPN connection

Installation

  • Copy peristentvpn to somewhere appropriate (for example, /usr/local/bin)
  • Edit persistentvpn.service:
    • change path to persistentvpn file, if it is not /usr/local/bin
    • change CONNECTION_NAME=xyz: xyz should be the name of your VPN connection, as found in Network Manager or nmcli conn
  • Copy persistentvpn.service to /etc/systemd/system/
  • systemctl start persistentvpn.service

To start automatically on boot, run this once:

  • systemctl enable persistentvpn.service

Limitations

This software does not guarantee that the VPN connection is active 100% of the time, nor that no traffic flows over other connections. It will simply automatically attempt to reconnect to the given VPN after a few seconds. During this reconnection period, or if VPN connection fails, internet traffic may be routed over other connections, dependent on your network configuration.