看到这么一个文章,探讨PPTP两端的LAN彼此相互访问的事情:
https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=8246986
自己做了测试环境如下:
【1】客户端,Padavan系统@OYE0001,
在vpn客户端的设置里,选择pptp协议,输入用户名密码等参数,
是否允许服务器端的访问:使用路由模式(有四种:禁止、用iptables禁止、允许-NAT方式、允许-路由方式)
若使用路由模式允许LAN-LAN访问,还需要添加对端(PPTP服务器端的LAN信息 192.168.122.0/24)
[OYE-0001 /]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.133.1 0.0.0.0 UG 1 0 0 eth2.2
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
192.168.2.1 * 255.255.255.255 UH 0 0 0 ppp5
192.168.122.0 192.168.2.1 255.255.255.0 UG 0 0 0 ppp5
192.168.123.0 * 255.255.255.0 U 0 0 0 br0
192.168.133.0 * 255.255.255.0 U 0 0 0 eth2.2
[OYE-0001 /]# ping 192.168.122.1
PING 192.168.122.1 (192.168.122.1): 56 data bytes
64 bytes from 192.168.122.1: seq=0 ttl=64 time=1.537 ms
64 bytes from 192.168.122.1: seq=1 ttl=64 time=1.631 ms
64 bytes from 192.168.122.1: seq=2 ttl=64 time=1.666 ms
===========================
【2】pptp服务器端,openwrt系统@arm
增加去往PPTP客户端LAN的 静态路由 :
先创建一个接口,例如名叫PPTP,绑定该接口的网卡为ppp0
再在 网络--静态路由里添加该接口,
--- 注意输入 客户端ip子网/mask,网关则为客户端pptp隧道的ip
root@OPW:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.133.1 0.0.0.0 UG 0 0 0 eth1
192.168.2.10 * 255.255.255.255 UH 0 0 0 ppp0
192.168.122.0 * 255.255.255.0 U 0 0 0 eth0
192.168.123.0 192.168.2.10 255.255.255.0 UG 0 0 0 ppp0
192.168.133.0 * 255.255.255.0 U 0 0 0 eth1
root@OPW:~# ping 192.168.123.1
PING 192.168.123.1 (192.168.123.1): 56 data bytes
64 bytes from 192.168.123.1: seq=0 ttl=64 time=1.542 ms
64 bytes from 192.168.123.1: seq=1 ttl=64 time=1.538 ms
有的朋友可能在服务端添加了路由之后仍旧不能访问客户端的LAN,
这个情况最大的可能是pptp客户端采用的是NAT模式,
这样的模式下,从服务端LAN访问客户端LAN,相当于是从外网访问NAT路由器的内网,
不做端口映射或者DMZ是无法访问的,即便是在客户端的路由器上做DMZ或者端口映射,
也只是把有限的一些LAN内的主机提供出去,而不是LAN内所有的主机。
所以,如果想要完全的LAN-LAN模式的访问,
还是需要pptp客户端的路由器支持 p p t p的路由模式访问才行。
所幸,Padavan系统是支持的,
然后,Openwrt上据说是有的,ppp-mod-pptp 及界面 luci-proto-ppp,但是我没安装过
为节省流量,其他图片请移步这里查看:
https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=8247177