openvpn-install.sh一键部署安装过程: 1. 自动化脚本运行后,首先要求输入即将运行openvpn的服务端的公网映射IP地址或域名,针对家庭宽带这种场景,推荐使用域名方式。
This server is behind NAT. What is the public IPv4 address or hostname?
Public IPv4 address / hostname [111.199.98.172]: smp.tenhia.net
2. 选择openvpn使用的通信协议,默认为UDP,推荐使用UDP。
Which protocol should OpenVPN use?
1) UDP (recommended)
2) TCP
Protocol [1]:
3. 选择openvpn服务端监听的端口,可根据个人需求填写,不建议使用80、443等web服务,涉及备案问题。
What port should OpenVPN listen to?
Port [1194]: 88888
4. 为openvpn客户端选择DNS Server,此处根据需求自行选择,可以选择1。
Select a DNS server for the clients:
1) Current system resolvers
2) Google
3) 1.1.1.1
4) OpenDNS
5) Quad9
6) AdGuard
DNS server [1]: 1
5. 输入第一个客户端的名字,最后会生成一个客户端配置文件,文件名使用的此处输入的字符。
Enter a name for the first client:
Name [client]: tenhia
6. 按任意键继续安装
OpenVPN installation is ready to begin.
Press any key to continue...
7. 安装成功后,根据提示在/root/目录下可以看到生成的客户端文件“tenhia.ovpn”。 success
success
success
success
success
success
success
success
success
success
Created symlink from /etc/systemd/system/multi-user.target.wants/openvpn-server@server.service to /usr/lib/systemd/system/openvpn-server@.service.
Finished!
The client configuration is available in: /root/jason.ovpn
New clients can be added by running this script again.
[root@localhost ~]# ls
anaconda-ks.cfg tenhia.ovpn openvpn-install.sh README
[root@localhost ~]#