in ,

How to set up your own VPN using Raspberry Pi

Eyes are everywhere online.

The websites you visit often track where you came from and watch where you head off to next.

A VPN – or virtual private network – helps you browse the internet more anonymously by routing your traffic through a server that is not your point of origin.

It is a bit like switching cars to shake off someone who is tailing you.

There are plenty of companies offering services with varying degrees of security and varying degrees of cost, but if you are willing to roll your sleeves up and get technical with some basic coding and a £30 Raspberry Pi computer, you can build your own VPN server at home.

You can then connect external devices like a smartphone to this VPN tunnel to browse the internet more securely through your home network, and access shared files and media on your home computer.

Make no mistake, this is not a quick and easy process.

 

Watch this Tip Shared on BBC CLick

 

 

Below is a step-by-step guide you will need to follow to the letter, symbol and space if you want to follow in my footsteps.

To follow this guide you will need:

  • 1 x Raspberry Pi/Pi 2
  • 1 x 8GB micro SD card
  • 1 x SD card reader
  • 1 x 5 volt mini USB power supply (a suitable phone charger will do)
  • 1 x HDMI monitor (your TV or computer monitor)
  • 1 x USB keyboard
  • 1 x Ethernet network cable

Prepare to install your operating system

Insert the micro SD card in your card reader.

If you are reusing an old SD card make sure it is fully formatted to remove any old files using the free tool at http://sdcard.org

Install Raspbian on your Raspberry Pi

Download NOOBS (New Out Of the Box Software) from the Raspberry Pi website (https://www.raspberrypi.org/downloads/). This is an easy operating system installation manager.

Open the .zip you downloaded and select all files, then just drag and drop them onto your SD card.

Insert the SD card in the Raspberry Pi then connect a monitor, keyboard and power cable.

Connecting the power will cause the Raspberry Pi to boot up and the green and red LEDs on the board should light up.

If the files are copied properly onto the SD card the green light will start flashing as the computer reads the data.

After a few seconds you will see a window open on the monitor with a range of operating systems to install – use the arrow keys on the keyboard to choose Raspbian and hit ENTER to install.

N.B. If you have trouble getting the NOOBS installation manager to work, you can also install Raspbian by copying the disk image of the operating system onto your micro SD card. Follow the instructions at https://www.raspberrypi.org/downloads/ to do this.

Change the default password

Before you go any further, make sure you change the default password, or anyone who knows the default will be able to access your home network.

You can do this from the options screen you are shown the first time you boot up your Raspberry Pi after Raspbian is installed.

When you next reboot your Raspberry Pi the login will be “pi” and the password whatever you have set.

Give your Raspberry Pi a static IP address

The IP address is what tells devices where to find your Raspberry Pi on your home network.

Networks usually issue a dynamic IP address, which can change each time you power up the device. If you want to be able to consistently connect to your Raspberry Pi from outside your home network you need to fix its IP address so that it is always the same – a static IP address.

Connect your Raspberry Pi to your router with an Ethernet cable.

At command prompt type:

ifconfig

A bunch of information will come up and you need to note down what it says for your set against the following:

inet addr [Current IP Address]

bcast [Broadcast Range]

mask [Subnet Mask]

Next at the command prompt type:

sudo route -n

This tells you information about your router. Note down:

Gateway

Destination

You now have all the information you need about your current IP set up and can edit the network configuration file to make the IP static.

At command prompt type:

sudo nano /etc/network/interfaces

Look for the line that reads “iface eth0 inet dhcp” or “iface eth0 inet manual”.

The “dhcp” bit is requesting a dynamic IP or if your file says “manual” it is a manual setting, so use the arrow keys on your keyboard to move the cursor so you can delete this and replace it with “static”.

Next put your cursor at the end of this line and hit Enter, then add the following lines directly below the line you just altered, filling the [square brackets] with the information you just noted down.

address [your current IP address]

netmask [your subnet mask]

network [your destination]

broadcast [your broadcast range]

gateway [your gateway]

To save the file press CTRL and X together, when prompted to save type “y” and hit Enter to accept the file name without changing it.

At the command prompt type:

sudo reboot

Your Raspberry Pi will now restart with the new, static IP address.

----------

If you liked this article, please subscribe to our YouTube Channel for tech news, reviews and video tutorials. You can also find us on Twitter, Instagram and Facebook.

3 Comments

Leave a Reply
  1. I have setup the vpn on raspberry pi 3 by following this article but i am unable to connect to vpn server
    internet connected to raspberry via wlan
    so where ever eth0 is mentioned i have replace it with wlan0

    Contacting xxx.xx.xxx.xx:xxxx via UDP
    EVENT:WAIT
    Connecting to[dynamidns name]:xxxx (xxx.xx.xxx.xx)via UDPv4
    Server pol timeout,trying next remote entry…
    EVENT:CONNECTION TIMEOUT
    EVENT:DISCONNECTED

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

A Quick Glance into iOS 9 and it’s Coolest Features

‘iOS Crash Warnings’ Popups is a Scam