如何访问远程局域网上的设备?

这里是我想要configuration的快速图表

openvpndiagram

我有多个客户端连接到我的VPN服务器(从10.0.1.2到10.0.25.2)。 客户端背后的每个LAN总是相同的:192.168.1.0/24,设备使用客户端作为默认网关。 我需要每个远程用户只能访问每个客户端后面的一些设备

需要通过VPN子网中的地址访问LAN设备需要进行哪种configuration?

例如 :

  • device1-behind-client_001:192.168.169.125/24 <=> 10.0.1.101
  • device2-behind-client_001:192.168.169.126/24 <=> 10.0.1.102
  • device3-behind-client_001:192.168.169.127/24 <=> 10.0.1.103
  • device1-behind-client_002:192.168.169.125/24 <=> 10.0.2.101
  • device1-behind-client_003:192.168.169.125/24 <=> 10.0.3.101

每个客户端已经连接到服务器并configuration了tun接口。


编辑

iptables在我的OpenVPN服务器上

iptables -A POSTROUTING -o eth0 -j MASQUERADE iptables -A POSTROUTING -s 10.0.0.0/16 -o eth0 -j MASQUERADE iptables -A INPUT -i tun0 -j ACCEPT iptables -A FORWARD -i tun0 -j ACCEPT 

在client_001上的iptables(示例)

 iptables -t nat -A PREROUTING -d 10.0.1.102/32 -i eth0 -j DNAT --to-destination 192.168.1.126 iptables -t nat -A POSTROUTING -s 192.168.1.126/32 -o eth0 -j SNAT --to-source 10.0.1.102/32 

通过此configuration,如果远程用户连接到服务器,是否可以通过此地址10.0.1.102访问client_001 lan上的192.168.1.126设备?

在configuration中禁用“客户端到客户端”选项,并使用防火墙/ iptables来过滤stream量。