How To Setup VPN On Linux


Table of Contents

Virtual Private NetworkVPN‘ is a secure network connection to the server that enables a computer or network-enabled device to send and receive data across shared or public networks.

Using a VPN allows a user to connect to any website that has been blocked either by a network administrator or Government. In the following tutorial, we will setup VPN on Linux, Ubuntu-based distributions.

VPN is often used to access some blocked websites or services by country Government. Some countries (for example China blocks the access of Youtube) have blocked many popular websites on the Internet. Those who believe in the freedom of accessing everything on the Internet, they use VPN services to access such blocked websites.

Other than accessing blocked websites, VPN technology is also used by individual Internet users to secure their wireless transactions to circumvent geo-restrictions and to connect to proxy servers for the purpose of protecting personal identity and location.

There are many online services that sell VPN services but I’ll use a free service VPNBOOK.

Our Free VPN (Virtual Private Network) server is designed with the latest technologies and most advanced cryptographic techniques to keep you safe on the internet from prying eyes and hackers. Our VPN securely routing all your internet traffic through an encrypted tunnel to bypass government censorship, defeat corporate surveillance and monitoring by your ISP. VPNBook strives to keep the internet a safe and free place by providing free and secure PPTP and OpenVPN service access for everyone.


Setup VPN In Ubuntu Or Other Ubuntu Based Distributions

1.   Create a OpenVPN free account.

Complete all the fields and confirm the email account. After this, we’ll setup vpn using our OpenVPN account.

2.   Goto and click the OpenVPN tab and download any one of the given certificate bundles. Also, note down the username and password as highlighted below in the image.

download openvpn certificate bundles
  • Extract the downloaded bundle and create 3 new document files within the extracted folder and name them ca.crt, certificate.crt, and key.key as shown in the image below –
  • Open any of the .ovpn files in the text editor, I’m using vpnbook-euro1-tcp80.ovpn. Copy certain text from this .ovpn file to the created text files ca.crt, certificate.crt and key.key.

Copy all text between <ca> </ca> tags and paste into ca.crt file.

Copy all text between <cert> </cert> tags and paste into certificate.crt file.

Copy all text between <key> </key> tags and paste into key.key file.

Once you have copied everything into ca.crt, certificate.crt, and key.key then save them.

3.  Now setup OpenVPN connection in the system

  • Open the terminal and install VPN Plugin.
$ sudo apt-get install network-manager-openvpn
install vpn plugin in linux ubuntu
  • Now open system network configuration and click Configure VPN and add OpenVPN network as in image below.
  • Now Fill all the fields as below-

Connection name – It can be any name you want.
Gateway – IP Address of the profile you chose (click here for image example) vpnbook-euro1-tcp80.ovpn
Type – Password with Certificates (TLS)
Username – Enter username from step 2
Password – Enter password from step 2
User Certificate – Browse certificate.crt file
CA Certificate – Browse ca.crt
Private Key – Browse key.key file
Private Key Password – Leave it blank

  • Click the Advance button

Open your .ovpn file (I’m using vpnbook-euro1-tcp80.ovpn)

Use custom gateway port – port from your .ovpn file (click here for image example)
Use LZO data compression
Use a TCP connection
Switch to Security tab

Cipher – Choose from your selected .ovpn file (AES-128-CBC in my file) (click here for image example)

 edit vpn network advanced settings   edit vpn network security settings  
  • Click OK and save all settings. Now you are done! 

From network menu connect to VPN and you are all done! You have now configured a VPN connection successfully into your Linux machine.

As I mentioned above, VPN is not merely used to access some blocked websites. VPN is higly recommended when connected to any public wifi. It’ll make your data secure and make it extremely difficult to crack open your data files transferred through that Wifi by any middleman. So do setup vpn if you are using a public wifi.

Linux TutorialsUncategorized