Posts Tagged ‘VPN’

How To Set Up An OpenVPN Client On Linux

September 28th, 2016 No comments

Getting a VPN set up right on your Linux machine has a number of advantages, especially today when online privacy is a must and files are being shared remotely more extensively than ever. First off, securing your connection with a virtual private network will keep your online traffic encrypted and safe from hackers and other people with malicious intents. But originally, VPNs weren’t used for that reason at all; rather, they were exactly what the name suggests: virtual private networks. By connecting to a VPN, your computer and, for example, your colleague’s remote computer (that’s not physically connected to it via a LAN cable), can “see” each other as if they were part of a local area network and share files via the Internet. VPNs can also be utilized for remotely accessing a computer to offer assistance, or for whatever other reason you’d need to.

OpenVPN is regarded as one of the most secure and most efficient tunneling protocols for VPNs, and fortunately enough it’s quite simple to set up an OpenVPN client on a Linux computer if you know your way around the terminal.

Installing and Configuring The Client

First of all, you have to install the OpenVPN package, which you can easily do via the terminal command sudo apt-get install openvpn. Enter your sudo password (the password of your account) and press Enter. A few dependencies ask for permission to be installed, so just accept all of them for the installation to finish.

Then you’ll have to grab a few certificates off the server that the client side needs in order for OpenVPN to work. Locate the following files on your server PC and put them on a flash drive, so that you can copy them to your client PC:

  • /etc/openvpn/easy-rsa/keys/hostname.crt

  • /etc/openvpn/easy-rsa/keys/hostname.key

  • /etc/openvpn/ca.crt

  • /etc/openvpn/ta.key

Copy all of the files to the /etc/openvpn directory of your client PC (note that instead of “hostname”, in the first two files, it will be the hostname of your client). To further configure the client you have to use the command sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn, which copies a sample configuration file to the right directory.

Editing The Configuration File

Use a text editor such as gpedit to open the client.conf file and locate the following text:

dev tap
remote 1181
cert hostname.crt
key hostname.key
tls-auth ta.key 1

You need to make a few changes here. Instead of “”, put your server’s address. “1181” should be the port of your OpenVPN server, and “hostname” should, once again, be the actual name of the certificates that you copied to etc/openvpn/easy-rsa/keys a moment ago.

Now that you’ve set all of this up, you need to restart OpenVPN with the following command: sudo /etc/init.d/openvpn restart. Your remote local area network should be accessible now, which you can check by pinging the server’s VPN IP address.

Setting Up A Graphic UI Tool for OpenVPN

Unless you feel like using the terminal to navigate to every file and folder on your virtual network, it’s a good idea to set up some kind of a GUI. The Gadmin OpenVPN client does a fantastic job at this, and it’s real simple to set up, either via the Ubuntu Software Center, Synaptic or PackageKit. No matter what you choose, once it’s installed simply run the command sudo gadmin-openvpn-client and a neat graphic user interface will appear on the screen.

Now all you have to do is input some information about the server, and you’re set. Fill in the Connection name (what you’d like the connection to your VPN to be called), the Server address (the IP address of your OpenVPN server), the Server port, and the location of the certificates (the ca.crt and ta.key files mentioned earlier). Once you’re done with that, click the Add button, select the connection that you’ve just created and click Activate. Your VPN network will now be accessible.

That’s it, you’re done! You now have your own OpenVPN server that you can use to share data. Note that there are plenty other GUI tools for VPNs to be found in the Software store, so if you don’t like Gadmin, you can always use something else and still have access to OpenVPN, just through a different interface.


As you can see, it’s pretty simple to set up an OpenVPN client and connect to an existing VPN server. Setting up an OpenVPN server on Linux is a bit more of a challenge, though it’s perfectly possible. For a better and smoother experience, though, you might want to think about subscribing to a dedicated VPN provider, such as ExpressVPN. It’s not free, but it’ll give you greater security and stability, and save you the hassle of maintaining an OpenVPN server by yourself. If you’re interested, you should check out some ExpressVPN reviews before you make your choice.

