Open In App

Virtual Private Network (VPN) Setup in Kali Linux

Last Updated : 27 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

VPN (Virtual private network) is a technology that encrypts your internet traffic on unsecured networks to protect your online identity, hide your IP address, and shield your online data from third parties. VPNs use real-time encryption and send your internet data through a secure virtual tunnel to minimize the possibility of anyone tracking what you do online. A Virtual Private Network is a way to extend a private network using a public network such as the internet. 

Working of VPNs

When we connect to a VPN service, it authenticates the client with a VPN server and applies an encryption protocol to all of our internet data. The VPN service then creates an encrypted “tunnel” over the internet. That secures the data traveling between you and your destination. When we use a VPN service, cybercriminals, your ISP, and regular snoopers have a hard time tracking our actions online. 

Need of VPNs

A VPN service is necessary because of the following reasons:

  • VPN masks our IP Addresses and location so that we remain anonymous while surfing the internet.
  • It bypasses internet censorship and firewalls and we can also access region-restricted content.
  • It encrypts our network traffic.

Note: Search engines and platforms can still recognize you based on cookies sent by the browser along with the request.

VPN Installation and Setup in Kali Linux

VPN is not installed and enabled by default in Kali Linux which leaves you greyed out. To get this working, we need to download any VPN provider’s OpenVPN configuration files (.ovpn). A VPN service that supports Linux without supplying a native Linux client makes its OpenVPN configuration files available on its website. The information contained in these files can be used to create a VPN connection over Linux using the Network Manager, a third-party client.  For the demonstration purpose, we will install the necessary packages and set up the popular ProtonVPN service in Kali Linux. It provides a free version of ProtonVPN for public use and it is fast and secure.

Step-By-Step Installation and Setup 

Step 1: Install the OpenVPN and required packages

The first step is to install the OpenVPN. Open the terminal and type the below command :

sudo apt install openvpn
Installing OpenVPN Application

 

Once it gets installed using the commands below to install the OpenVPN packages using the apt command

sudo apt install network-manager-openvpn-gnome

Installing Network Manager for OpenVPN

 

Press Y/y and enter when being asked to install the packages. During the installation, a message box will get prompted asking for permission to restart services during the package upgrades, Type Yes to complete the installation.

Configuring libc4:amd64

 

Now we just need to restart the system for the changes made by installing the new OpenVPN packages to take effect.

Step 2: Download the VPN provider’s OpenVPN configuration file

For the demonstration purpose, we are using the ProtonVPN service so to download the required OpenVPN configuration files first click on the URL below and register or log in to start using its service. 

https://account.protonvpn.com/login⁠⁠⁠⁠⁠⁠⁠

Once you enter the into the account, select the Downloads option and then select the OpenVPN configuration files option, now choose GNU/Linux as the platform and leave the Protocol and Free server configs as the default. Now choose any of the servers listed below and click on download to save the (.ovpn) file to the system.

OVPN file download

 

Step 3: Configuring an OpenVPN

First, click on the Network Manager icon at the top right of the kali desktop screen. Select VPN Connections > Add a VPN connection. The Network Manager tab is shown below.

Add a VPN Connection

 

Now select the type of VPN we wish to use for the new connection. From the drop-down menu, select Import a saved VPN configuration option and then click on Create.

Importing saved VPN configuration

 

Now navigate to the location where we saved our provider’s OpenVPN configuration files and select the .ovpn file of the server to which we want to connect and then click on the option Open.

Opening VPN configuration file

 

Now the editing VPN window will appear for the username and the password for authentication. Click on the URL below :

https://account.protonvpn.com/account

Choose the OpenVPN / IKEv2 username option from the panel on the left side of the page.

Getting OpenVPN/IKEv2 username

 

 Copy the OpenVPN / IKEv2 username and password and paste it into the editing VPN window and click on Save.

Setting up VPN Authentication

 

Now we will be prompted with a dialogue box to create a keyring password. If we’ve created the keyring password before, we won’t see this prompt. Type and confirm your keyring password, and then click Continue. The OpenVPN connection is now configured.

 

Step 4: Enabling the VPN connection

To enable the new VPN connection, click on the Network Manager icon at the top right of the kali desktop and select VPN Connections and then click on the VPN you want to use.

Enabling VPN Connection

 

Once the connection is established, a notification will appear stating that we’re now connected to the VPN successfully. Now to confirm that the connection is successfully established turn off the VPN connection for a while and check for your public IP address using your browser as shown in the screenshot below.

Original Public IP

 

As you can see from the screenshot, my public IP address is 49.37.70.191. Now enable the VPN connection again and refresh the page. 

Public IP after VPN is enabled

 

As you can see from the screenshot above, my public IP address has been changed to 37.19.200.2.

We now have an OpenVPN connection to our VPN provider over Linux. We can add as many connections as we want by repeating the process. When we want to connect, we just need to select the server we want to connect to and turn it on from the Network Manager.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads