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:
Then it will start download as following screenshot :
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:
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:
Then it will start download as following screenshot :
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:
This bash script will download and install OpenVPN for us. First we need to to give permission to run using this command:
we just need to run this script using following command:
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:
we just need to run this script using following command:
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:
Then we need to choose a connection type for OpenVPN. Here UDP protocol is recommended so we choose 1.
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:
Then we need to choose DNS we want to use with VPN. Here we got some options:
Here we use Google's DNS so we type 3 and press enter.- Current system resolver
- 1.1.1.1 (Cloudflare)
- OpenDNS
- Verisign
Finally, we need to type a name for the client certificate, here we can choose any client name:
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:
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:
After running the command we can see the screenshot of OpenVPN server in the following screenshot:
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:
To start it manually we can use this following command:
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.
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.
Please don't forgot to follow us by using e-mail from the sidebar. Also 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.