Hello visitor, in this post I’ll explain step by step process to setup your own VPN server using Raspberry Pi and OpenVPN. Setting up a personal VPN server at home sounds terribly complicated stuff, but its very simple if You have a Raspberry Pi. VPN, or virtual private network, is a secure tunnel between two or more devices or it can hide your real Identity (IP Address) on the Internet.

What Are We Covering Today?

1. Installation steps of OpenVPN server on Raspberry Pi

2. Setting up your First VPN client

1. Steps to Setup an OpenVPN server

For this tutorial, I assume that you already have a Raspberry Pi with Raspbian OS. For this installation step, we will use PiVPN script.

Step 1: SSH into your Raspberry Pi and run the following command and start the Installation

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

Step 2: In this step, we have to set the Static IP for our Raspberry Pi, so select Ok and set a static IP address

Step 3: Now set the IP address and Default Gateway and select Yes to proceed further

own OpenVPN server

Step 4: In this step, you just need to specify the user that is going to hold the ovpn configuration, click Ok

own OpenVPN server

Step 5: In my case, there is a user Pi, so I’ll select user Pi and Proceed for the next step

own OpenVPN server

Step 6: Now, You have to choose between TCP and UDP, I’ll recommend you to go with UDP because TCP slows the connection as its a stateful protocol. So go with UDP

own OpenVPN server

Step 7: In this step, you have to select the Port for the OpneVPN server, I’ll recommed you to select the default port number i.e 1194 and confirm the settings

own OpenVPN server

Step 8: This step can be used to select the Installation mode, select No and hit enter

Step 9: Now in this step, we have to select the Encryption strength. I’ll recommend you to select 2048-bit for better performance

own OpenVPN server

Step 9: Now it will take some time to generate the RSA private key. actually its the longest part of this process, so keep patience and wait for the next step. This process will look like

own OpenVPN server

Step 10: Once the key generation process is done, the script will prompt you to chose a public IP or a dynamic DNS. for this, I’ll prefer to choose the Dynamic DNS because the most common issue is that most ISP’s assign different IP’s when you restart your router. so go with Dynamic DNS

own OpenVPN server

Step 11: I’ll use DuckDNS for this tutorial, you can use any Dynamic DNS service. Enter the DNS address which you have registerd on DuckDNS

own OpenVPN server

Step 12: In this step, we have to select a DNS provider. I’m fine with Google, so I’ll select Google DNS

own OpenVPN server

Step 13: Now after a min, the Installation will be done, and you can see the final Message of the PiVPN Script. Click ok to finish the Installation

own OpenVPN server

After the Installation, Script will ask you to reboot your Pi

2. Steps to Add a New VPN Client for Linux users

Step 1: Open terminal and type the following command to add a new Client

pivpn add

Step 2: Now add the name of the client and set a Password for Your VPN client

own OpenVPN server

Step 3: After that, a file with extension .ovpn will be created desired location. In my case the location of ovpn file is /home/pi/ovpns . Now change your working directory to that location using cd command as

own OpenVPN server

 

Now copy this ovpn file into your computer and Proceed for the next step below to connect VPN

Step 4: Now you have to download the OpenVPN connect client, which is used for to connect you to the Open VPN server. Click on the below links to download the Connect Client

  • for windows users, download here
  • for Linux users, download here
  • for Mac Users, download here

Step 5: Once you have done with step 4, Now run OpenVPN connect client software and click on import client Option and Import the .ovpn file which we have created in Step 3

Step 6: Now enter the Password you have entered in step 2

If you are getting any error in the connection, then check each and every step carefully. If you are still facing any problem then you can ping me here

 


Rajesh Ranjan

I'm a tech enthusiast currently pursuing B.Tech in Computer Science & Engineering. trying to make things as simple as possible

Leave a Reply