Created
July 29, 2012 06:07
-
-
Save msnodderly/3196336 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev tun | |
ifconfig 10.8.0.2 10.8.0.1 | |
secret /Users/username/path/to/static.key | |
redirect-gateway def1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Setup IP forwarding | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev tun | |
ifconfig 10.8.0.1 10.8.0.2 | |
secret /etc/openvpn/static.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTE: this config will route ALL your traffic through the VPN tunnel. If this isn't what you want, you'll need to add static routes in your openvpn config.
Launch AMI instance
eg: ec2-X.X.X.X.compute.amazonaws.com
Setup a security group
Click "Security Groups" and choose the "quicklaunch-1" group.
Create a new Custom UDP rule for port 1194
Apply rule changes
TCP
Port (Service) Source Action
22 (SSH) 0.0.0.0/0 Delete
UDP
Port (Service) Source Action
1194 0.0.0.0/0 Delete
Save your key in /Users/[username]/.ssh/aws.pem
$ cd ~/.ssh
$ cp ~/Downloads/aws.pem .
$ chmod 600 ./aws.pem
Log in to your new EC2 machine
$ ssh -i ~/.ssh/aws.pem [email protected]
(substitute the public DNS name of your instance noted above)
Install openvpn (on EC2 machine)
$ sudo -i
$ yum -y install openvpn
$ cd /etc/openvpn
$ openvpn --genkey --secret static.key
$ cat > server.cfg
dev tun
ifconfig 10.8.0.1 10.8.0.2
secret /etc/openvpn/static.key
^D
Setup IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
Install Tunnelblick on your Mac
Download and install: http://code.google.com/p/tunnelblick/downloads/detail?name=Tunnelblick_3.2.6.dmg
Launch it, click I have configuration files, and create a configuration
Create a file config.ovpn in the folder that opens
remote ec2-X.X.X.X.compute.amazonaws.com
dev tun
ifconfig 10.8.0.2 10.8.0.1
secret /Users/username/path/to/static.key
redirect-gateway def1
Save and quit
Copy the secret key to your mac in the location you specified
Connect Tunnelblick and go.