连接到OpenVPN服务器时无法访问互联网

我最近在我的Windows 2003服务器上安装了OpenVPN。 一旦有人连接到服务器,他们没有互联网接入。

  • 我的networking在192.168.1.1上
  • 我的服务器是192.168.1.110
  • 我正在使用dd-wrt固件
  • 我在路由器上启用了端口1194为192.168.1.110
  • 路由和远程访问被禁用
  • 我的Windows 2003服务器上有2个Tap-Win32适配器V8(s)
  • 我已经尝试将此行设置为192.168.1.1,并且我的isp的dns服务器推送“dhcp-option DNS 192.168.1.1”#将Xsreplace为您的家庭networking(通常是您的ISP的DNS)的DNS的IP地址,
  • 我在dd-wrt中创build了一个高级路由网关

    Destination LAN NET: 192.168.10.0 Subnet Mask: 255.255.255.252 Gateway: 192.168.1.110 Interface: Lan & WLAN 

我完全按照这个网站: http : //www.itsatechworld.com/2006/01/29/how-to-configure-openvpn/

编辑:我只是试图通过CMD提示连接,并得到以下子网错误 – 本地局域网[192.168.1.0/255.255.255.0]和远程VPN [192.168.1.0/255.255.255.0]之间的潜在路由子网冲突

我的服务器文件如下所示:

 local 192.168.1.110 # This is the IP address of the real network interface on the server connected to the router port 1194 # This is the port OpenVPN is running on - make sure the router is port forwarding this port to the above IP proto udp # UDP tends to perform better than TCP for VPN mssfix 1400 # This setting fixed problems I was having with apps like Remote Desktop push "dhcp-option DNS 192.168.1.1" # Replace the Xs with the IP address of the DNS for your home network (usually your ISP's DNS) #push "dhcp-option DNS XXXX" # A second DNS server if you have one dev tap #dev-node MyTAP #If you renamed your TAP interface or have more than one TAP interface then remove the # at the beginning and change "MyTAP" to its name ca "ca.crt" cert "server.crt" key "server.key" # This file should be kept secret dh "dh1024.pem" server 192.168.10.0 255.255.255.128 # This assigns the virtual IP address and subent to the server's OpenVPN connection. Make sure the Routing Table entry matches this. ifconfig-pool-persist ipp.txt push "redirect-gateway def1" # This will force the clients to use the home network's internet connection keepalive 10 120 cipher BF-CBC # Blowfish (default) encryption comp-lzo max-clients 100 # Assign the maximum number of clients here persist-key persist-tun status openvpn-status.log verb 1 # This sets how detailed the log file will be. 0 causes problems and higher numbers can give you more detail for troubleshooting 

我的client1文件如下:

 client dev tap #dev-node MyTAP #If you renamed your TAP interface or have more than one TAP interface then remove the # at the beginning and change "MyTAP" to its name proto udp remote my-dyna-dns.com 1194 #You will need to enter you dyndns account or static IP address here. The number following it is the port you set in the server's config route 192.168.1.0 255.255.255.0 vpn_gateway 3 #This it the IP address scheme and subnet of your normal network your server is on. Your router would usually be 192.168.1.1 resolv-retry infinite nobind persist-key persist-tun ca "ca.crt" cert "client1.crt" # Change the next two lines to match the files in the keys directory. This should be be different for each client. key "client1.key" # This file should be kept secret ns-cert-type server cipher BF-CBC # Blowfish (default) encrytion comp-lzo verb 1 

提前致谢!

在我看来,服务器正在向客户端推送“redirect网关”选项。 这会导致客户端使用VPN作为其默认网关。 在服务器configuration“push”redirect-gateway def1“”中注释掉该行。

哇那里 – 只是看到你的编辑。 客户端不能使用与其连接的LAN相同的IP地址。 这是行不通的。 一端或另一端需要使用不同的IP地址。

编辑:

