Easy way setup or install VPN OpenVPN on Ubuntu 20.04

2022-08-21  乐帮网

vpn ubuntu

Easy way setup or install VPN OpenVPN on Ubuntu 20.04 ,I tested on my server. It work well.

1. Update your system

First, run the apt command to apply security updates:

sudo apt update
sudo apt upgrade

 

2. Download and run openvpn-install.sh script

DOwnload installation script using short url as follow and update chmod :

wget https://git.io/vpn -O openvpn-ubuntu-install.sh
chmod -v +x openvpn-ubuntu-install.sh
sudo ./openvpn-ubuntu-install.sh

Select UDP (recomendded), Port default, DNS use 1.1.1.1 or Google, client name, just give some name for example client-vpn, then openvpn will generate file client-vpn.ovpn in the /root directory

 

3. Check status, start, stop or restart service

sudo systemctl status openvpn-server@server.service
sudo systemctl start openvpn-server@server.service
sudo systemctl stop openvpn-server@server.service
sudo systemctl restart openvpn-server@server.service

 

4. Using opvn file

On Windows, install OpenVPN GUI and load client-vpn.ovpn file. From taskbar, right click OpenVPN icon and select appropriate vpn and click connect. OpenVPN will generate private/local IP addresses such as 10.8.0.1/32

 

5. Test/Verify connection

ping 10.8.0.1 #Ping to the OpenVPN server gateway
ip route #Make sure routing setup working
## the following must return public IP address of OpenVPN server ##
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

 

6. Add or remove a new VPN user with a certificate

You need to run the same script again for adding or removing a new VPN user to TLS certificate. For instance:

$ sudo ./openvpn-ubuntu-install.sh

This is summary from Ubuntu 20.04 LTS Set Up OpenVPN Server In 5 Minutes

 

https://gist.github.com/ebta/301f286fa9056d67e61bfc7cedd4ad56

公众号二维码

关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com

庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。

欧阳修

付款二维码

如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力