Install Open VPN Server on ubuntu 22.04

17/02/2024 - 2 phút

Follow  on Google News

To connect from the external network to the servers in the LAN of the servers in the network, we need to configure the VPN Server for access, in this article, I will use Open VPN Server

Concept

  • OpenVPN is a full-featured SSL VPN (Virtual Private Network). It implements Layer 2 or 3 network extensions with the SSL/TLS protocol. It is open-source software and is distributed under the GNU GPL. VPN allows you to securely connect to an insecure public network such as WiFi at airports or hotels. VPN is also required to access your company, business, or home server resources. You can bypass geographically blocked websites and increase online privacy or security. This guide provides step-by-step instructions to configure an OpenVPN server on an Ubuntu Linux 22.04 server.

Instructions

To perform the installation, follow these steps:

Step 1: Update your system, your operating system, here I use Ubuntu 22.04

We update the packages with the apt command

sudo apt update && sudo apt upgrade -y

Step 2: Find and record your IP

To find your IP, we use the command:

ip a
ip a show enp4s0

Step 3: Download and run the ubuntu-22.04-lts-vpn-server.sh script

wget https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh -O ubuntu-22.04-lts-vpn-server.sh

then we set permissions for the newly downloaded file with the command

chmod -v +x ubuntu-22.04-lts-vpn-server.sh

Run ubuntu-22.04-lts-vpn-server.sh to install OpenVPN Server

sudo ./ubuntu-22.04-lts-vpn-server.sh

then we check the status of openVPN

sudo systemctl status openvpn-server@server

Then we download the client.ovpn file to the machine that needs to go into VPN

We find the .ovpn file with the command

sudo find / -iname "*.ovpn" -ls

So we have successfully installed OpenVPN

Next, we install the Open VPN Client for the machine that needs to go into VPN

  1. Apple IOS client
  2. Android client
  3. Apple MacOS client

Here I use Mac M1 and successfully connect