尝试在家庭和工作路由器之间设置 VPN。VPN 连接已建立,双方都可以 ping 通对方路由器:
ping 192.168.1.1 from 192.168.0.0 (Work network)
和
ping 192.168.0.1 from 192.168.1.0 (Home network)
但无法访问两侧网络内部的其他PC:
从工作 PC 到家庭网络 PC:
Tracing route to 192.168.1.100 over a maximum of 30 hops
1 <1 ms <1 ms <1 ms router.asus.com [192.168.0.1]
2 2 ms 1 ms 1 ms 10.8.0.6
3 * * * Request timed out.
和
从家庭 PC 到工作 PC 网络:
Tracing route to 192.168.0.96 over a maximum of 30 hops
1 3 ms 10 ms * 192.168.1.1
2 3 ms 4 ms 3 ms 10.8.0.1
3 * * * Request timed out.
更多配置细节:
家:
OpenVPN client
192.168.1.0/24
路由表:
Destination Gateway Genmask Flags Metric Ref Use Type Iface
default 78.61.155.254 0.0.0.0 UG 0 0 0 WAN0 vlan2
10.8.0.0 10.8.0.5 255.255.255.0 UG 0 0 0 tun14
10.8.0.5 * 255.255.255.255 UH 0 0 0 tun14
78.61.152.0 * 255.255.252.0 U 0 0 0 WAN0 vlan2
78.61.155.254 * 255.255.255.255 UH 0 0 0 WAN0 vlan2
192.168.0.0 10.8.0.5 255.255.255.0 UG 0 0 0 tun14
192.168.1.0 * 255.255.255.0 U 0 0 0 LAN br0
239.0.0.0 * 255.0.0.0 U 0 0 0 LAN br0
工作:
OpenVPN server
192.168.0.0/24
Interface Type: TUN
Respond to DNS: Yes
Advertise DNS to clients: Yes
Push LAN to clients: Yes
Direct clients to redirect Internet traffic: No (as each site uses their own internet access for external traffic)
Manage Client-Specific Options: Yes
Allow Client <-> Client: Yes
Allow only specified clients: Yes
Allowed Clients:
Common name: client
Subnet : 192.168.1.0
Mask: 255.255.255.0
Push : Yes
路由表:
Destination Gateway Genmask Flags Metric Ref Use Type Iface
10.8.0.2 * 255.255.255.255 UH 0 0 0 tun21
78.57.123.254 * 255.255.255.255 UH 0 0 0 WAN0 eth0
169.254.39.0 * 255.255.255.0 U 0 0 0 LAN br0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun21
192.168.1.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun21
192.168.0.0 * 255.255.255.0 U 0 0 0 LAN br0
78.57.120.0 * 255.255.252.0 U 0 0 0 WAN0 eth0
default 78.57.123.254 0.0.0.0 UG 0 0 0 WAN0 eth0
如何解决这个问题?
答案1
客户端配置需要为经过 VPN 的服务器网络添加一条路由:
route 192.168.1.0 255.255.255.0
您的路由表包含一条通过网关的 192.168.1.0 路由,这是不正确的。请将其删除。