如安在linux上实现Openvpn
2.8启动openvpn [root@test1 2.0]# /usr/local/openvpn/sbin/openvpn --config /etc/openvpn/easy-rsa/2.0/conf/server.conf & [3] 11924 2.9打开服务器的路由功能 # vim /etc/sysctl.conf 修改以下内容: net.ipv4.ip_forward = 1 2.10使sysctl.conf配置文件生效并添加iptables转发规则: # sysctl –p # iptables -t nat -A POSTROUTING -o eth0 -s 10.8.0.0/24 -j MASQUERADE # /etc/init.d/iptables save 四,测试openvpn的功能 4.1在windows7客户端上安装openvpn-2.1_rc22-install.exe 4.2将服务器上的/etc/openvpn/easy-rsa/2.0/keys下的文件拷贝到C:Program Files (x86)OpenVPNconfig 4.3在windows7客户端上将C:Program Files (x86)OpenVPNsample-configclient.ovpn拷贝到C:Program Files (x86)OpenVPNconfig下 4.4编辑client.ovpn 修改如下 remote 服务器IP 1194 4.5 运行client.ovpn测试是否可以ping通10.8.0.1,,也就是服务器的tun接口IP。 五,openvpn排错 5.1连接openvpn时出现错误提示: TLS_ERROR: BIO read tls_read_plaintext error: error:140890B2:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:no certificate returned TLS Error: TLS object -> incoming plaintext read error TLS Error: TLS handshake failed 这个似乎是提示系统时间和证书时间不一致,具体解决措施为: 1.修改vps时间与本地时间一致 2.重启vps 3.重新连接openvpn试试 4.如果依旧不能连接openvpn,可以在vps上重新生成一个新的证书。 5.2今天,部署了下VPN,部署完成连接的时候,总是提示连接失败,很郁闷,贴出日志: Sun Mar 18 20:25:54 2012 [jesse] Peer Connection Initiated with 10.0.0.200:5000 Sun Mar 18 20:25:55 2012 SENT CONTROL [jesse]: 'PUSH_REQUEST' (status=1) Sun Mar 18 20:25:55 2012 PUSH: Received control message: 'PUSH_REPLY,route 172.16.1.0 255.255.255.0,route 10.0.1.0 255.255.255.0,topology net30,ping 10,ping-restart 120,ifconfig 10.0.1.6 10.0.1.5' Sun Mar 18 20:25:55 2012 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:3: topology (2.0.9) Sun Mar 18 20:25:55 2012 OPTIONS IMPORT: timers and/or timeouts modified Sun Mar 18 20:25:55 2012 OPTIONS IMPORT: --ifconfig/up options modified Sun Mar 18 20:25:55 2012 OPTIONS IMPORT: route options modified Sun Mar 18 20:25:55 2012 TAP-WIN32 device [本地连接 3] opened: .Global{2893A584-9C99-43FE-B17C-E1F7160BE530}.tap 解决方法 There are no TAP-Win32 adapters on this system. You should be able to create a TAP-Win32 adapter by going to Start -> All Programs -> OpenVPN -> Add a new TAP-Win32 virtual ethernet adapter. 5.3 All TAP-Win32 adapters on this system are currently in use 那么很有可能是你的TAP虚拟网卡没有打好驱动,那么只能换其他的openvpn的gui软件了 (编辑:PHP编程网 - 黄冈站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |