一晶通、下載openvpn
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install openvpn
二、創(chuàng)建一個配置文件的路徑
#路徑需要手動創(chuàng)建
[root@localhost ~]# mkdir -p /etc/openvpn/client/config/
三哟玷、把其他客戶端的配置文件復(fù)制過來
下面這個是我Windows上的openvpn的客戶端配置文件狮辽,可以直接拷貝到linux上面去用一也,里面包含ca證書等配置
image.png
四、把此配置文件放到剛剛創(chuàng)建的路徑下(不用做任何改動)
[root@localhost config]# ls
client10.ovpn
[root@localhost config]# pwd
/etc/openvpn/client/config
五喉脖、啟動openvpn
[root@localhost config]# openvpn /etc/openvpn/client/config/client10.ovpn
Fri Feb 18 18:17:40 2022 OpenVPN 2.4.11 x86_64-redhat-linux-gnu [Fedora EPEL patched] [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Apr 21 2021
Fri Feb 18 18:17:40 2022 library versions: OpenSSL 1.0.2k-fips 26 Jan 2017, LZO 2.06
Fri Feb 18 18:17:40 2022 WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.
Fri Feb 18 18:17:40 2022 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Feb 18 18:17:40 2022 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Fri Feb 18 18:17:40 2022 TCP/UDP: Preserving recently used remote address: [AF_INET]“一個IP”:1194
Fri Feb 18 18:17:40 2022 Socket Buffers: R=[212992->200000] S=[212992->200000]
Fri Feb 18 18:17:40 2022 UDP link local: (not bound)
Fri Feb 18 18:17:40 2022 UDP link remote: [AF_INET]“一個IP”:1194
Fri Feb 18 18:17:40 2022 TLS: Initial packet from [AF_INET]“一個IP”:1194, sid=f1f2d65b 73df2166
Fri Feb 18 18:17:40 2022 VERIFY OK: depth=1, CN=OpenVPN CA
Fri Feb 18 18:17:40 2022 VERIFY OK: nsCertType=SERVER
Fri Feb 18 18:17:40 2022 VERIFY OK: depth=0, CN=OpenVPN Server
......
......
......
Fri Feb 18 18:17:47 2022 /sbin/ip route add “一個IP”/24 metric 101 via “一個IP”
Fri Feb 18 18:17:47 2022 /sbin/ip route add “一個IP”/23 metric 101 via“一個IP”
Fri Feb 18 18:17:47 2022 /sbin/ip route add “一個IP”/20 metric 101 via “一個IP”
Fri Feb 18 18:17:47 2022 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Fri Feb 18 18:17:47 2022 Initialization Sequence Completed
當結(jié)尾出現(xiàn)Initialization Sequence Completed表示連接成功