In this article, I’m going to guide you, step-by-step install a personal openVPN Server on Linux.A VPN, or Virtual Private Network, creates an encrypted tunnel between your computer and a remote server. It enables a communications between computers and devices across shared or public networks as if it were directly connected to the private network, while benefiting from the functionality, security and management policies of the private network.
Install and Configure VPN
Server computer
First you should install epel-release to install openvpn packages.
When everything is finished,you should see a file that ends with .ovpn. This is a configuration file you will need to configure the client computer.You should download this file on your client computer.
[test@vpnserver ~]$ ls -ltr /home/test/sysaix.ovpn
-rw-r--r--. 1 root root 2766 Jan 27 14:34 /home/test/sysaix.ovpn
You can check your openvpn server with below command.
sudo systemctl status openvpn-server@server.service
I copied ovpn file on this machine and tried a test connection
sudo openvpn --config sysaix.ovpn
#You should be connected to your OpenVPN server.
ed Jan 27 18:00:09 2021 Incoming Data Channel: Cipher 'AES-128-GCM' initialized with 128 bit key
Wed Jan 27 18:00:09 2021 ROUTE_GATEWAY *********1/255.255.255.0 IFACE=enp1s0 HWADDR=52:55:13:3e:fe:30
Wed Jan 27 18:00:09 2021 TUN/TAP device tun0 opened
Wed Jan 27 18:00:09 2021 TUN/TAP TX queue length set to 100
Wed Jan 27 18:00:09 2021 /sbin/ip link set dev tun0 up mtu 1500
Wed Jan 27 18:00:09 2021 /sbin/ip addr add dev tun0 10.8.0.2/24 broadcast 10.8.0.255
Wed Jan 27 18:00:09 2021 /sbin/ip route add ********/32 via *******
Wed Jan 27 18:00:09 2021 /sbin/ip route add 0.0.0.0/1 via 10.8.0.1
Wed Jan 27 18:00:09 2021 /sbin/ip route add 128.0.0.0/1 via 10.8.0.1
Wed Jan 27 18:00:09 2021 Initialization Sequence Completed
As you can see, a tun0 interface is added to my Fedora system
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
link/none
inet 10.8.0.2/24 brd 10.8.0.255 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::6c56:83b5:4d39:a84f/64 scope link stable-privacy
valid_lft forever preferred_lft forever
To test it, open your internet browser and visit any website. You can also check your public IP address and it should be your server address.