假设您的Windows Server 2003计算机上的路由configuration正确(根据您所引用的www.itsatechworld.com页面),您应该能够通过VPN将LAN服务器上的Windows Server 2003计算机和Windows Vista计算机PING。 如果可以的话,那么你已经在Windows Server 2003和DD-WRT机器上有了路由,你可以继续。 如果没有,那么你需要开始追踪为什么(1)PING来自OpenVPN隧道的stream量没有到达目的地,或者(b)为什么来自目的地主机的PING应答没有回来。 您最终可能会在Windows Vista机器上放置Wireshark之​​类的东西,看看PING请求是否到达那里(因为PING无法告诉您您的请求是否被接收,而回复正在丢失)。

一旦你通过VPN的IP连接正常工作。 我build议在Windows Server 2003 VPN服务器计算机上安装DNS和WINS服务,并将服务器计算机和Windows Vista家庭计算机configuration为使用WINS和DNS的计算机。 您可以在Windows Server 2003计算机上将您的ISP的DNS添加为“转发”,或者将股票“根提示”configuration为允许其parsingInternet名称。 在您的OpenVPN服务器configuration中,在'push'dhcp-option DNS 192.168.1.1“行之后添加以下行:

 push "dhcp-option WINS 192.168.1.1" 

这将使远程客户端连接到Windows Server 2003计算机上的WINS和DNS服务器,并且应该让您获得DNS和NetBIOS名称parsing。

如果您在家中没有使用Active Directory域,则可能需要在Windows Server 2003 DNS服务器上为要注册的Windows Server 2003和Windows Vista计算机设置标准的正向查找区域。 您需要授予客户端在创build此区域时dynamic更新logging的权限(尽pipe不安全)。 您应该在您家中的DHCP范围中添加选项“DNS域名”(选项15),以便您的客户端计算机获取正确的DNS域名后缀。 (如果你使用的是DD-WRT的DNS,那么我不能告诉你怎么做,我是一个OpenWRT的人,我从命令行pipe理我的WRT54G,我build议你从Windows Server 2003机器无论如何,但我更喜欢那个DHCP服务器。)

如果您使用的是Active Directory域,则您将在DNS中创build一个正向查找区域。 由于您的远程VPN客户端不是您域的成员,但是他们将无法在DNS服务器在DNS区域上设置的股票安全设置下进行注册(至less,如果您让它在创build区域期间DCPROMO)。 这是不安全的,但如果你想允许他们注册,你可以(不太安全)改变区域的权限,以允许不安全的注册,或(b – 更安全但仍然不安全)为他们创buildA和PTRlogging,修改每个logging的权限以允许任何人更新它们。

这听起来像是一个家庭networking的事情,这对于很多事情来说都是一个很好的学习机会 – IP路由,VPN,名称parsing。 也许你正在寻找它“只是工作”,而不是作为一个学习的机会,在这种情况下,我只能表示歉意,并说这些事情不是“交钥匙”。

Evan的评论是正确的,除了我会敦促你考虑启用“redire-gateway”,并configuration服务器接受所有的互联网绑定的stream量,至less如果你做任何内容过滤。 如果你不这样做,你的笔记本电脑会变得(甚至更多)成为你的networking的一个漏洞。

拆分隧道VPN通常被认为是不安全的,因为它本质上为攻击者危害笔记本电脑,造成networking中心的短路。

您将需要确保您的Windows OpenVPN服务器已安装路由服务。

这是之前提到的,但强烈build议您将LANnetworking地址更改为非192.168.1.X. 大多数Linksys等等都是从这个networking出来的,所以远程主机不能到达networking中的主机。 我看到你的VPNnetworking设置为192.168.10.X,这很好。 现在将您的LAN设置为192.168.5.X. 它会更好,相信我。

您可以打开redirect网关,但我不会build议它,因为它会吃掉你的带宽。 如果您的networking上有IDS / IPS设备或类似设备,则可能会有所帮助。

我会设置动词高于1 …我保持在4看看发生了什么事情。

希望有所帮助!

就这样,这也logging在Linux上。 我在这里find了

  1. 在NetworkManager中导入您的VPNconfiguration文件
  2. 编辑VPN连接
  3. 转到“IP设置”选项卡(IP4设置)
  4. 点击路线
  5. 选中“仅将此连接用于其networking上的资源”
  6. 重新启动连接。