Painless VPN Set-up on Kali Linux

October 25, 2017

If you follow me on Instagram or Twitter, you know that I love the command line and use a dedicated Thinkpad T420 as my “hacking machine”. While I’m new to Kali, I’ve been a Linux user for a while — dating back to my first-year of university in 2007. I have a pretty strong love-hate relationship with Linux. While I mostly love Linux distros and would gladly use one as my primary work OS, troubleshooting hardware issues between Ubuntu and Apple hardware has caused me some grief in the past.

But I digress.

For a network security course I’m taking, we needed to play around with Nmap and a lab network set-up by our professor at Ryerson. I’ve used many a VPN before, but not with Linux and certainly not with Kali. I kind of expected a GUI like I’ve had in the past with OSX or Windows, and while I’ve realized that you *can *access one:

sudo apt-get install network-manager-openvpn
sudo apt-get install network-manager-openvpn-gnome

the CLI is much easier to work with and likely already installed for you.

It’s a pretty painless process, but finding some kind of set-up tutorial online proved surprisingly difficult.

If you don’t have OpenVPN installed already, run

sudo apt-get install openvpn

Next, grab the config file you’d like to use. If you’re in a class, it’s probably provided by your professor or whoever’s providing you with a network to pen test. Otherwise, you can find other config files online to play around with.

You will likely have 2 files provided to you: a config file with the filetype “.opvn”, and a certificate file.

We’re going to add the certificate file and the config file to the equivalent of a Windows config folder in Kali.

mv config-file /etc/openvpn/config-file;
mv cert-file /etc/openvpn/cert-file

That’s basically it! To spin up the VPN, run:

openvpn — config /etc/openvpn/config-file;

You’ll likely be asked to authenticate with whatever username and password you’ve been given to access the network.

sudo nohup openvpn — config /etc/openvpn/cert-file.ovpn &;

Note that the command above will start the VPN in the foreground and will terminate when the terminal is closed.

If you’d rather run the VPN in the background and not terminate when closing terminal, run:

I read several SO posts and random tutorials to get to this point, but some didn’t quite work or were too dated. The most useful site was easily, which is actually a VPN client.

Hopefully this saved someone out there some time.

Next Post

You may also like

Leave a Reply