How To Setup Virtual Private Network (VPN) In Linux Ubuntu Based Distributions

Setup Virtual Private Network (VPN) In Linux Ubuntu

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 install and use VPN in our 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 such 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.

VPNBOOK says –

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 OpenVPN free account by clicking the following link –OpenVPNComplete all the fields and confirm the email account.

2.   Goto vpnbook.com and click OpenVPN tab and download any one of the given certificate bundles and 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 file 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.

configure VPN from linux network manager

choose OpenVPN connection type

  • 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 in linux

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.

enable vpn network from network manager in linux

confirmation message to successfully connected to vpn network

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This website uses cookies to improve your experience. We'll assume you're ok with this. Thank you! Accept Read More