So, in this post, you will learn How to set an OpenVPN server on Ubuntu 20.04.
VPN or virtual private network is a set of technologies that allows a network to connect through a protected tunnel with other networks. VPNs are uses by an organization to provide remote access of their protected resource maybe access to some files, software access, or some client communication. A VPN Create private communication between two devices. Devices can be similar or different, I can be a mobile, router, or a computer, it allows remote access while protecting traffic/communication as well.
How a VPN works?
“Private” in VPN refers to network topology instead of privacy. VPN work based on routing, bridging, and encapsulation. Layer 3 VPN creates a new route for virtual network adopter while in bridging VPN method (or Layer 2) method like connected devices are on the same physical network.
Encapsulation means traveling information is wrapped inside packets, these encapsulated packets travel through a secure VPN tunnel between server and client. A VPN server will be only visible to clients. VPN or virtual private network is a set of technologies that allows a network to connect through a protected tunnel with other networks. VPNs are uses by an organization to provide remote access of their protected resource maybe access to some files, software access, or some client communication. A VPN Create private communication between two devices.
So, Devices can be similar or different, I can be a mobile, router, or a computer, it allows remote access while protecting traffic/communication as well.
Configure OpenVPN
Pre requisites:
- Ubuntu 20.04 LST
- Internet connection
- A mobile/remote device to test your OpenVPN services.
Install required packaged:
So, open a browser and go to the OpenVPN main site
Click on Get OpenVPN visible on upper left corner of the site.
Then, click on the Ubuntu icon.
After that, Install required packages are per instructions provided on website.
# apt update && apt -y install ca-certificates wget net-tools gnupg
wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | apt-key add -
# echo "deb http://as-repository.openvpn.net/as/debian focal main">/etc/apt/sources.list.d/openvpn-as-repo.list
When installation process is over you will be able to see following message, where VPN server is accessible on port number 943.
Let’s access admin portal first, assign password to OpenVPN user.
# passwd OpenVPN
Then, open URL https://ip-addr:943/admin, provide user id and password created in previous step:
Then, Click on user management and go to user permissions
Create a new user (demouser in our example scenario), click on more settings, define password and save settings.
Here you have created a VPN client user which can be accessed via remote.
To check if creds are working properly or not, open https://ip-addr:943 in another browser. Provide user id and password created in above step (demouser).
After providing credential, a window something like below will appear. Here you can save your VPN profiles by click on user-locked profile.
To run a OpenVPN client on MS Windows®, download application and install.
When setup is done, open MS Windows VPN client application and provide credentials.
Enable OpenVPN connection, we can see successfully connected VPN connection on MS Windows® client.
So, let’s try with android device as well. Download OpenVPN application on your mobile device.
Provide credentials and connect OpenVPN connection, steps are exactly as were for Desktop. Â
Now both of the devices (Desktop and Android) are connected, lets see if connections are visible on OpenVPN server or not.
Open https://ip-addr:943/admin
We can see 02 active connections up and running.
Conclusion
OpenVPN is one of the most reputed VPN authentication services getting used globally. Also, OpenVPN is a standardized open-source protocol, where a maximum of the devices supports OpenVPN and can connect via that protocol.
So, the application is very easy to set up and robust platform which can be used for corporate, educational, or government organization for secure tunneled communications.