How to make secure internet connection by using Raspberry pi

  • calendar_today  Jan, 23 2019
  • visibility  2,328

Public Wi-Fi networks are available everywhere. Well, there is no doubt that they are favorable. But how many of you expect that they are encrypted. Would you like to start your personal conversation with that encrypted Wi-Fi network or would you like to start your online banking with that cipher network that has kept a hidden eye on you? Yes, you’re right “Never, Never Never”. So, what is the best solution for this daily-life mistake? 

In today’s article, we’re going to discuss “How to make your secure internet connection by using Raspberry pi”. So, let’s get started.

Installing Pi-VPN

First of all, power up your Raspberry Pi and access the terminal. Remember, you’ve to type the mentioned command for starting the installation of Pi-VPN.

curl -L | bash

Now, leave the rest to this magical command. It will do everything for you. The installation will take a few minutes. If you’ve updated your raspberry pi, then a window will occur in which Pi-VPN will ask from you to proceed. Press Enter.

Now, you’ve a next window, in which the Pi-VPN is saying “I am going to use Static IP address”, Press Enter for it too. 

In the third step, the Pi-VPN will ask from you that “Can I use the current IP address and Gateways?” Select the “YES” option and move forward.

Ignore the forth step, press enter and move forward. 

Now, in the fifth step, Pi-VPN is asking you “Choose a local user that will hold your ovpn configurations”. Press Enter.

Ok, now, select your user by pressing Enter. 

After choosing the user, the next window will occur in Pi-VPN will say that “it is recommended you enable unattached upgrades.” This means that whenever a new security occurs, the system will enhance or upgrade automatically. Press Enter.

Well, it is highly recommended to upgrade your system always everywhere. So select “Yes” on the next window too.

As we know that Open VPNS run on two protocols. One is UDP (User Datagram Protocol) and another is TCP (Transmission Control Protocol). Here, we are going to choose the faster one and that is UDP. So Select “UDP”. Press Enter and mover forward.

In the next step Pi-VPN will ask you about the port number. The default port number is 1194. But for high security, we will recommend you to change it. By doing this, no one can easily know about you that you are using VPN. For practice, you can use the default one. Press Enter and proceed.

In the next step, press enter for verifying your port number. 

In this step, Pi-VPN will ask you about the desired levels of encryption. By default, you’ll three levels

  1. 1024 (Faster and takes little time and give you low-quality encryption)
  2. 2048 (Slower and takes more time than 1024 and give you good quality encryption)
  3. 4098 (Will take too much time but will provide you the best quality encryption)

The recommended encryption key size is 2048. But for the time-being and for time-saving, we will choose 1024 encryption key. 

After the selecting encryption strength process, the Pi-VPN will provide you the option for choosing the public IP or want to use the DNS entry. Select the DNS entry and press enter. 

Now, the Pi-VPN will ask you “What is the public DNS name of this server”? If domain name already exists with you, then enter the DNS name of the server and if you have no domain name, then you can also make it for free at

Now, Pi-VPN will ask you about the DNS provider, so for ease of use, select the Google.

Hurrah, your Pi-VPN installation is completed.

Time to add the users

OK, now it’s time to add new users. 

In this step, it will ask you to restart your Raspberry Pi. Press Enter to “Yes”.

Setting up the Open VPN is very difficult so for the ease-of-use, we will type some magical commands of Pi-VPN which will do all the tasks for us. Type the mentioned commands in the terminal for adding new users. 

sudo pivpn add

Now, enter the name of the client and enter the password as shown. 

Alert: Do not forget the Password. 

Now a file is created for new user in your home/pi/ovpns folder. There, you will see the same client name file. Send the client name file on your mobile. The easiest way of sending this file is connect the mobile with your computer via data cable and send it or save it the draft section of your email and download it on your mobile.

The next step is open Google App store, search for OpenVPN application and download it. And connect yourself from there. 

After downloading the application, open it and it will give you three options

  1. Private Tunnel
  2. Access Server
  3. OVPN profile

Press OVPN profile and import the client name file that you have downloaded from your email or have transferred via data cable. During file loading, it will ask you for the password. That why, we’ve said earlier “Do not forget the password”. Enter the password that you’ve entered during making new user.

After the completion of file uploading, you can easily access it on OpenVPN. Now turn off the mobile’s wifi and touch the button to connect. The OpenVPN client will automatically connect to the Raspberry Pi. 

Well-done, at last you’ve build your own VPN. If the process is not completed successfully, then kindly follow this guide. 

Now your online banking, personal conversations, personal file transferring data is save. Now you can easily use the public Wi-Fi without any hesitation.