InfoSecTech

Make your own VPN using a Raspberry Pi Zero.

Make your own VPN using a Raspberry Pi Zero.

Raspberry Pi’s are amazing, they’re open source and versatile you can do so many things with them including, making a VPN using a program called Pi VPN. I’ll explain how to make one,

First, what is a VPN?

VPN is an acronym for Virtual Private Network. They can be particularly useful in countries with oppressive governments to circumnavigate censorship (although I would recommend Tor which .onion TLD’s instead of .com or .net.) but the problem with VPN’s is you have to trust the provider not to keep your logs or be in cahoots with said government.

You also don’t have to currently be in an oppressive state in for it to make sense to use one. You could be in America where it has been known for internet speeds to be throttled due to issues with Net Neutrality (which you maybe heard about over the past few years and means that the ISP will purposely slow down the connection for their customers and demand a payment in order for it to go back to normal.)

So by self-hosting you can cut out the middle man and securely connect to a (VPN) tunnel from somewhere without secure internet, somewhere where the SSID doesn’t have a password, so the shop owner could see your internet traffic or someone malicious could by using network sniffers like Wireshark

How to Pi VPN:

What you’ll need.

  1. Raspberry Pi Zero, £10
  2. Micro SD card (16 GB) £5
  3. Raspbian https://raspberrypi.org/software/
  4. Another computer with either Rufus or Balena Etcher installed
  5. AC cable
  6. micro HDMI to HDMI
  7. monitor you can use a TV if it has HDMI inputs.
  8. Keyboard and Mouse. Patience.

Step 1 Once you have everything you need, put the micro SD in the computer slot, download and flash the Raspbian ISO file to the card. When it has completed put the micro SD inside the Pi Zero and plug into the cable also add the OTG and HDMI before booting.

Step 2 Now go to terminal and type sudo raspi-config go to the interface option and turn on SSH then save the changes, exit, and reboot.

Step 3 You have enabled secure shell (commonly referred to as SSH or port 22) so you can use your other computer to access this one by typing the command ssh (device name)@deviceIP to find out your device name and IP address go back to the Raspberry Pi terminal and type whoami which should by default come back with “Raspberry Pi” unless you changed it. Now type ipconfig and enter, which should give you a result in the format of an IPv4 address like 192.168.x.x write it down or make a note in notepad on your primary device. If you lose or forget the name and IP, you can use https://angryip.org to find it again.

Step 4 Go to your computer terminal and again run ssh (device name)@deviceIP press enter, and you should be prompted to accept the keys click yes or press enter. Congratulations 🥳 now you’re now remotely accessing your Raspberry Pi from your computer. You can now update and upgrade by running these commands.

  • sudo apt-get update
  • sudo apt-get upgrade

Once completed should take 5-15 minutes depending on the update list and internet speed, you can now install Pi VPN.

Step 5 https://PiVPN.io/ run the command in the terminal.

curl -L https://install.pivpn.io | bash

You can use Pi-Hole as the DNS resolver if you have it setup, see here: Make your own VPN using a Raspberry Pi Zero. For my instructions.