You are here: Home » Network » Administration » How to configure OpenVPN client on Linux

How to configure OpenVPN client on Linux

Today I want to show you how to configure the OpenVPN client. I will present the configuration on the example of Linux operating system. On the Windows it is simple, but a lot of people do not know how to configure this on Linux machine. What is OpenVPN? It is an application which will allow you to create a virtual private connection with some network. Some users use this to change IP address, but a lot of companies use OpenVPN for authorized connection with their LAN network.

You really should use VPN connections, especially if you like Free WiFi hotspots. When you connect to a VPN, you usually launch a VPN client on your computer (or click a link on a special website), login with your credentials, and your computer exchanges trusted keys with a far away server.

I will show my installation on the Debian system. It is the most popular Linux. If you have got Ubuntu/Kubuntu then you will be able to perform the same steps.

  • At first you should install special application. You will need the openvpn package. OpenVPN is on the repository, so you can install via apt-get. If you would like to do it, you must open Terminal and put command. Then you can connect like this:
sudo apt-get install -y network-manager-openvpn


sudo apt-get install openvpn

The sudo is important because otherwise OpenVPN will not be able to establish the connection. I think that this is because of the fact that route table has to changed.

  • The next step is a create of the OVPN file. It is file with configuration of client. You should put a gateway address, port number, put special keys (ca, cert, key, tls-auth). Sample file looks like this
 dev tun
 proto udp
 remote 12194
 resolv-retry infinite
 ca /home/user/ca.crt # public cert
 cert /home/user/my_key.crt # private cert
 key /home/user/my_key.key # private key
 ns-cert-type server
 tls-auth /home/user/ca.key 1 # public key
 verb 3

This configuration have to be downloaded from server. If the server is your, then it will not be a problem. If it is not, then you must ask administrator about this.

  • Then you must pull the file to OpenVPN. You should do this via terminal. It is better that GUI.
sudo openvpn --config openvpn_config.opvn

To make it permanent, edit /etc/default/openvpn and uncomment the line AUTOSTART="all".