|
|
本帖最后由 wayne630 于 2019-8-2 09:37 编辑
实施目的:买了一台深圳套路云,用于中转连回家里内网,顺便用$$R的http_simple免流。
套路云IP:39.108.x.x;主机名称:ALI-CN3
家中内网IP段:192.168.100.0/22
OpenV屁恩IP段:192.168.104.128/25
在家中服务器搭建OpenV屁恩服务端,通过FRP把OV监听端口映射到套路云小鸡,套路云小鸡搭建OV客户端连接映射过来的端口,连接后一切正常,能创建一个tun0的虚拟网卡。
[ol][root@ALI-CN3 ~]# ifconfig tun0tun0: flags=4305[U] mtu 1500 inet 192.168.104.134 netmask 255.255.255.255 destination 192.168.104.133 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC) RX packets 100 bytes 11288 (11.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 108 bytes 6955 (6.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[/ol]复制代码
注:OV服务端配置文件已经配置“push "route 192.168.100.0 255.255.252.0"”。
尝试跟踪路由到家中192.168.100.0/22网段的小鸡,一切正常:
[ol][root@ALI-CN3 ~]# traceroute 192.168.100.2traceroute to 192.168.100.2 (192.168.100.2), 30 hops max, 60 byte packets 1 192.168.104.129 (192.168.104.129) 7.390 ms 7.386 ms 7.381 ms 2 192.168.100.2 (192.168.100.2) 8.203 ms 8.205 ms 8.201 ms[/ol]复制代码
尝试ping,也正常:
[ol][root@ALI-CN3 ~]# ping -c 10 192.168.100.2PING 192.168.100.2 (192.168.100.2) 56(84) bytes of data.64 bytes from 192.168.100.2: icmp_seq=1 ttl=63 time=6.50 ms64 bytes from 192.168.100.2: icmp_seq=2 ttl=63 time=7.01 ms64 bytes from 192.168.100.2: icmp_seq=3 ttl=63 time=6.48 ms64 bytes from 192.168.100.2: icmp_seq=4 ttl=63 time=6.79 ms64 bytes from 192.168.100.2: icmp_seq=5 ttl=63 time=6.93 ms64 bytes from 192.168.100.2: icmp_seq=6 ttl=63 time=6.90 ms64 bytes from 192.168.100.2: icmp_seq=7 ttl=63 time=6.93 ms64 bytes from 192.168.100.2: icmp_seq=8 ttl=63 time=6.83 ms64 bytes from 192.168.100.2: icmp_seq=9 ttl=63 time=6.92 ms64 bytes from 192.168.100.2: icmp_seq=10 ttl=63 time=7.21 ms--- 192.168.100.2 ping statistics ---10 packets transmitted, 10 received, 0% packet loss, time 9015msrtt min/avg/max/mdev = 6.483/6.854/7.216/0.237 ms[/ol]复制代码
路由表,看起来也正常:
[ol][root@ALI-CN3 ~]# route Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 0 0 0 eth0link-local 0.0.0.0 255.255.0.0 U 1002 0 0 eth0172.18.96.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0192.168.100.0 192.168.104.133 255.255.252.0 UG 0 0 0 tun0192.168.104.128 192.168.104.133 255.255.255.128 UG 0 0 0 tun0192.168.104.133 0.0.0.0 255.255.255.255 UH 0 0 0 tun0[/ol]复制代码
问题来了,我在外面通过$$R
全局代理(没有绕过局域网)
连接套路云39.108.x.x这个IP后,访问互联网正常,访问ipip.net也能显示39.108.x.x,证明流量有走代理。但无法访问家中192.168.100.0/22网段的所有主机。想了两天,已经抓破头皮了。
已解决:
在套路云再搭了个OV服务端(IP段:192.168.105.0/25),在客户端跟踪路由发现到默认网关后路由就不会向下走了:[ol][root@testclient ~]# traceroute 192.168.100.2traceroute to 192.168.100.2 (192.168.100.2), 30 hops max, 60 byte packets 1 192.168.105.1 (192.168.105.1) 8.290 ms 7.212 ms 7.282 ms 2 * * * 3 * * * ......[/ol]复制代码
然后发现忘了两步:
忘了两步:
1、开启路由转发:
echo "1" > /proc/sys/net/ipv4/ip_forward
2、设置NAT:
iptables -t nat -A POSTROUTING -j MASQUERADE |
|