Home » Linux » How To Connect Via OpenVPN On Ubuntu: Step by Step Guide

How To Connect Via OpenVPN On Ubuntu: Step by Step Guide

Virtual private networks or VPNs are essential for any Linux user who values their privacy. By establishing a secure VPN connection, you can protect your device’s IP address as well as encrypt the internet traffic between yourself and the VPN server.

Each VPN protocol has its own pros and cons. This guide will show you how to set up a secure OpenVPN connection on Ubuntu.

Why use OpenVPN in Ubuntu?

Ubuntu has supported OpenVPN out-of-the box for many years. This makes it easy to install.

This feature can be very useful if the VPN service you choose does not have a Linux client. Security-wise, it’s safer to connect directly to a VPN via Ubuntu Network Manager than install an additional app that may contain hidden bugs.

OpenVPN was established in 2001 and is known for its reliability, security, and compatibility with many devices. Ubuntu has built-in support of the protocol since 2018.

WireGuard is faster than OpenVPN.

Today, the latest technology is all around us. WireGuard VPN protocol has gained popularity as it is much faster than OpenVPN because it runs within the kernel.

OpenVPN had to copy packets of data from the kernel into user space to decrypt and then back to the kernel space to encrypt. It uses single-threaded computing, which means it only processes one instruction at a time.

OpenVPN is much slower because of these limitations. OpenVPN DCO has been developed to allow it to run in the kernel area and utilize multi-threaded processors. These improvements have reduced the speed difference between OpenVPN, and WireGuard. Check with your VPN provider if DCO is supported to benefit from this speed boost.

OpenVPN on Ubuntu: How it Works

To establish an OpenVPN Connection on Ubuntu, you simply need to download the relevant configuration files. Then import them into Network Manager using the GUI. If you want Ubuntu’s login to automatically connect to the OpenVPN Server, then the command line is all that is needed.

Step 1. Step 1.

For a secure OpenVPN, you will need the appropriate configuration (.ovpn files).

When you sign in to your account, most major VPN services offer this feature.

The configuration files contain key information, including the address of the server, the port used, information required to verify server identity, secure the TLS channel control, and other settings.

There will usually be a list with the configuration files of each VPN server that your VPN provider runs.

OpenVPN is compatible with both TCP and UDP. You may be offered configuration files for either protocol by your provider. If you’re uncertain, choose TCP — it can be slower, but overall, it makes for a more reliable connection.

Step 2. Step 3.

Then, go back to your Ubuntu desktop. Choose “Settings” from the network menu on the right side of the screen.

In the Network window, you’ll notice that the “VPN section” currently says “Not setup.” To display the “Add a VPN” window, click on the “+”. Then, click “Import File.” The.ovpn file that you downloaded earlier can be found here.

OpenVPN information will now be displayed in the network settings menu. The default settings are likely to be fine, but you should pay special attention to “Authentication”.

Enter your login details in the “User Name” and “Password” fields.

Some VPN providers require a password and login for OpenVPN manual setup. Verify that you are entering the correct information by contacting your VPN provider before you proceed. Click “Add”, located at the top-right.

Step 3. Step 3.

Now that your VPN configuration is fully imported, you’ll see it listed in the ‘VPN’ section of your Ubuntu network settings menu.

Click the gear icon next to the name of the configuration you want to import, and then select the “Identity tab.” From here, you can write something more memorable in the “Name” field, such as “Switzerland – OpenVPN.” Click on “Apply”, located at the top-right corner, to save your changes.

You can now click the rocker next to the VPN. Open your web browser and check if the VPN connection was established.

Use a website designed specifically for this purpose. DNS leak test.

If you choose “Extended test”, your DNS requests will be routed via VPN servers to prevent DNS leakage.

Step 4. Step 4.

If you wish to import more configuration files, repeat the steps 1 to 3. The tab for the relevant network settings window will list additional VPN connections.

You can only connect to one OpenVPN server at a given time. You will not be able to connect to an OpenVPN server if you are already connected to one.

The network icon is located at the top-right corner of Ubuntu. You can click it at any time to view the current OpenVPN connection.

Step 5. Step 5.

Ubuntu’s current network settings doesn’t allow automatic connections upon login.

It is important to note that the lack of an automatic feature for connecting is a concern in terms of security, as it is possible that you start using Internet apps without knowing your real IP address.

You can workaround the issue for now by using the old Ubuntu Connection Editor. You can run this command by opening Terminal.

sudo nm-connection-editor

Click the Settings gear on the bottom left to change the settings.

Click on the “General” tab and then click the checkbox marked “Automatically Connect to VPN.” Select your desired OpenVPN Server using the drop-down list on the right. Then click the Save button.

Connect Confidently

OpenVPN for Ubuntu is a safe and reliable way to protect and encrypt internet traffic and your privacy online. Follow the steps in this guide to set up and manage OpenVPN connections using Ubuntu’s Network Manager.

Don’t forget to test your VPN configurations to make sure it works as expected. For a more customized experience, you can adjust the advanced options to your specific needs. OpenVPN helps you protect and secure your digital life, whether you are browsing or working from a coffee shop.