Link: https://www.cyberciti.biz/faq/ubuntu-18-04-lts-set-up-openvpn-server-in-5-minutes/
The steps are as follows:
Step 1 – Update your system
Run the apt command/apt-get command:
$ sudo apt update
$ sudo apt upgrade
Step 2 – Find and note down your IP address
A note about IP address
Most cloud servers have two types of IP address:
- Public static IP address directly assigned to your box and routed from the Internet. For example, Linode, Digital Ocean, and others gives you direct public IP address.
- Private static IP address directly attached to your server and your server is behind NAT with public IP address. For example, AWS EC2/Lightsail give you this kind of NAT public IP address.
The script will automatically detect your networking setup. All you have to do is provide correct IP address when asked for it.
Step 3 – Download and run openvpn-install.sh script
I am going to use the wget command:$ wget https://git.io/vpn -O openvpn-install.sh
Setup permissions using the chmod command:$ chmod +x openvpn-install.sh
One can view the script using a text editor such as nano/vim:$ vim openvpn-install.sh
Run openvpn-install.sh to install OpenVPN server
Now all you have to do is:$ sudo ./openvpn-install.sh
Sample session from AWS/Lightsail where my cloud server is behind NAT:
Sample session from Linode/DO server where cloud server has direct public IPv4 address:
To avoid problem always choose DNS as 1.1.1.1 or Google DNS. Those are fast DNS server and reached from anywhere on the Internet.
How do I start/stop/restart OpenVPN server on Ubuntu 18.04 LTS?
We need to use the systemctl command:
$ sudo systemctl stop openvpn-server@server.service # <--- stop server
$ sudo systemctl start openvpn-server@server.service # <--- start server
$ sudo systemctl restart openvpn-server@server.service # <--- restart server
$ sudo systemctl status openvpn-server@server.service # <--- get server status
Để lại một bình luận