Wave Layer Blog

Crypto Friendly Dedicated Servers Located In 50+ Countries!
World Class 24×7 Support:

How to install OpenVPN on Ubuntu 22.04

VPN stands for Virtual Private Network. It is a way of establishing a secure connection between the internet and us by creating a private encrypted tunnel. VPN provides services such as encrypting the data, hiding the user’s IP, providing secure access, as well as remote access.

In this tutorial, we are going to get our hands dirty with a top-down setup of an OpenVPN server on Ubuntu 22.04 and a client on a Windows machine. Using OpenVPN will benefit us because:

  • It is an open-source project.
  • It supports strong encryption methods.
  • It supports both TCP and UDP protocols, and it’s easy to set up.

1) Prerequisites

Installing some packages first, as it will be useful for different purposes.

wget: downloading packages from the web.

vim: for text editor

net-tools: network utilities for diagnosing and troubleshooting.

curl: tool and library for transferring data with URLs.

				
					sudo apt-get install vim wget net-tools curl -y
				
			

E.g. checking public IP

				
					curl ifconfig.me
				
			

As this VM has already mapped with the public IP [3.85.56.9] mentioned.

Server Installation

Using the wget command, pulling the script

				
					wget https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
				
			

Here we just downloaded the bash script which will be useful for installing OpenVPN.

Verifying the downloaded file of the OpenVPN installation script.

				
					ls
				
			

Need to change script into execution mode.

				
					chmod +x openvpn-install.sh
				
			

Run the script for installation.

				
					sudo ./openvpn-install.sh
				
			

Press Enter to process the further installation.

Disable the ipv6 support.

Set the working port for VPN

Here we set for the default value 1194

Setting up protocol, here we set for UDP.

Using DNS resolver for VPN, here we will use AdGuard DNS.

Disabling compression
Disabling encryption
Then press Enter to continue the installation process.

Provide the Client name of VPN user.

We provided the name as WavelayerClient.

Providing password less client, for that need to select option 1.

Enter VPN file location

The generated open VPN file has been stored in the location /home/wavelayer/Wavelayerclient.ovpn

Enabling the port in the firewall configuration.

Note: As the VM was created in the AWS need to allow traffic from outside and allow the port 1194 as well. It can be done from the portal of the AWS. Depending upon the platform you use.

Client Installation

Download file in the client machine.

Copying/Downloading the vpn file to the client machine from the server.

For the test machine, I have used windows 10 machine.

Note: Need to install the open VPN client in the client machine

After installing the VPN client, open the OpenVPN connect application, then upload the file.

Click on BROWSE, and upload the file from the downloaded locations.

Then connect to the VPN server by pressing connect.

Result

This is how, we create the OpenVPN server and connect to the server from the client machine.

Conclusion

To conclude, with the proper configuration; the OpenVPN server setup was successfully completed. The demonstration was also successfully completed after establishing the connection from the client computer. By implementing the strong security protocols OpenVPN ensures that the data is confidential and secured.

Share the Post:

Related Posts