2020-09-23 【P2P overlay network】

2020-09-23  本文已影响0人  一枚攻城狮

本项目提供云网络服务,用于多地区组网技术,相当于将多个地域网络虚拟统一局域网,方便团队跨地域网络访问;提供统一控制面板进行管理,并且利用P2P技术提升节点近点加速;如果多个节点处于内网,那么会优先采用内网进行互通;并且支持多云转发管理;根据网络时延动态路由;

原理图:

image

版本特性:

软件下载地址:https://github.com/easymesh/easymesh/releases/

根据您所需要部署的形态决定;客户端、服务端没有绑定限制,支持windows & linux 混合部署使用;提供 gateway 和 transfer 两个可执行文件;gateway 属于客户端,transfer 属于服务端,该版本transfer还不支持分布式部署,部署transfer需要准备一个公网IP地址;

安装部署

1、准备工作:

部署gateway程序需要完成如下平台的检查和安装;

windows

linux

2、启动transfer程序

需要提前准备一台linux/windows云主机,并且绑定固定公网IP地址,不一定需要绑定域名;以及两个本地linux/windows测试节点;

启动命令:

Usage of transfer.exe:
  -bind int
        transfer server bind port (default 8000)
  -debug
        debug mode
  -help
        usage
  -log string
        log dir (default "/opt/log")
  -nums int
        transfer server instance nums (default 1000)
  -public string
        public IP (default "www.youdomain.com")

注意:使用方式不区分windows、linux平台,启动后保持后台长时间运行即可;

3、启动gateway程序

在客户端侧,可以连接外网访问云主机的节点都可以;

Usage of gateway.exe:
  -debug
        debug mode
  -help
        usage
  -iface string
        used interface or ip address (default "eth0")
  -ip string
        virtual IP (default "172.168.0.1")
  -log string
        log dir (default "/opt/log")
  -trans string
        transfer public address (default "www.youdomain.com:8000")
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.2  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::215:5dff:fe03:b00  prefixlen 64  scopeid 0x20<link>
...

windows通过查看ipconfig命令查看地址:

以太网适配器 vEthernet (wlan):
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::5523:9866:1b83:5ad7%9
IPv4 地址 . . . . . . . . . . . . : 192.168.3.11
子网掩码  . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 192.168.3.1

注意:使用方式不区分windows、linux平台,启动后保持后台运行即可;

4、测试连通性:

两个部署gateway的节点互ping对方的虚拟IP地址;结果如下表示成功;

root@node2:~# ping 172.168.3.1
PING 172.168.3.1 (172.168.3.1) 56(84) bytes of data.
64 bytes from 172.168.3.1: icmp_seq=1 ttl=126 time=2.78 ms
64 bytes from 172.168.3.1: icmp_seq=2 ttl=126 time=3.65 ms
64 bytes from 172.168.3.1: icmp_seq=3 ttl=126 time=2.85 ms

5、测试环境

为了方便大家测试,我们提供一台位于云主机服务器,已经部署transfer程序,提供大家测试使用,1Mb带宽,资源有限:

121.37.163.197:5000 ~ 121.37.163.197:6000
注意:任意选择一个端口测试即可,注意可能会有人同时使用一个端口;尽量测试完成后停止使用,避免与其他人冲突;

大家在本地部署gateway程序就可以了;准备两台节点;

参考命令:

windows:

gateway.exe -ip 172.168.3.1 -trans 121.37.163.197:5555 -iface "vEthernet (wlan)" -debug

linux:

./gateway -ip 172.168.3.2 -trans 121.37.163.197:5555 -iface "eth0" -debug

两个节点相互ping对方虚拟IP;

root@node2:~# ping 172.168.3.1
PING 172.168.3.1 (172.168.3.1) 56(84) bytes of data.
64 bytes from 172.168.3.1: icmp_seq=1 ttl=126 time=2.78 ms
64 bytes from 172.168.3.1: icmp_seq=2 ttl=126 time=3.65 ms
64 bytes from 172.168.3.1: icmp_seq=3 ttl=126 time=2.85 ms

注意:如果两个节点在同一个局域网,那么他们互ping时延也会很低,如果多个地域,会自动走公网转发服务,所以时延会较长;

也可以通过 ipconfig、ifconfig 查看虚拟网卡IP地址信息;

mesh0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1472
        inet 172.168.3.2  netmask 255.255.255.255  destination 172.168.3.2
...
上一篇 下一篇

猜你喜欢

热点阅读