Our OpenVPN templates provide a quick and easy way to setup VPNs. However, a small amount of setup work is still required on your end to get the VPN started.
First, login to your VPS with SSH, and run these commands to get the VPS ready to forward connections through the VPN (replace "0.0.0.0" with your VPS main IP):
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 0.0.0.0
Edit the OpenVPN configuration file with your server's IP:
# vi /etc/openvpn/server.conf
On the first line, change 0.0.0.0 to your VPS main IP address. You may also modify the port from "1234" to any port you want OpenVPN to run on.
Create a file on your PC called vpn1.ovpn, in your OpenVPN configs folder, with the following content (be sure to edit the IP and port accordingly):
client
dev tun
proto udp
remote 0.0.0.0 1234 #EDIT WITH YOUR VPS IP AND OPENVPN PORT
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
verb 3
Finally, connect to your VPS with sFTP or another method, and download the ca.crt file in /etc/openvpn/easy-rsa/2.0/keys to the same OpenVPN configs folder where you saved vpn1.ovpn.
Start OpenVPN on the VPS:
# openvpn /etc/openvpn/server.conf
Connect to VPN using OpenVPN with username: vpn and password: host2==
You can modify the VPN password by executing "passwd vpn" via SSH.