Install OpenVPN Server on Ubuntu In 5 Minutes

Install OpenVPN Server on Ubuntu In 5 Minutes

Let's talk about VPN environment which helps us to secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. We have all sorts of tools present in market to achieve such level of functionality. One of the most used ones i am going to talk about the configuration here in this article.

OpenVPN is a virtual private network system that implements techniques to create secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It implements both client and server applications.

In this tutorial, we will install the OpenVPN server on Ubuntu 20.04. To do this, you need to log in as the root user. You also must know the public IP of the server with which clients will establish a secure VPN channel.

Note:- If you are in cloud world then you can just take the AMIs from marketplace and dont need to do such configuration. It will install OpenVPN for you.

OpenVPN installation and configuration

We will use the script to install and configure all the necessary packages to start the OpenVPN server. All you have to do is provide it with the correct public IP address of your server.

Steps to configure:-

  • Let’s download it

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

  • Make it executable.

chmod +x openvpn-install.sh

  • Now run the script.

./openvpn-install.sh

You will be asked to confirm some parameters that have optimal values by default. The only thing that is really worth checking is the public IP of the server. Other parameters should only be changed if you understand what you are doing and why.

OpenVPN installation settings

No alt text provided for this image

In the last step, you need to set the client name and choose whether to protect the configuration with a password or not. For security reasons, it's better to set a password.

When the process is over, you can check whether the OpenVPN server is listening for incoming connections.

ss -tupln | grep openvpn

No alt text provided for this image

OpenVPN client connection

We will use another Ubuntu machine to show the client connection process. You can configure any Linux system in this way or download the Windows client from the OpenVPN web site:?https://openvpn.net/community-downloads/

At the end of the OpenVPN server configuration process, you will see a message stating that the client configuration has been created and the path to it is specified.

  • Download the VPN config file to client.

scp user@vpn-server:/path/to/configuration.ovpn /home/user

  • Install the OpenVPN client.

sudo apt install openvpn

  • Now start the client and specify the path to the configuration downloaded from the server.

openvpn --config /path/to/configuration.ovpn

The next line shows that the connection was established successfully.

Mon Sept 5 19:59:58 2022 Initialization Sequence Completed

Add more OpenVPN clients or delete one

To add or remove clients on the server or delete OpenVPN, run the script again and select the appropriate option.

./openvpn-install.sh

Output:

What do you want to do?

1) Add a new user

2) Revoke existing user

3) Remove OpenVPN

4) Exit

Select an option [1-4]:

It's a simple configuration to make for your system and secure your network with OpenVPN.

See the OpenVPN website?here, Ubuntu page?here?and Github?script page here?for additional information or use the?man command/help command?to read docs locally:

man openvpn

openvpn --help

# Use the?more command/less command?as a filter #

openvpn --help | more

If you like the article please follow me on Linkedin.

Hope this article help !!!

if you like the article follow me on Linkedin and YouTube to get more updates.

Linkedin:-?https://www.dhirubhai.net/in/shashankabhishek/

Udemy:-

YouTube:-

要查看或添加评论,请登录

Shashank Abhishek的更多文章

社区洞察

其他会员也浏览了