Simple VPN with OpenVPN Server Script

Create OpenVPN Server and Client

wget https://git.io/vpn -O openvpn-ubuntu-install.sh
chmod +x openvpn-ubuntu-install.sh
sudo ./openvpn-ubuntu-install.sh

Copy the from the Script generated *.ovpn file to your Client Desktop

Get The Client from: https://openvpn.net/download-open-vpn/

Import the *.ovpn file inside the Windows Client or use the terminal openvpn with the *.ovpn file as parameter.

Internet by OpenVPN: Routing Configuration

to allow proper routing of our VPN subnet:

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
service iptables save

to enable IP Forwarding:

sysctl -w net.ipv4.ip_forward=1

apply sysctl settings & start the server automatically on boot:

sysctl -p
service openvpn start
chkconfig openvpn on

You now have a working OpenVPN Server. In the following steps, we’ll discuss how to properly configure your client.

Leave a Reply