This blog is NOT OFFICIAL website of Kali Linux. We just share Tutorials to learn Cybersecurity.

How to set up own VPN server in 10 minutes on Kali Linux using OpenVPN

Home
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.

Make own VPN server in Kali Linux


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 :

installing OpenVPN installation tool

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

openvopn installer kali linux

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

openvpn for kali linux

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:

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

VPN server in Linux

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

How to set up own VPN server on Kali Linux using OpenVPN

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:

OpenVPN config file

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 openvpn-server@server status

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

openvpn server running in kali linux

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 openvpn-server@server stop

To start it manually we can use this following command:

sudo service openvpn-server@server 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.

fixing local ip

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.
author-img
Kali Linux

Comments

17 comments
Post a Comment
  • mahnoorburi photo
    mahnoorburiMarch 17, 2020 at 6:05 PM

    Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging..WPNeon

    Delete Comment
    • Anita ShawJuly 6, 2020 at 11:50 PM

      Thanks. Very valuable information.

      Delete Comment
      • Will ASeptember 6, 2020 at 7:30 AM

        When i try to install it says, "Debian 9 or higher is required to use this installer.
        This version of Debian is too old and unsupported."

        Delete Comment
        • Kali Linux photo
          Kali LinuxSeptember 6, 2020 at 7:45 AM

          Please run following commands:
          sudo apt-get update -y
          sudo apt-get upgrade -y
          sudo apt-get dist-upgrade -y

          These commands will take some time and upgrade your OS in to newer version.

          Delete Comment
          • AnonymousDecember 9, 2020 at 3:30 PM

            I did but it shows the same.

            Delete Comment
          • AnonymousSeptember 19, 2020 at 6:50 AM

            Im getting this error.
            https://prnt.sc/ujv1gs

            Do u know why ? Thx nice post

            Delete Comment
            • Kali Linux photo
              Kali LinuxSeptember 19, 2020 at 11:23 AM

              HI, we have updated our tutorial..Please check it.

              Delete Comment
              • AnonymousDecember 9, 2020 at 3:06 PM

                Same here

                Delete Comment
                • Kali Linux photo
                  Kali LinuxDecember 9, 2020 at 5:50 PM

                  Please delete previous file downloaded using first command and use the following command instead of the first command:

                  wget https://git.io/vpn1604 -O openvpn-install.sh

                  Delete Comment
                • YABRE photo
                  YABREOctober 14, 2020 at 9:26 PM

                  I have an error like below ;
                  kali@kali:~$ sudo service openvpn-server@server status
                  ● openvpn-server@server.service - OpenVPN service for server
                  Loaded: loaded (/lib/systemd/system/openvpn-server@.service; disabled>
                  Active: failed (Result: exit-code) since Wed 2020-10-14 15:38:19 UTC;>
                  Docs: man:openvpn(8)
                  https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
                  https://community.openvpn.net/openvpn/wiki/HOWTO
                  Main PID: 2421 (code=exited, status=1/FAILURE)

                  Oct 14 15:38:17 kali systemd[1]: openvpn-server@server.service: Main proce>
                  Oct 14 15:38:17 kali systemd[1]: openvpn-server@server.service: Failed wit>
                  Oct 14 15:38:17 kali systemd[1]: Failed to start OpenVPN service for serve>
                  Oct 14 15:38:19 kali systemd[1]: openvpn-server@server.service: Failed to >
                  Oct 14 15:38:19 kali systemd[1]: openvpn-server@server.service: Failed wit>
                  lines 1-13/13 (END)

                  Delete Comment
                  • Kali Linux photo
                    Kali LinuxOctober 15, 2020 at 7:30 AM

                    Your VPN server is not started well. Did you check every steps ?

                    Delete Comment
                  • YABRE photo
                    YABREOctober 15, 2020 at 9:13 AM

                    yes, I did as specified in the documentation

                    Delete Comment
                    • Kali Linux photo
                      Kali LinuxOctober 15, 2020 at 2:00 PM

                      Hi Yabre, We tried this after but we didn't get any issue with this. If we don't understand the issue we can't solve it. Feeling sorry for you.

                      Delete Comment
                    • AnonymousDecember 20, 2021 at 1:29 PM

                      连接已经失效,这个文章需要更新

                      Delete Comment
                      • AnonymousJuly 1, 2023 at 12:54 AM

                        hello, I followed the tutorial to the Tee... But I keep getting the same error.

                        Jun 30 12:18:58 kali systemd[1]: Failed to start openvpn-server@server.service - OpenVPN service for server.
                        ░░ Subject: A start job for unit openvpn-server@server.service has failed
                        ░░ Defined-By: systemd
                        ░░ Support: https://www.debian.org/support
                        ░░
                        ░░ A start job for unit openvpn-server@server.service has finished with a failure.
                        ░░
                        ░░ The job identifier is 14221 and the job result is failed.

                        I may sound like a noob, but someone please help.

                        Do I need to first open the port 1194 on my router before trying to start the vpn?

                        Delete Comment
                        google-playkhamsatmostaqltradent