V** literal translation is a virtual private channel, which is a tunnel that provides secure data transmission between enterprises or between individuals and companies. OpenV** is undoubtedly the pioneer of open source V** under Linux, providing good performance and friendly users GUI.
The following describes how to build OpenV** Server under CentOS7 by building OpenV** Server in the following topology environment
Since there is no public IP for simulation, OpenV** Server is built on the CentOS7 server on the LAN side of the router (192.168.60.X), and V** is used on the Windows machine on the WAN side of the router (192.168.31.X) Client dials into V** for testing
Let's first introduce the construction of OpenV** Server
yum install -y install openV** easy-rsa net-tools bridge-utils
cd /usr/share/easy-rsa/3
. /easyrsa init-pki
. /easyrsa build-ca
. /easyrsa build-server-full server1 nopass
. /easyrsa build-client-full client1 nopass
. /easyrsa gen-dh It takes a while to generate DH
[ root@CentOS7_DIY 3]# ./easyrsa gen-dh
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
..................................................................................+...
.......
..................................................................................+........++++
DH parameters of size 2048 created at /usr/share/easy-rsa/3/pki/dh.pem
3 ) Create TLS-Auth Key
openV** --genkey --secret ./pki/ta.key
cp -pR /usr/share/easy-rsa/3/pki/{issued,private,ca.crt,dh.pem,ta.key} /etc/openV**/server/
cd /etc/sysctl.d/
vi 99-sysctl.conf
Append net.ipv4.ip_forward = 1
sysctl --system
cp /usr/share/doc/openV**-2.4.7/sample/sample-config-files/server.conf /etc/openV**/server/
vi /etc/openV**/server/server.conf
The places that need to be modified are as follows
port 1194
; proto tcp
proto udp
ca ca.crt
cert issued/server1.crt
key private/server1.key
dh dh.pem
server 10.8.0.0 255.255.255.0
push "route 192.168.60.0 255.255.255.0"
keepalive 10 120
tls-auth ta.key
comp-lzo
persist-key
persist-tun
status /var/log/openV**-status.log
log /var/log/openV**.log
log-append /var/log/openV**.log
verb 3
[ root@CentOS7_DIY ~]# systemctl start openV**-server@server
[ root@CentOS7_DIY ~]# systemctl enable openV**-server@server
OpenV** official website can be downloaded
And download the following four files from sz on V** Server and copy them to the config folder under the installation directory of V** Client
/etc/openV**/server/ca.crt /etc/openV**/server/ta.key /etc/openV**/server/issued/client1.crt
/etc/openV**/server/private/client1.key
And copy the client.oV** file from C:\Program Files\OpenV**\sample-config to the config directory for editing
Add and modify the following fields
remote 192.168.31.22 1194
ca ca.crt
cert client1.crt
key client1.key
tls-auth ta.key 1
comp-lzo
Rename to client1.oV after modification**
9 ) Open OpenV** GUI to connect to V**
At this time, the test found that the connection could not be reached
Check the openV**.log log on the server and the following error is reported
By searching the error message, the solution found is
key-direction 0 (on server)
key-direction 1 (on client)
Add key-direction 0 after adding TLS configuration on the server side
vi server.conf
After modification systemctl restart openV**-server@server
Add key-direction 1 in the client1.oV** configuration
Then reconnect V**, you can connect
At this time, it is found that the ping fails to connect to other addresses in the intranet such as 192.168.60.254
Need to add a static route on the internal network router, the destination network is the V** network segment
10.8.0.0 /24, the next hop is the internal network address of the V** server 192.168.60.113
After adding this route, you can ping the 192.168.60.X server and access the 192.168.60.X server service.
Recommended Posts