实施目的:买了一台深圳套路云,用于中转连回家里内网,顺便用$$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的虚拟网卡。
- [root@ALI-CN3 ~]# ifconfig tun0
- tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> 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
复制代码
注:OV服务端配置文件已经配置“push "route 192.168.100.0 255.255.252.0"”。
尝试跟踪路由到家中192.168.100.0/22网段的小鸡,一切正常:
- [root@ALI-CN3 ~]# traceroute 192.168.100.2
- traceroute 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
复制代码
尝试ping,也正常:
- [root@ALI-CN3 ~]# ping -c 10 192.168.100.2
- PING 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 ms
- 64 bytes from 192.168.100.2: icmp_seq=2 ttl=63 time=7.01 ms
- 64 bytes from 192.168.100.2: icmp_seq=3 ttl=63 time=6.48 ms
- 64 bytes from 192.168.100.2: icmp_seq=4 ttl=63 time=6.79 ms
- 64 bytes from 192.168.100.2: icmp_seq=5 ttl=63 time=6.93 ms
- 64 bytes from 192.168.100.2: icmp_seq=6 ttl=63 time=6.90 ms
- 64 bytes from 192.168.100.2: icmp_seq=7 ttl=63 time=6.93 ms
- 64 bytes from 192.168.100.2: icmp_seq=8 ttl=63 time=6.83 ms
- 64 bytes from 192.168.100.2: icmp_seq=9 ttl=63 time=6.92 ms
- 64 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 9015ms
- rtt min/avg/max/mdev = 6.483/6.854/7.216/0.237 ms
复制代码
路由表,看起来也正常:
- [root@ALI-CN3 ~]# route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- default gateway 0.0.0.0 UG 0 0 0 eth0
- link-local 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
- 172.18.96.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
- 192.168.100.0 192.168.104.133 255.255.252.0 UG 0 0 0 tun0
- 192.168.104.128 192.168.104.133 255.255.255.128 UG 0 0 0 tun0
- 192.168.104.133 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
复制代码
问题来了,我在外面通过$$R全局代理(没有绕过局域网)连接套路云39.108.x.x这个IP后,访问互联网正常,访问ipip.net也能显示39.108.x.x,证明流量有走代理。但无法访问家中192.168.100.0/22网段的所有主机。想了两天,已经抓破头皮了。
已解决:
在套路云再搭了个OV服务端(IP段:192.168.105.0/25),在客户端跟踪路由发现到默认网关后路由就不会向下走了:
- [root@testclient ~]# traceroute 192.168.100.2
- traceroute 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 * * *
- ……
复制代码
然后发现忘了两步:
忘了两步:
1、开启路由转发:
echo "1" > /proc/sys/net/ipv4/ip_forward
2、设置NAT:
iptables -t nat -A POSTROUTING -j MASQUERADE
重庆网友:zerotier
广东网友:关注中
辽宁网友:是不是55r的流量走的是套路云的网卡,没有走你的虚拟网卡。添加个路由表试试? 我也不太懂,等大佬们回答吧
山东网友:或者直接套路去开opvn服务器,家里电脑装客户端,手机也装客户端,应该可以互相访问吧
西藏网友:发一下 OV 服务器 的配置?
四川网友:
- port 444
- proto tcp
- dev tun1
- ca /etc/open扶墙/easy-rsa/keys/ca.crt
- cert /etc/open扶墙/easy-rsa/keys/centos.crt
- key /etc/open扶墙/easy-rsa/keys/centos.key
- <dh>
- —–BEGIN DH PARAMETERS—–
- MIIBCAKCAQEAkW5O9K3AIHUX66rdi4emUDUMVXDt0nXh6n1ZICDBL+KDjNy/6PHh
- pNpqnG4tkreiNob+vkSj2cl5H9/Ci7Q0jrCuJXgvRUyk0QkySunCuEmyIWHMlZe9
- *******************************
- XZmX6YOpEsQWwHIBEPoQS0gHgUCj+3nWOW+fIwweQcneibxEl6ypy9G6HwRCly9v
- W/aU5Ayainl99vEhyU/YIOFBDC22RBxyKwtmv8kgT/VMRSl6kjM88sETID0mCJbi
- aUZae8Eh1VBlkbPnBODzZqR9Gly215HZWwIBAg==
- —–END DH PARAMETERS—–
- </dh>
- auth-user-pass-verify /etc/open扶墙/userauth.sh via-env
- client-cert-not-required
- username-as-common-name
- script-security 3 system
- server 192.168.104.128 255.255.255.128
- push "route 192.168.100.0 255.255.252.0"
- push "dhcp-option DNS 192.168.100.100"
- client-to-client
- keepalive 10 120
- management localhost 8990
- tls-auth /etc/open扶墙/easy-rsa/ta.key 0
- comp-lzo
- persist-key
- persist-tun
- log /var/log/open扶墙.log
- log-append /var/log/open扶墙.log
- verb 3
复制代码
注:因为还有另外一个ov进程使用了tun0网卡及192.168.104.0/25网段,所以服务端的虚拟网卡名称为tun1并使用192.168.104.128/25。
以下为服务端的OV虚拟网卡tun1和物理网卡ens192的信息:
- [root@CN1-Portal ~]# ifconfig tun1
- tun1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
- inet 192.168.104.129 netmask 255.255.255.255 destination 192.168.104.130
- inet6 fe80::e05d:24ac:6f94:cdd8 prefixlen 64 scopeid 0x20<link>
- unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
- RX packets 165394 bytes 11187810 (10.6 MiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 165079 bytes 18712646 (17.8 MiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- [root@CN1-Portal ~]# ifconfig ens192
- ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- inet 192.168.100.5 netmask 255.255.252.0 broadcast 192.168.103.255
- inet6 fe80::7ea1:117:4d7e:452f prefixlen 64 scopeid 0x20<link>
- ether 00:0c:29:b0:xx:xx txqueuelen 1000 (Ethernet)
- RX packets 45687405 bytes 30387007142 (28.3 GiB)
- RX errors 0 dropped 296 overruns 0 frame 0
- TX packets 34026764 bytes 30739981312 (28.6 GiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
复制代码
重庆网友:试试用tap,不要用tun
广东网友:嗯,我在研究如何用iptables让192.168.0.0/22的流量全部走虚拟网卡tun0。
在套路云装ov不是不行,但现在ov已基本无法免流,$$R用80端口还能畅快得很。
山西网友:顺带问问$$R/V2之类的socks代理,有ping或者跟踪路由的工具吗?
未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » 继续求赐教一个组建私人内网的问题