PI VPN
Computer Notes > PI VPN
PiVPN on Ubuntu (VMware Setup)
This guide covers the installation of PiVPN on an Ubuntu Server VM running within VMware. This setup uses WireGuard for high-performance, secure tunneling without the complexity of a full firewall appliance.
1. VM Prerequisites (VMware)
Before starting the installation, ensure the virtual machine is configured for network accessibility:
- Network Adapter: Set to Bridged mode. This allows the VM to receive its own IP address on your local network.
- Static IP: Ensure the VM has a consistent internal IP. You can set this via Template:Ic or a DHCP reservation on your router.
- Resources: 1 vCPU and 1GB RAM is more than sufficient for a dedicated VPN VM.
2. Installation Steps
Login to your VM via SSH or the VMware console and run the following commands:
- Update the system
sudo apt update && sudo apt upgrade -y
- Run the PiVPN automated installer
curl -L https://install.pivpn.io | bash
3. Recommended Installer Settings
During the text-based wizard, use these recommended settings to avoid common pitfalls:
- User: Select your local system user to hold the configuration files.
- Protocol: Choose WireGuard (highly recommended over OpenVPN for speed).
- Port: Default is 51820 (UDP).
- DNS: Select a provider (e.g., Google or Cloudflare) or point to a local Pi-hole if applicable.
- Unattended Upgrades: Enabled (highly recommended for security).
4. Client Management
PiVPN uses a simple command-line interface to manage connected devices.
- To create a new client profile
pivpn add
- To generate a QR code for mobile devices
pivpn -qr
- To list all active clients
pivpn -l
5. Networking & Firewall
For the VPN to function, you must allow traffic through the Ubuntu firewall and your physical router.
- Configure UFW (Uncomplicated Firewall)
sudo ufw allow 51820/udp sudo ufw allow OpenSSH sudo ufw enable
- Router Configuration
Forward UDP Port 51820 from your router's WAN/Public IP to the Internal IP of your VMware VM.
6. Troubleshooting Commands
If you encounter issues, use the built-in self-check tool:
- Template:Ic — Runs a full diagnostic of the network and service status.
- Template:Ic — Shows currently connected clients and data transfer stats.