OpenVPN Setup (Server & Client)
Environment
-
VPN Server
Field Spec or Version CPU QEMU Virtual CPU version 2.5+ (2 Cores) RAM 2G OS Ubuntu 24.04.1 LTS (Noble Numbat) Network interface ens18 with static IP 192.168.3.100/24 DNS 192.168.3.1 (Private DNS Server) -
VPN Client
Field Spec or Version CPU QEMU Virtual CPU version 2.5+ (2 Cores) RAM 2G OS Ubuntu 24.04.1 LTS (Noble Numbat) Network interface ens18 with static IP 192.168.5.100/24 DNS 192.168.5.1 (Private DNS Server)
Server - Package Installation
apt install -y openvpn
Server - Configuration
-
Copy from sample configuration file
cp /usr/share/doc/openvpn/examples/sample/config-files/server.conf /etc/openvpn/server/server.conf
-
Edit the copied file
port 1194 proto tcp # Use routing mode instead of bridge mode dev tun ca ca.crt cert example.fake.crt key example.fake.key dh dh.pem topology subnet server 192.168.7.0 255.255.255.0 # Add route for subnet on server to connected VPN clients push "route 192.168.3.0 255.255.255.0"