1、客户端安装
yum install epel-release -y
yum install openvpn
2、拷贝 ca,ta 文件
ll /etc/openvpn/client/
-rw-r--r--. 1 root root 1172 4月 26 09:00 ca.crt
-rw-r--r--. 1 root root 237 4月 26 08:58 client.opvn
-rw-r--r--. 1 root root 636 4月 26 09:00 ta.key
3、编辑连接文件
vim /etc/openvpn/client/client.opvn
client
dev tun
proto tcp
remote 192.168.2.107 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/client/ca.crt
remote-cert-tls server
tls-auth /etc/openvpn/client/ta.key 1
cipher AES-256-GCM
comp-lzo
verb 3
auth-user-pass
4、编辑启动脚本
vim vpn_connect.sh
#!/bin/bash
username=tomma
password=123456
openvpn --config /etc/openvpn/client/client.opvn --auth-user-pass <( echo -e "${username}\n${password}" ) &