配置linux的openvpn客户端

前提:在前面实验的基础上,增加一台linux主机作为openvpn客户端

linux主机配置openvpn客户端

查看版本号

[[email protected] ~]# uname -r
2.6.32-431.el6.x86_64
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[[email protected] ~]# crontab -l
#time update by root
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1
编译安装lzo和openvpn软件
[[email protected] openvpn]# ls
lzo-2.06.tar.gz openvpn-2.2.2.tar.gz
[[email protected] openvpn]# tar xf lzo-2.06.tar.gz
[[email protected] openvpn]# cd lzo-2.06
[[email protected] lzo-2.06]# ./configure
[[email protected] lzo-2.06]# make && make install
[[email protected] openvpn]# tar xf openvpn-2.2.2.tar.gz
[[email protected] openvpn]# cd openvpn-2.2.2
[[email protected] openvpn-2.2.2]# yum install -y openssl*
[[email protected] openvpn-2.2.2]# ./configure --with-lzo-headers=/usr/local/include --with-lzo-lib=/usr/local/lib
[[email protected] openvpn-2.2.2]# make && make install

将原来Windows openvpnGUI软件下已成功拨号的用户整个文件夹打包为zip格式上传到linux主机openvpn客户端下

[[email protected] openvpn]# ll
总用量 12
drwxr-xr-x 2 root root 4096 1月 29 15:34 test
-rw-r--r-- 1 root root 4432 2月 14 12:52 test.zip
[[email protected] openvpn]# rm -f test.zip
[[email protected] openvpn]# cp test/* ./
[[email protected] openvpn]# ll
总用量 20
-rw-r--r-- 1 root root 1310 2月 14 12:54 ca.crt
drwxr-xr-x 2 root root 4096 1月 29 15:34 test
-rw-r--r-- 1 root root 3879 2月 14 12:54 test.crt
-rw-r--r-- 1 root root 1062 2月 14 12:54 test.key
-rw-r--r-- 1 root root 173 2月 14 12:54 test.ovpn
[r[email protected] openvpn]# rm -fr test
[[email protected] openvpn]# mv test.ovpn client.conf
[[email protected] openvpn]# cat client.conf 
client
dev tun
proto tcp
remote 10.0.0.5 52115
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/test.crt
key /etc/openvpn/test.key
ns-cert-type server
comp-lzo
verb 3

[[email protected] openvpn]# /usr/local/sbin/openvpn --config /etc/openvpn/client.conf &      #<===后台启动openvpn客户端
[[email protected] openvpn]# echo "--script-security 3" >>/etc/openvpn/client.conf      #<===遇到报错,追加此行至文件结尾,或者将配置文件改名重新测试
[[email protected] openvpn]# pkill openvpn
[[email protected] openvpn]# /usr/local/sbin/openvpn --config /etc/openvpn/client.conf &

  

 

猜你喜欢

转载自www.cnblogs.com/blog-tim/p/10374080.html
0条评论
添加一条新回复