`
tiehuali2
  • 浏览: 32887 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Windowsxp单网卡开启NAT(配合openvpn)

阅读更多

Windows XP 下单网卡实现VPN+NAT代理服务器

OpenVPN的配置请参考上一篇博客:OpenVPN在windows下的安装与配置


为教研室配置VPN,所用软件为openVpn。OpenVPN配置成功后,可以成功组成虚拟个人网,但还不能通过服务器代理访问外网。为了达到这个目的现需要在服务器端开启NAT服务。(网上有用连接共享的,但我不知道为啥没试验成功,放弃了)
实现步骤基于如下系统情况
WindowsXP 中文版+SP3
单网卡,具有教研室局域网IP192.168.1.114


1) 修改注册表(开启TCP/IP转发):
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
IPEnableRouter=1
2) net stop remoteaccess // Stop the RAS Service
3) netsh routing ip nat install
4) netsh routing ip nat add interface "YOUR INTERNET NIC" full
5) netsh routing ip nat add interface "YOUR OPEN VPN TAP NIC" private
6) netsh routing ip nat add interface Internal private
7) net start remoteaccess

My netsh routing ip nat show interface then looks like:

NAT Internal Configuration
---------------------------
Mode              : Private Interface


NAT Local Area Connection Configuration
---------------------------
Mode              : Address and Port Translation


NAT Local Area Connection 4 Configuration
---------------------------
Mode              : Private Interface

NOTE: I actually had to reboot at the end for everything to take effect.

具体到我的步骤如下:
1. 打开 Routing and remote access服务
2. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter
= 1   重启
2 netsh
   routing ip nat
   install
   add interface name="本地连接 2" mode=full //服务器上用于上外网的连接

   add interface name="本地连接 3" mode=private //安装OpenVPN时生成的虚拟连接
   add interface name="内部" mode=private

输入show interface命令后显示:
NAT 内部 配置
---------------------------
模式              : 专用接口

NAT 本地连接 2 配置
---------------------------
模式              : 地址和端口转换
 

NAT 本地连接 3 配置
---------------------------
模式              : 专用接口


即表示NAT配置成功,重启。

以上步骤实现后,则VPN+NAT配置成功。可拨入主机,并可通过主机代理出去访问主机所在的资源。如同处在主机带的局域网中。


至此,VPN配置完毕。

 

注意:最后三行中的"本地连接 2"、"本地连接 3"和“内部”是在“网络连接”中显示的名字,“本地连接”一般都能看到,而“内部”只有在有vpn client连接的时候才能看到。一般来说,“内部”这个名字是不用改的,“本地连接 2”、“本地连接 3”请根据自己机器的具体情况修改。

参考连接:http://hi.baidu.com/dailyye/blog/item/43b38b2fc6f5c03b1e3089aa.html

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics