两周以来,我一直在努力让它发挥作用。我差点就承认失败了,但我真的做不到。
我在路由器上安装了 openvpn 客户端,并将其连接到在线 VPN 提供商。我可以成功地通过 VPN 路由所有流量,也可以成功地通过 VPN 路由来自 LAN 中特定 IPS 的流量(因此并非所有流量都会通过 VPN)。
我需要解决的问题是,当我连接到 VPN 时,我无法再访问/ping 位于连接到 LAN 的 NAS 上的 Web 服务器。我认为这与 iptables、路由、NAT 或其他东西有关。。。经过 2 周的阅读帖子和反复思考,我还是不知道答案。
WAN (ISP) = 94.173.xx.xx
ROUTER with OpenVPN Client = 192.168.1.1
NAS (containing Webserver) = 192.168.2.20
我的配置文件是;
daemon
client
dev tap11
proto udp
remote openvpn.anonine.net 1194
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo adaptive
verb 3
ca ca.crt
auth-user-pass up
status-version 2
status status
# Custom Configuration
script-security 3 system
verb 3
mute 20
ns-cert-type server
route-noexec
route-delay 2
redirect-private
reneg-sec 0
iptables –nvL 给出;
root@unknown:/# iptables -nvL
Chain INPUT (policy DROP 61 packets, 7990 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- tap11 * 0.0.0.0/0 0.0.0.0/0
17 752 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 state INVALID
2152 433K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 104 shlimit tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 state NEW
1 65 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
655 51259 ACCEPT all -- br0 * 0.0.0.0/0 0.0.0.0/0
49 15227 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
136 106K ACCEPT all -- tap11 * 0.0.0.0/0 0.0.0.0/0
15833 5468K all -- * * 0.0.0.0/0 0.0.0.0/0 account: network/netmask: 192.168.2.0/255.255.255.0 name: lan
0 0 ACCEPT all -- br0 br0 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 state INVALID
35 2052 TCPMSS tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS clamp to PMTU
15731 5459K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
1 52 wanin all -- vlan2 * 0.0.0.0/0 0.0.0.0/0
52 4584 wanout all -- * vlan2 0.0.0.0/0 0.0.0.0/0
101 9026 ACCEPT all -- br0 * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 886 packets, 129K bytes)
pkts bytes target prot opt in out source destination
Chain shlimit (1 references)
pkts bytes target prot opt in out source destination
2 104 all -- * * 0.0.0.0/0 0.0.0.0/0 recent: SET name: shlimit side: source
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 recent: UPDATE seconds: 60 hit_count: 4 name: shlimit side: source
Chain wanin (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:50025
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:50079
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:21
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:80
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:143
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:8080
0 0 ACCEPT udp -- * * 0.0.0.0/0 192.168.2.20 udp dpt:8080
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:6789
0 0 ACCEPT udp -- * * 0.0.0.0/0 192.168.2.20 udp dpt:6789
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:50110
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:22
0 0 ACCEPT udp -- * * 0.0.0.0/0 192.168.2.20 udp dpt:22
1 52 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:51413
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:9091
0 0 ACCEPT udp -- * * 0.0.0.0/0 192.168.2.20 udp dpt:9091
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:6017
0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.168.2.20 tcp dpt:1194
0 0 ACCEPT udp -- * * 0.0.0.0/0 192.168.2.20 udp dpt:1194
和;
root@unknown:/# ip route list
94.174.0.1 dev vlan2 scope link
178.73.204.128/25 dev tap11 proto kernel scope link src 178.73.204.136
192.168.2.0/24 dev br0 proto kernel scope link src 192.168.2.1
94.174.0.0/22 dev vlan2 proto kernel scope link src 94.174.3.40
127.0.0.0/8 dev lo scope link
default via 94.174.0.1 dev vlan2
有人能帮我吗?我真的需要让它工作起来,并且已经连续努力了 2 周来解决这个问题。我真的已经尽我所能了。如果方向正确,我愿意研究等等——只是目前我已经看了很久,不知道正确的方向是什么了!
提前谢谢您。任何帮助都值得感激。
C