Every few months the "What VPN should i use?" or "Can you recommend any good VPN providers?" question surfaces. I'm sick and tired of these questions, the only good an trustworthy VPN is one you setup and maintain by yourself for yourself.
Signing up to a VPN service is often touted as a "good privacy and or security measure" Thats not always true and if I was in the business of catching all kinds of devious people the first thing I would do is setup a VPN for them to sign up to and then start monitoring all of their traffic.
Coming back to running a VPN. Hardware is expensive and logistics become exponentially complicated when trying to run your own 1 man VPN operation. However with Cloud it becomes much more feasible to setup a global VPN by yourself effectively. So in this post I'll show you how to start setting up your own VPN on the cloud.
I set up this VPN server on AWS in order to follow these steps you need to:
- Sign up to Amazon Web services
- Provision an EC2 instance (any linux distribution is fine but for this tutorial I used Amazon Linux)
Once you have done the above log into your newly provisioned server and run the following commands to setup OpenVPN:
$ sudo yum update -y $ sudo yum install -y openvpn $ sudo modprobe iptable_nat $ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward 1 $ sudo iptables -t nat -A POSTROUTING -s 10.4.0.1/2 -o eth0 -j MASQUERADE $ cd /etc/openvpn $ sudo openvpn --genkey --secret vpn.key $ sudo service openvpn start Starting openvpn: [ OK ]
Once your done make sure you copy the VPN key (you will need this to access your VPN) you can copy it off the server using sftp or just coping the output of the cat command (warning the output below has been fudged.
$ sudo cat ovpn.key # # 2048 bit OpenVPN static key # -----BEGIN OpenVPN Static key V1----- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccc 1111111111111111111111111111111 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccc 1111111111111111111111111111111 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccc 1111111111111111111111111111111 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccc 1111111111111111111111111111111 -----END OpenVPN Static key V1-----
Connecting to your VPN
You will need to create a configuration file for your VPN here. You will also need your VPN key here to feed into your configuration file.
The following configuration file is an example of a windows openVPN configuration file:
proto tcp-client remote [your.server.ip.here] port 1194 dev tun secret "C:\\path\\to\\your\\vpn\\key\\vpn.key" OR "\\path\\to\\your\\vpn\\key\\vpn.key" redirect-gateway def1 ifconfig 10.4.0.2 10.4.0.1
After you have created the config file you can setup one of the following openVPN clients for your operating system to connect to your VPN:
As always I hope you found this tutorial useful. Please let me know if you would like to see more cloud or privacy / VPN focused tutorials in the near future.
As always thanks for your support! Until next time.