openvpn 

Send to Kindle
home » snippets » openvpn



Server Setup on Linux

Set up ip tables

There are better ways to do this but this works for now.  I've specified -s 10.8.0.0/24 instead of -i tun0.

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
iptables -t filter -A INPUT -s 10.8.0.0/24 -j ACCEPT
iptables -t filter -A FORWARD -s 10.8.0.0/24 -j ACCEPT

My sample server.conf details

# Tell clients to use the OpenVPN server as the default
# gateway (includes DNS lookups).  Requires the server
# to NAT/bridge the TUN/TAP interface with it's internet
# interface.
push "redirect-gateway def1 bypass-dhcp"

# Use Google's public DNS servers.
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

# Drop privileges.
user nobody
group nobody