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 instead of -i tun0.

iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE
iptables -t filter -A INPUT -s -j ACCEPT
iptables -t filter -A FORWARD -s -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"
push "dhcp-option DNS"

# Drop privileges.
user nobody
group nobody