PiVPN is a utility wrapper which greatly simplifies setup and maintenance of either an OpenVPN or Wireguard VPN server. Though primarily intended for use on a Raspberry Pi, it works nicely on any debian derivative.

Installation

Follow the docs at https://www.pivpn.io/ ! The installer script is quite straightforward.

Don’t forget to open necessary ports after installation — default 51820 for Wireguard and 1194 for OpenVPN.

Changing options after install

If you need to change an option after installation, say if you change the public DNS entry of the server (for example staging.my.domain to the real my.domain):

  • For OpenVPN setups:
    • Edit /etc/pivpn/openvpn/setupVars.conf as needed
  • For Wireguard setups:
    • Edit /etc/pivpn/wireguard/setupVars.conf as needed

Changing subnets

To change the default subnet (which is typically in the 10.x.x.x range), edit the appropriate setupVars.conf file and update the pivpnNET and subnetClass options.

You will also need to change the server’s /etc/wireguard/wg0.conf; update the Address entry to match.

See also

Changing listen port

To change the listening port of a Wireguard server:

  • In /etc/pivpn/wireguard/setupVars.conf:
    • Change pivpnPORT=51820 to the new port number
  • In /etc/wireguard/wg0.conf:
    • Change ListenPort = 51820 to the new number