VPN is stands for Virtual Private Network. It extends a private network across a public network, and enables users to send and and receive data across shared or public networks as if their device were directly connected to the private network. Previously we have discussed about VPN and other things in this detailed post. We will got many free or paid VPN on internet but in this tutorial we will learn how we can create our own VPN server in our Kali Linux operating system.


To create our own VPN server we use OpenVPN software. OpenVPN is a free and open source software that implements virtual private network. This is also very secured. Now we configure our VPN server.

First of all we need to download the installation file for OpenVPN software, to do this we open our terminal in Kali Linux and enter the following command:
wget https://git.io/vpn -O openvpn-install.sh

Then it will start download as following screenshot :

Screenshot from 2019-11-24 08-18-34.png

If we are in lower version of Debian (Some of Kali Linux 2020.3 may need) then we need to download it by using this following command:
wget https://git.io/vpn1604 -O openvpn-install.sh

This bash script will download and install OpenVPN for us. First we need to to give permission to run using this command:
chmod +x openvpn-install.sh

we just need to run this script using following command:
sudo ./openvpn-install.sh

Now this script will ask our public IP and it will automatically collect our public IP address, if not then we need to manually put our public IP, If we have IPV6 then this tool will ask for it. To find IP address manually we can use following command:
curl -s http://tnx.nl/ip

Screenshot from 2019-11-27 07-41-42.png

Then we need to choose a connection type for OpenVPN. Here UDP protocol is recommended so we choose 1.

Screenshot from 2019-11-27 07-44-38.png

Now we need to select the port where we want to set listening of OpenVPN. Here the default port is 1194, and we are going with default. The screenshot is following:

Screenshot from 2019-11-27 07-47-02.png

Then we need to choose DNS we want to use with VPN. Here we got some options:
  • Current system resolver
  • (Cloudflare)
  • Google
  • OpenDNS
  • Verisign
Here we use Google's DNS so we type 3 and press enter.

Screenshot from 2019-11-27 07-57-30.png

Finally, we need to type a name for the client certificate, here we can choose any client name:

Screenshot from 2019-11-27 07-59-48.png

Now we have set everything to run OpenVPN server. Now we need to press any key to configure our OpenVPN server. Configuring OpenVPN server in Our Kali Linux system will take some time depending our system's speed. After process complete we got our OpenVPN client configuration file as shown in following screenshot:

Screenshot from 2019-11-27 08-06-13.png

Now using this kali.ovpn config file we can connect with our VPN server, from any other device, but here we must run OpenVPN server in our Kali Linux machine. To check the OpenVPN server status we run following command in our Kali Linux terminal:
sudo service [email protected] status

After running the command we can see the screenshot of OpenVPN server in the following screenshot:

Screenshot from 2019-11-27 08-11-18.png

We can see the server is running.

This server will automatically starts when the system boot up. To turn it off manually we can enter following command:
sudo service [email protected] stop

To start it manually we can use this following command:
sudo service [email protected] start

Let's see how we can connect our VPN over internet means when we are out of our local network. To do this we need port forwarding and a ststic IP. First of all we fix our local IP from the wifi settings IPV4 tab.

Screenshot from 2019-11-27 08-20-44.png

Now we need to forward our 1194 port (Default port for OpenVPN) in UDP, from our router's settings. Then we need a static public IP. Usually we get dynamic IP from our internet service provider. We can ask them to provide to provide us a static IP or we can use some tool like noip.

Then we can connect any device with our VPN server from anywhere.

For this we need the OpenVPN file in connecting device. OpenVPN client is available for almost every major operating system for free. We can run the ovpn file using OpenVPN software in Windows, Mac, Linux, Android, iOS etc.

That is how we can set our own VPN server in Kali Linux and connect with them from anywhere.

Follow us on GitHub and Twitter we posts updates there and for any queries or suggestions freely ask anything in the comment section. We always reply.
TAGs: Tags
kali linux openvpn server vpn vpn server