Setting up an OpenVPN server on Ubuntu Linux can be done in just a few minutes using the following steps:
sudo apt-get update sudo apt-get install openvpn easy-rsaSourceww:w.lautturi.com
sudo mkdir /etc/openvpn/easy-rsa sudo cp -r /usr/share/easy-rsa/* /etc/openvpn/easy-rsa/
cd /etc/openvpn/easy-rsa ./easyrsa init-pki ./easyrsa build-ca
./easyrsa build-server-full server nopass
./easyrsa build-client-full client1 nopass
./easyrsa gen-dh
openvpn --genkey --secret ta.key
sudo cp pki/ca.crt pki/private/server.key pki/dh.pem ta.key /etc/openvpn
/etc/openvpn/server.conf
) with the following contents:port 1194 proto udp dev tun ca ca.crt cert server.crt key server.key dh dh.pem server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt push "redirect-gateway def1 bypass-dhcp" push "dhcp-option DNS 208.67.222.222" push "dhcp-option DNS 208.67.220.220" keepalive 10 120 tls-auth ta.key 0 key-direction 0 cipher AES-256-CBC comp-lzo user nobody group nogroup persist-key persist-tun status openvpn-status.log verb 3
sudo systemctl start openvpn@server
sudo systemctl enable openvpn@server
That's it! Your OpenVPN server should now be set up and running. You can now create a client configuration file (e.g., client1.ovpn
) with the following contents:
client dev tun proto udp remote SERVER_IP 1194 resolv-retry infinite nobind persist-key persist-tun remote-cert-tls server auth-nocache cipher AES-256-CBC comp-lzo setenv opt block-outside-dns key-direction 1 verb