在Windows环境中架设OpenVPN服务相对比较简单,网上这方面的教程也比较丰富,照葫芦画瓢即可。但是大部分教程都只讲了如何将client与Server通过VPN管道连接起来,使client可以正常访问Server所在的内部网络(这也是VPN的主要应用)。而现实情况中往往有一种需求,就是client需要通过server来访问Internet,即server作为Proxy,对client访问Internet的数据进行转发。互联网上大部分收费的VPN代理都是以这样的方式实现。
那么在OpenVPN中,要怎么实现呢?
OpenVPN 2.3.4 I003/I603 下载地址
Installer (32-bit), Windows XP and later http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.4-I003-i686.exe
Installer (64-bit), Windows XP and later http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.4-I003-x86_64.exe
Installer (32-bit), Windows Vista and later http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.4-I603-i686.exe
Installer (64-bit), Windows Vista and later http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.4-I603-x86_64.exe
Source Tarball (gzip) http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.tar.gz
Source Tarball (xz) http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.tar.xz
Source Zip http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.zip
OpenVPN 2.3.4 I002 下载地址(已修复心脏出血漏洞)
Windows Install 32-bit http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.4-I002-i686.exe
Windows Install 64-bit http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.4-I002-x86_64.exe
Source-zip http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.zip
Source-gzip http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.tar.gz
Source-xz http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.tar.xz
OpenVPN 2.3.3 下载地址
32位 http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.3-I002-i686.exe
64位 http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.3-I002-x86_64.exe
源代码 http://swupdate.openvpn.org/community/releases/openvpn-2.3.3.zip
OpenVPN 2.3.2 下载地址
32Bit http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.2-I001-i686.exe
64Bit http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.2-I001-x86_64.exe
Source Code http://swupdate.openvpn.org/community/releases/openvpn-2.3.2.zip
OpenVPN 2.3 下载地址
32位 http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.0-I005-i686.exe
64位 http://swupdate.openvpn.org/community/releases/openvpn-install-2.3.0-I005-x86_64.exe
源代码 http://swupdate.openvpn.org/community/releases/openvpn-2.3.0.zip
OpenVPN 2.2 下载地址
下安装程序:http://swupdate.openvpn.org/community/releases/openvpn-2.2.2-install.exe
源代码:http://swupdate.openvpn.org/community/releases/openvpn-2.2.2.zip
安装说明在
http://www.cnblogs.com/irisrain/p/4202046.html
一、首先,完成OpenVPN server端与client端的安装与配置。
server配置如下:
# 监听地址
local 0.0.0.0
# 监听端口
port 1194
# 使用TCP或UDP协议
proto tcp
;proto udp
# 使用TAP或TUN模式
dev tap
;dev tun
# 加密认证
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
# VPN子网
server 10.8.0.0 255.255.255.0
# 路由设置
push "route 0.0.0.0 0.0.0.0"
# 设置网关转发
push "redirect-gateway def1 bypass-dhcp"
# 设置dhcp DNS
push "dhcp-option DNS 114.114.114.114"
push "dhcp-option DNS 8.8.8.8"
ifconfig-pool-persist ipp.txt
duplicate-cn
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
client配置如下:
client
# 使用TAP或TUN模式
dev tap
;dev tun
# 使用TCP或UDP协议
proto tcp
;proto udp
# server地址端口
remote x.x.x.x 1194
# 加密认证
ca ca.crt
cert client.crt
key client.key
ns-cert-type server
persist-key
persist-tun
comp-lzo
verb 3
要使client通过server连接Internet,则在设置中要注意:
1、使用TAP模式;
2、加入路由设置
push "route 0.0.0.0 0.0.0.0"
3、设置网关转发并设置DNS
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 114.114.114.114"
push "dhcp-option DNS 8.8.8.8"
设置完成,client正常连接server后,使用ipconfig应该能正常看到VPN网关地址,并且能够ping通VPN网关。
二、在Server端,配置好VPN 开启NAT。