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
ifconfig 10.4.0.1 10.4.0.2

You can also change other settings as you wish. But you have to add the command ifconfig. In this example: ip 10.4.0.1 is the local vpn end point - ip 10.4.0.2 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 10.4.0.1/2 -o eth0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -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.