OpenVPN Settings and iptables configured for Amazon AWS EC3 Server

Add or edit the following in the OpenVPN config file - server.conf

port 1194
proto tcp-server dev tun1

You can also change other settings as you wish. But you have to add the command ifconfig. In this example: ip is the local vpn end point - ip is the remote VPN end point.

Setting up iptables

Add this iptables command to allow Internet access to your VPN clients.

sudo iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

Allow IP forwarding as well:

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

Do not forget to allow access to the port 1194. Please check for that your firewall settings in your server and Amazon AWS console settings.