如何允许我的vpn客户端访问远程LAN(eth1)?
我的ubuntu服务器有两个if: eth0, eth1
。
eth0: Public IP eth1: 192.168.0.2
我使用pptpd为vpn服务器配置了eth0
。
vpn ip_range
是192.168.100.234-248
#/etc/pptpd.conf logwtmp bcrelay eth2 localip 192.168.100.1 remoteip 192.168.100.234-238,192.168.100.245
现在从我的客户端可以连接到vpn服务器并获取192.168.100.234
地址。
但我无法访问192.168.0.2/24 LAN网络中的任何内容。
我尝试设置iptables -A FORWARD -j ACCEPT
以及-t nat
设置。
但似乎没有影响。
如何正确完成这项工作?
非常感谢。
这是我的服务器和客户端相关信息https://gist.github.com/4635571
我找到了解决方案并且已经过测试。 它只是有效。
我的ubuntu服务器有两个网络接口:eth1 – wan eth2 – lan 192.168.0.2
VPN服务使用192.168.100.1作为其地址。
VPN客户端将获得192.168.100.234-238的地址。
以下命令允许VPN客户端访问服务器LAN后面的其他客户端。 例如192.168.0.100
使用iptables设置nat。
# ubuntu vpn server sudo iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -d 192.168.0.0/24 -j MASQUERADE
并且客户端手动添加路由。
# mac os x client sudo route add 192.168.0.0/24 192.168.100.1