OpenVPN Settings and iptables configured for Amazon AWS EC3 Server

Revision as of 20:16, 29 January 2020 by Ardaut (talk | changes) (Created page with "=== Add or edit the following in the OpenVPN config file - server.conf === <pre>port 1194 proto tcp-server dev tun1 ifconfig 10.4.0.1 10.4.0.2</pre> You can also change other...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

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.