Skip to content

Instantly share code, notes, and snippets.

@HungYuHei
Created September 19, 2011 02:24
Show Gist options
  • Select an option

  • Save HungYuHei/1225875 to your computer and use it in GitHub Desktop.

Select an option

Save HungYuHei/1225875 to your computer and use it in GitHub Desktop.
openvpn config
sudo apt-get install openvpn
cp /usr/share/doc/openvpn/examples/easy-rsa/2.0 ~/ -r
source ./vars
./clean-all
./build-ca
./build-key-server
./build-key
./build-dh
sudo cp server.conf /etc/openvpn/
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
/etc/network/if-pre-up.d/loadiptable
#!/bin/sh
iptables-restore < /etc/iptables.rules
exit 0
/etc/network/if-post-down.d/saveiptable
#!/bin/sh
iptables-save -c > /etc/iptables.rules
if [ -f /etc/iptables.downrules ]; then
iptables-restore < /etc/iptables.downrules
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment