Setting up a VPN is a great way for a server to share network resources with a client. Configuring one, however, can seem a little intimidating to some users. In this guide, we'll show you how to setup a VPN using OpenVPN on Ubuntu 20.04 Focal Fossa, while managing to avoid advanced configuration and technical jargon along the way.
In this tutorial you will learn:
How to install OpenVPN
How to configure an OpenVPN Server
How to connect to a VPN server from client machine
How to verify a successful VPN connection
Starting OpenVPN Server on Ubuntu 20.04
Software Requirements and Linux Command Line Conventions
Requirements, Conventions or Software Version Used
Privileged access to your Linux system as root or via the sudo command.
You may also need to setup port forwarding on UDP 1194 on your router to host which will be running as OpenVPN server.
# - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user
OpenVPN Server setup
SUBSCRIBE TO NEWSLETTER Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
In this section, we will cover the steps to setup OpenVPN Server. A server listens for incoming connections from clients, and grants them access to the network upon successful authentication. If you only need to setup OpenVPN Client, which gives you the ability to connect to remote servers, then skip ahead to the next section.
Your client machine will need the static-OpenVPN.key encryption key file from the OpenVPN Server in order to connect. Transfer the file from the server to the client in a secure manner, with scp (secure copy) for example.
This is the command we'd issue from our client machine. Use your own scp command or another secure method to transfer the file: