The original article used PPTP, a legacy VPN protocol that should no longer be deployed. A current Raspberry Pi or Ubuntu server can provide private remote access with WireGuard instead.
This example assumes the administrator owns the server and network, has a public or forwarded UDP port, and is permitted to operate a VPN in the relevant environment.
Install and create keys
1 | sudo apt update |
Keep private keys out of shell history, backups shared with others, and public repositories. Generate a separate key pair for each client so access can be revoked individually.
Server configuration
Create /etc/wireguard/wg0.conf with restrictive permissions:
1 | [Interface] |
Enable IPv4 forwarding through a dedicated file under /etc/sysctl.d/, then apply it with sudo sysctl --system. Configure forwarding and source NAT using the firewall system already managed by the host—such as nftables or UFW—rather than mixing several persistent rule managers.
Permit only UDP port 51820 from the Internet. If the Raspberry Pi sits behind a router, forward that UDP port to its reserved LAN address.
Client configuration
1 | [Interface] |
The example uses split tunneling for the VPN subnet. Use 0.0.0.0/0, ::/0 only when all client traffic is deliberately meant to traverse the server and IPv6 is configured correctly.
Start and enable the interface with the platform’s wg-quick system service, then inspect status with sudo wg show. Protect backups of private keys, keep the operating system patched, remove lost clients promptly, and verify local law and network policy before exposing the service.