How to turn your Raspberry Pi into a VPN server?Connecting any VPN server to your router inevitably gets you an encrypted and secure connection from any place the world over to your personal network. This enables you to access files on the NAS without complicated configurations. Moreover, with the connection being encrypted, you don’t need to worry about your data getting intercepted if you use your laptop on a public Wi-Fi hotspot and since everything is in your control, your data remains completely safe, and you don’t need to rely on any other service. Making this VPN doesn’t require any special hardware. A simple Raspberry Pi can do the job. Here’s how you can setup a VPN server on Raspberry Pi.
How to Setup VPN Server on Raspberry Pi
Raspberry PI VPN Server Installation:
Here’s how you can set up your own Open VPN server on a Raspberry Pi.
Take aRaspbian Jessie PiVPN OpenVPN installer as its free No-IP service ensures perpetual connectivity with your VPN, even with your IP address changing. Use the Raspberry Pi in command-line mode (Raspbian’s Lite version) that comes without a graphical user interface and in a much smaller size.
Begin by downloading the raspbian-jessie (2017-07-05 zip file) and subsequently extract the .img file that’s inside it. Then install the Disk Imager (Win32) and plug the microSD card into a card reader, making sure that the card doesn’t contain anything that is needed by you. Make use of the Disk Imager (Win32) to transfer the Raspbian Jessie Lite image to your microSD card.
Run the Win32 Disk Imager. If you log in with a standard Windows account, you have to enter the password of your administrator. On the top, to the white box’s right, you will see a blue folder icon. Click on it and browse the Raspbian Jessie Lite .img file extracted earlier. Double-click on it.
Ensure that the microSD card’s listed under Device. Then click Write. When this process is over, take out the microSD card and insert the Raspberry Pi. Boot up. Then log in normally with the username – pi and raspberry as the password.
Here, the Raspberry Pi will do the job of a server, so hide in one corner next to the router. Set up your Raspberry Pi for remote control in a ‘crustless’ mode. This is possible by enabling an SSH or Secure Shell. Type sudo raspi-config.
Your most important job after this would be to change the password of the Raspberry Pi. This would enable you only to log in over an SSH. Click on option 1, entering the new password twice to finally change it. Next, move to Interface options.
Select the P2 SSH option, click Yes when the question on whether you would like the SSH server to be enabled flashes on the screen. The Raspberry Pi then confirms that the SSH is on. Move to Finish after this.
Finishing the VPN Server on RPi Setup
For finishing, you need to shut down your Raspberry Pi. Just type sudo shutdown, unplug the keyboard and monitor, followed by plugging the Raspberry Pi into the router using an Ethernet cable. The keyboard and monitor will now become redundant as your Raspberry Pi will now be controlled remotely.
Turn on the Raspberry Pi again, allowing it to boot up for about 30 seconds. Start locating the Raspberry Pi on the network by using the Fing Android app. Fing lists every device that is connected to the network, showing the Raspberry Pi as well as its IP address.
With Windows, using an Angry IP Scanner that requires Java gets your Raspberry Pi listed as raspberrypi.local in the Hostname column.
In order to establish connectivity with your Raspberry Pi, downloading and installing a PuTTY SSH client is required. This free PuTTY tool helps you remotely connect with the Raspberry Pi. You are now in a position to log in using your Raspberry Pi’s own username and password.
The advisable thing to do now is downloading and installing any Linux updates. This can be done by using the command sudo apt-get update and the sudo apt-get upgrade.
Start installing the OpenVPN. Key in https://install.pivpn.io | bash for starting the installer. Then set up a static IP address so that the router knows your Raspberry Pi’ location on the network.
This is required so that it can start sending incoming VPN traffic. Ensure that the IPv4 default gateway is already set to the router’s IP address and check if settings are right. Click on Yes to continue.
Follow all steps that help you select the appropriate user’s directory that stores OpenVPN’s configuration. Select the installed default ‘pi’ and then enable ‘unattended-upgrades’ to allow your Raspberry Pi to update itself automatically with security patches.
You now get a choice between selecting UDP or TCP protocols. Generally, UDP is preferred because it’s much quicker. Leave the port as the 1194 default and then press OK. Keep the port number written down somewhere and subsequently confirm that the port is right on the following screen.
Three encryption levels will be offered to you. Usually, the PiVPN installer recommends a 2,048-bit encryption but you also have the option of selecting 4,096 for maximum security. You can connect to your Pi by using a dynamic DNS service or your external IP address. The latter is an easier way since it requires less tinkering with the router.
Streaming gadgets geek. Interested in every little thing there is to know about bypassing regional restrictions. An avid believer in the right to protect online privacy. Charles has also reviewed plenty of VPN service providers and knows how to separate the good apples from the bad ones.