Thomas Milva is an IT Security Analyst, Web entrepreneur and Tech enthusiast. He is the co-editor of

vpnc and me

September 17th, 2009 4 comments

After a brief hiatus of making posts (I document my daily trials all day at work, so it’s not usually the first thing I want to do when I get home) I’ve decided to make a beneficial post about how I can now do WORK (from home) on my Fedora 11-based laptop.  Hooray!

At the corporation where I work, our network and firewall infrastructure is – of course – Cisco-based.  Naturally, in order to connect to our corporate network from home, we use Cisco’s own VPN Client.  For distribution to various users across the company, my workplace has provided discs with pre-configured installations of this client, all set and ready to go to connect to our corporate network.  This prevents the dissemination of unnecessary information (VPN IP addresses, etc.) across the ranks, and makes it much easier for the non-savvy user to get connected.

I’ve all ready had a bit of experience using this client on my Windows Vista and Windows 7-based computers.  Unfortunately for me, the Cisco VPN Client we use at work only operates in a 32-bit Windows environment… meaning that on Windows Vista, I had to run a full-fledged copy of Virtual PC with a Windows XP installation.  In Windows 7, I was fortunate enough to be able to use its own built-in Windows XP Mode.

Trial and Error

My first thought to get this software working under Fedora 11 was probably the most simple – run it in Wine!  I’ve had limited experience with Wine in the past, but figured that it was probably my best bet to get the Windows-only Cisco client functioning.  Unfortunately for me, attempting to install the program in Wine only results in a TCP/IP stack error, so that was out of the question.

My next thought – slightly better than the first – came when it was announced that I could nab a copy of the Linux version of the Cisco VPN Client from work.  As luck might have it, it’s a bitch of a program to compile and install, and I had to stop myself short of throwing my laptop into the middle of our busy street before I just gave up.

Better Ideas

At this point, I was just about ready to try anything that could possibly get VPN connectivity working for me on my laptop.  Luckily, a quick search of ‘Cisco VPN Linux’ in Google shot back the wondrous program that is vpnc.  After seeing various peoples’ success with vpnc – a fully Linux-compatible Cisco VPN equivalent – I did a bit of reading up on the documentation and quickly installed it using yum:

$ yum install vpnc.x86_64

There, easy enough.  Further reading on vpnc indicated that I needed to edit a file known as default.conf – located in the /etc/vpnc directory – to store my VPN settings for work, if desired.  Opening up the config file included with the Windows version of the client, I pretty much copied everything over verbatim:

$ cd /etc/vpnc

$ nano default.conf

IPSec gateway [corporate VPN address]

Xauth username [domain ID]

Xauth password [domain password]

Domain [corporate domain]

From there, I performed a write out to the default.conf and saved my information.  The only complaint I might have about this step is that everything in this file is stored as plain-text, and does not appear encrypted whatsoever.  Since we are using a WPA2-encrypted wireless network and the VPN tunnel is secured, I wasn’t too concerned – but still.

At this point, I was now ready to test vpnc connectivity.  Typing in at the terminal

$ vpnc default.conf

I was rewarded with a triumphant ‘vpnc started in background’.  Hooray!  But what to do from here – how to connect to my work computer?  On Windows, I just use Remote Desktop… so logic following through as it does, I typed:

$ rdesktop [computername].[domain]

Instantly, I was showered in the beauty that was a full-screen representation of my Windows XP Professional-based work computer.

A shot of vpnc running in terminal, and my desktop running in rdesktop.

A shot of vpnc running in terminal, and my desktop running in rdesktop.

It certainly was not as easy a process as I’m making it out to be here – indeed, I did have to figure out to add .[domain] to the end of my computer name, as well as allow vpnc’s ports to flow through by performing a terminal netstat command and then opening them accordingly in the Fedora firewall – but I am now connected to work flawlessly, using open-source software.

I am currently running Gnome 2.26 on top of Fedora 11 (Leonidas). Check out my profile for more information.
Categories: Dana H, Fedora, Linux Tags: , , , ,