pkS*_*SML 5 networking router vpn openvpn
网络布局:Laptop (OpenVPN client) <-> router with 192.168.1.xxx subnet <-> internet <-> Home router (running DD-WRT with OpenVPN server) with 192.168.11.xxx subnet
VPN 服务器以第 2 层模式(桥接)运行。我的所有互联网流量都通过 VPN 隧道。我的家庭路由器和 VPN 的外部 IP 为68.64.127.82.
我的笔记本电脑(VPN 客户端)在 的物理 LAN 上有一个 IP 地址192.168.1.40。我在 VPN 上的 IP 地址是192.168.11.50。
我的问题是:是什么让所有互联网流量都通过 VPN 隧道?
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.40 20
0.0.0.0 128.0.0.0 192.168.11.1 192.168.11.50 30
Run Code Online (Sandbox Code Playgroud)
第一行表示所有内容都应该通过我物理连接的路由器(而不是 VPN 路由器)。第二行对我来说毫无意义。子网192.168.11.xxx位于我的 VPN 上。你怎么能有一个0.0.0.0带有网络掩码的目的地?!?
问题 2:目的地128.0.0.0的网络掩码意味着什么0.0.0.0?
问题3:为什么第二行优先于第一行?
感谢您的帮助!
这是我的完整路由表:
这是我的完整路由表:
C:\Users\owner>route print
===========================================================================
Interface List
19...00 ff 79 ee e1 6b ......TAP-Windows Adapter V9
10...00 1a 4b 13 d2 92 ......Broadcom NetLink (TM) Gigabit Ethernet
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.40 20
0.0.0.0 128.0.0.0 192.168.11.1 192.168.11.50 30
68.64.127.82 255.255.255.255 192.168.1.1 192.168.1.40 20
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
128.0.0.0 128.0.0.0 192.168.11.1 192.168.11.50 30
192.168.1.0 255.255.255.0 On-link 192.168.1.40 276
192.168.1.40 255.255.255.255 On-link 192.168.1.40 276
192.168.1.255 255.255.255.255 On-link 192.168.1.40 276
192.168.11.0 255.255.255.0 On-link 192.168.11.50 286
192.168.11.50 255.255.255.255 On-link 192.168.11.50 286
192.168.11.255 255.255.255.255 On-link 192.168.11.50 286
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.1.40 276
224.0.0.0 240.0.0.0 On-link 192.168.11.50 286
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.1.40 276
255.255.255.255 255.255.255.255 On-link 192.168.11.50 286
===========================================================================
Run Code Online (Sandbox Code Playgroud)
这是我的 ipconfig:
Windows IP Configuration
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : TAP-Windows Adapter V9
Physical Address. . . . . . . . . : 00-FF-79-EE-E1-6B
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::c1f8:5d3:e14:dba6%19(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.11.50(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Thursday, December 11, 2014 11:20:53 AM
Lease Expires . . . . . . . . . . : Friday, December 11, 2015 11:20:53 AM
Default Gateway . . . . . . . . . :
DHCP Server . . . . . . . . . . . : 192.168.11.0
DHCPv6 IAID . . . . . . . . . . . : 520159097
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-16-A1-5A-F6-00-1A-4B-6B-D2-7C
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Broadcom NetLink (TM) Gigabit Ethernet
Physical Address. . . . . . . . . : 00-1A-4B-13-D2-92
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::61c0:c604:f3e5:498%10(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.1.40(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Thursday, December 11, 2014 11:20:35 AM
Lease Expires . . . . . . . . . . : Friday, December 12, 2014 11:20:35 AM
Default Gateway . . . . . . . . . : 192.168.1.1
DHCP Server . . . . . . . . . . . : 192.168.1.1
DHCPv6 IAID . . . . . . . . . . . : 234887755
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-16-A1-5A-F6-00-1A-4B-13-D2-92
DNS Servers . . . . . . . . . . . : 192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Run Code Online (Sandbox Code Playgroud)
解决了!感谢 DD-WRT 论坛上的 eibgrad。这是他的回答:
\n(来源:http ://www.dd-wrt.com/phpBB2/viewtopic.php?t= 277001)
\n这只是一个聪明的技巧。
\n\xe2\x80\x99s 实际上是 VPN 添加的两条重要的额外路由:
\n128.0.0.0/128.0.0.0 (covers 0.0.0.0 thru 127.255.255.255) \n0.0.0.0/128.0.0.0 (covers 128.0.0.0 thru 255.255.255.255) \nRun Code Online (Sandbox Code Playgroud)\n这样做的原因是,当涉及到路由时,更具体的路由总是优先于更通用的路由。而且0.0.0.0/0.0.0.0(默认网关)非常通用。但是,如果我们插入上述两条路由,它们更加具体这一事实意味着之前总是会选择其中一条,0.0.0.0/0.0.0.0因为这两条路由仍然覆盖整个 IP 频谱(0.0.0.0直通255.255.255.255)。
VPN 这样做是为了避免扰乱现有路由。他们不需要删除已经存在的任何内容,甚至不需要检查路由表。他们只是在 VPN 启动时添加自己的路由,并在 VPN 关闭时删除它们。简单的。
\n