Connect with us

Hi, what are you looking for?

Latest

How to install OpenVPN on Ubuntu 20.04.

How to install OpenVPN on Ubuntu 20.04.

OpenVPN is an open, fast and popular program for creating a VPN (Virtual Private Network). It uses both TCP and UDP transmission protocols, and VPN tunnels are protected by the OpenVPN protocol with SSL/TLS authentication, certificates, credentials, and, optionally, MAC address blocking and multi-factor authentication.

It can be used on different devices and systems. Like most VPN protocols, it has a client-server architecture. The OpenVPN access server runs on a Linux system and clients can be installed on other Linux, Windows and MacOS systems and mobile operating systems such as Android, Windows Mobile and iOS.

The OpenVPN Access Server accepts incoming VPN connections and OpenVPN Connect clients or any OpenVPN-compatible Open Source client can establish a connection to the server.

In this article you will learn how to configure the OpenVPN Access Server under Ubuntu 20.04 and how to connect VPN clients from other Linux systems.

Requirements:

Step 1: Configuring the OpenVPN server on Ubuntu

1. My experience is that the manual installation and configuration of the OpenVPN server is not an easy task. That’s why we use a script that allows you to configure your own secure OpenVPN server within seconds.

Before downloading and running the script, please note that the script automatically detects your server’s personal IP address. But you should consider the public IP address of your server, especially if it is running behind NAT.

To find out the public IP address of your server, use the following wget or dig command

$ wget -qO – icanhazip.com
OR
$ dig +short myip.opendns.com @resolver1.opendns.com

How to install OpenVPN on Ubuntu 20.04.

Check the IP address of the Ubuntu server

2. Now run the installation script with the command line program curl and make it executable with the command chmod as follows

$ twist -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
$ chmod +x openvpn-install.sh

3. Then run the script to install the executable as shown in the figure.

$ sudo bash openvpn-install.sh

When you run the script for the first time, it will ask you some questions, read them carefully, and give you answers based on your preferences for configuring your OpenVPN server.

How to install OpenVPN on Ubuntu 20.04.

Run the OpenVPN installation script

4. Once the VPN installation process is complete, the client configuration file is written to the current workbook. This is the file you will use to configure your OpenVPN client as described in the next section.

How to install OpenVPN on Ubuntu 20.04.

OpenVPN Installation Overview

5. Then confirm that the OpenVPN service is running by checking its status with the following system command

$ status sudo systemctl openvpn

6. Also make sure the OpenVPN daemon is listening on the port on which you requested the script with the ss command, as shown in the figure.

$ sudo ss -tupln | grep openvpn

How to install OpenVPN on Ubuntu 20.04.

Check the OpenVPN listening port

7. If you check your network interfaces and the new VPN tunnel interface has been created, you can confirm this with the IP command.

IP address

How to install OpenVPN on Ubuntu 20.04.

Check VPN tunnel interface

Step 2: Configuring OpenVPN clients in Ubuntu

8. Now it’s time to configure your OpenVPN client and connect it to the VPN server. First install the OpenVPN package on the client computer as follows

install sudo yum openvpn #CentOS 8/7/6
$ install sudo apt openvpn #Ubuntu/Debian
$ install sudo dnf openvpn #Fedora 22+/CentOS 8

9. You also need to install the network manager-openvpn package on the desktop system to make VPN settings via the GUI.

sudo yum install network manager-openvpn #CentOS 8/7/6
$ sudo apt install network manager-openvpn #Ubuntu/Debian
$ sudo dnf install network manager-openvpn #Fedora 22+/CentOS 8

10. After the installation of the above packages, start the OpenVPN service and in the meantime have it start automatically at startup and check its status to make sure it works.

sudo systemctl start openvpn
$ sudo systemctl start openvpn
$ status sudo systemctl openvpn

11. You must now import the OpenVPN client settings from the OpenVPN server. Open the terminal window and use the SCP command to capture the file as shown in the image.

cd ~
$ scp [protected by email]:/home/tecmint/tecmint.ovpn .

How to install OpenVPN on Ubuntu 20.04.

Importing OpenVPN client settings

12. Open System Preferences and go to the Networks section. Click the Add button under the VPN to get the options you need.

How to install OpenVPN on Ubuntu 20.04.

Add a new VPN configuration

13. In the pop-up window, select the Import from file option as shown in the following screenshot Then go to your file manager and select the .ovpn client configuration file downloaded from the server.

How to install OpenVPN on Ubuntu 20.04.

Import VPN settings

How to install OpenVPN on Ubuntu 20.04.

Select the OpenVPN file you want to import

14. On other Linux desktop systems, click on the network icon in the taskbar and go to Network Connections. Then press the plus button to add a new connection. From the drop-down list, select Import registered VPN configuration… as shown in the following figure.

Connect and import the file.

How to install OpenVPN on Ubuntu 20.04.

Import VPN Client Settings

15. After importing the file, add the VPN settings as shown in the following screenshot and then click Add.

How to install OpenVPN on Ubuntu 20.04.

Add VPN settings

16. Your VPN client settings must be successfully added. You can connect to the OpenVPN server by enabling the VPN as shown in the following screenshot

How to install OpenVPN on Ubuntu 20.04.

Connecting to the VPN

17. The VPN connection must now be successfully established, as shown in the following screenshot.

How to install OpenVPN on Ubuntu 20.04.

Successful VPN connection

18. If you check the connections on your network interface with the add IP command, a VPN tunnel interface should now be available, as shown in the following screenshot.

IP address

How to install OpenVPN on Ubuntu 20.04.

Check VPN tunnel interface

Connecting another Linux server as VPN client

19. To connect another Linux server as a VPN client, make sure you have installed the OpenVPN package, started the OpenVPN service as described above, and enabled it.

Then download the .ovpn client file and copy it to the /etc/openvpn/ folder as shown in the image.

scp [protected by email]:/home/tecmint/tecmint.ovpn .
$ ls
$ sudo cp tecmint.ovpn /etc/openvpn/client.conf

How to install OpenVPN on Ubuntu 20.04.

Download the Openvpn client file

20. Then start the VPN Client Service, activate it and check the status with the following commands.

$ sudo systemctl start [secure email]
$ sudo systemctl start [secure email]
$ sudo systemctl status [secure email]

How to install OpenVPN on Ubuntu 20.04.

Run OpenVPN customer service

21. Then make sure that the VPN tunnel interface is created with the IP Add command, as shown in the image.

IP address

How to install OpenVPN on Ubuntu 20.04.

Confirm VPN Tunnel Interface

22. To configure other OpenVPN clients on operating systems, use the following clients:

23. If you want to add a new UN user, lock an existing user, or remove the OpenVPN server from your system, just run the installation script again. Then select what you want to do from the list of options and follow the instructions.

$ sudo bash openvpn-install.sh

How to install OpenVPN on Ubuntu 20.04.

Removing OpenVPN in Ubuntu

This brings us to the end of this guide. If you would like to share your thoughts or ask us a question, please use the feedback form below. For more information, see the Github script repository with openvpn installation.

You May Also Like

Hosting

The latest round of MITRE ATT&CK evaluations proved yet again that Microsoft customers can trust they are fully protected even in the face of...

Hosting

As the robot process automation (RPA) market becomes more and more dynamic, more and more companies are trying to integrate RPA into their business...

Hosting

On Thursday, April 23rd, 2020, Canonical Ltd, the makers of Ubuntu Linux distribution officially released the long-awaited Ubuntu 20.04 version code-named “Focal Fossa”, it...

Latest

One of the most discussed new features in Ubuntu 20.04 is the dark mode. You can install a dark theme in any version of...