OpenVPN主机不能访问客户端局域网

我有一个OpenVPN服务器,称之为vpn-server,后面有一个局域网192.168.3.0/24。 客户端vpn-client也有一个局域网,10.4.0.0/24。 192.168.3.0/24上的机器可以访问10.4.0.0/24(有一个例外)。 10.4.0.0/24上的机器可以访问192.168.3.0/24。 (服务器和客户端都是基于Linux的。)

一个例外是VPN主机本身不能访问10.4.0.0/24。 irc上的#openvpn中有人提到,当openvpn服务器连接到客户端networking时,它使用的是VPN IP,而不是本地IP,我应该检查我的iptables伪装规则。 我的伪装规则和相关接口的接口configuration在http://pastebin.com/Q9RDy0es 。

服务器和客户端的OpenVPNconfiguration文件可以在http://pastebin.com/gtfm82pEfind。

我觉得这是主机方面的防火墙问题,但我似乎无法得到它的工作。 我需要新的/不同的伪装规则吗? 我很确定VPNconfiguration是正确的。

VPN服务器路由

Destination Gateway Genmask Flags Metric Ref Use Iface 10.54.1.9 * 255.255.255.255 UH 0 0 0 tun1 10.8.1.2 * 255.255.255.255 UH 0 0 0 tun0 <pubIP redacted> * 255.255.255.248 U 0 0 0 eth1 10.18.1.0 10.8.1.2 255.255.255.0 UG 0 0 0 tun0 172.16.20.0 10.54.1.9 255.255.255.0 UG 0 0 0 tun1 192.168.3.0 * 255.255.255.0 U 0 0 0 eth0 10.8.1.0 10.8.1.2 255.255.255.0 UG 0 0 0 tun0 10.54.1.0 10.54.1.9 255.255.255.0 UG 0 0 0 tun1 172.16.30.0 10.54.1.9 255.255.255.0 UG 0 0 0 tun1 10.3.0.0 10.54.1.9 255.255.255.0 UG 0 0 0 tun1 172.16.10.0 * 255.255.255.0 U 0 0 0 vlan4000 10.3.1.0 10.54.1.9 255.255.255.0 UG 0 0 0 tun1 10.4.0.0 10.8.1.2 255.255.0.0 UG 0 0 0 tun0 link-local * 255.255.0.0 U 0 0 0 eth0 loopback * 255.0.0.0 U 0 0 0 lo default <pubIP redacted> 0.0.0.0 UG 0 0 0 eth1 

iptables -L的vpn-server输出

 Chain INPUT (policy ACCEPT) target prot opt source destination FW-1-INPUT all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt source destination ACCEPT all -- 192.168.3.0/24 anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere icmp any ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED REJECT all -- anywhere anywhere reject-with icmp-host- prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain FW-1-INPUT (1 references) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere icmp any ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:7788 ACCEPT udp -- anywhere anywhere udp dpt:ha-cluster ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere tcp dpt:domain ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere tcp dpt:domain ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere tcp dpt:domain ACCEPT udp -- anywhere anywhere udp dpt:bootps ACCEPT udp -- anywhere anywhere udp dpt:bootpc ACCEPT udp -- anywhere anywhere udp dpt:openvpn ACCEPT tcp -- sysmon.example.com anywhere tcp dpt:nrpe ACCEPT tcp -- sysmon1.example.com anywhere tcp dpt:nrpe ACCEPT udp -- sysmon1.example.com anywhere udp dpt:ntp ACCEPT udp -- sysmon.examplecom anywhere udp dpt:ntp ACCEPT tcp -- anywhere anywhere tcp multiport dports iax,sip ACCEPT udp -- anywhere anywhere udp multiport dports iax,sip ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh REJECT all -- anywhere anywhere reject-with icmp-host- prohibited 

请记住,当您的OpenVPN网关获取stream量时,当它被客户端路由器及其主机看到时,它很可能来自openvpn接口本身。 所以你需要确定你是否已经在openVPN服务器上以某种方式NAT了IP,或者主机/客户端看到有回到该IP的请求(可能与你的LAN不一样)。

如果您双击tcpdump openvpn接口,然后是远程端的内部接口,您可能会发现问题是与此不同的接口IP相关的防火墙规则或与此相关的路由。