meshnet-lab:使用Linux网络名称空间模拟大型移动自组织网状网络

  • E0_792477
    了解作者
  • 7MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-30 12:24
    上传日期
网状网络实验室 在计算机上模拟数百个节点的移动自组织网状网络。 该网络使用通过虚拟以太网接口连接Linux网络名称空间来实现。 网络是在JSON文件中定义的。 支持使用模拟不同的网络特性,例如带宽,数据包丢失,等待时间和其他特性。 还支持节点移动性。 该仿真可以在多台计算机上分布式运行,并且轻量级,足以仅在一台台式计算机上支持200个以上的节点。 该项目旨在测试Mobile AdHoc Mesh路由协议。 开箱即支持 , , , , , , , 和 。 检查。 小例子: { "links": [ { "source": "a", "target": "b" }, { "source": "b", "target": "c" } ] } JSON密钥: source , target :必须。 节点的名称或编号。 最多6个字符。 source和target是可互换的,没有特殊区别。 可以添加一个显式节点列表(例如, "nodes": [{"id": "a"}, {"id":
meshnet-lab-master.zip
内容介绍
# Mesh Network Lab Emulate mobile ad-hoc mesh networks of hundreds of nodes on a computer. The network is realized using Linux network namespaces that are connected via virtual Ethernet interfaces. The network is defined in a JSON file. Supported is the emulation of different network characteristics like bandwidth, packet loss, latency and others using [traffic control](https://en.wikipedia.org/wiki/Tc_(Linux)). Node mobility is supported as well. The emulation can run distributed on multiple computers and is lightweight enough to support >200 of nodes on a single desktop computer alone. This project is meant to test Mobile AdHoc Mesh routing protocols. Out of the box supported are [Babel](https://www.irif.fr/~jch/software/babel/), [B.A.T.M.A.N.-adv](https://www.open-mesh.org/projects/open-mesh/wiki), [OLSR1](https://github.com/OLSR/olsrd), [OLSR2](https://github.com/OLSR/OONF), [OSPF](https://bird.network.cz/), [BMX6](https://github.com/bmx-routing/bmx6), [BMX7](https://github.com/bmx-routing/bmx7), [Yggdrasil](https://github.com/yggdrasil-network) and [CJDNS](https://github.com/cjdelisle/cjdns). Check out the [test results](results/README.md). Small example: ``` { "links": [ { "source": "a", "target": "b" }, { "source": "b", "target": "c" } ] } ``` JSON keys: - `source`, `target`: Mandatory. Name or number of the node. Maximum of 6 characters long. `source` and `target` are interchangeable and have no special distinction. - An explicit node list can be added (e.g. `"nodes": [{"id": "a"}, {"id": "b"}]` to define node specific variables for use in combination with the `--node-command`. - Other data fields are ignored. ## Usage First you need to have at least one routing protocol available. Batman-adv is already in the Linux kernel, so you only need to install the batctl package. There is a [script](misc/setup.sh) to install all routing protocols. Example run: ``` # Create a 10x10 grid and write it to a file called graph.json ./topology.py grid4 10 10 > graph.json # Create network ./network.py apply graph.json Network setup in 10.834s: nodes: 100 created, 0 removed, 0 updated links: 180 created, 0 removed, 0 updated # Start software ./software.py start batman-adv Started 100 batman-adv instances in 3.16s # Run some test commands (output omitted) ./tools.py ping ./tools.py traffic --duration 3 ./software.py --verbosity verbose run 'ip a && echo "Hello from inside node"' # Stop software ./software.py stop batman-adv Stopped 100 batman-adv instances in 3.109s # Remove network ./network.py apply none ``` As an alternative, you can stop all protocols using `./software.py clear` and remove all namespaces using `./network.py clear`. This is useful to cleanup after a tests has been interrupted. The `batman-adv` protocol refers to the start/stop scripts in the [protocols](protocols/) subfolder. Add your own scripts to support other protocols. A collections of automated tests with data plot generation is available in the [tests](tests/) subfolder. ## Software Components * `network.py` creates a network topology from a description in JSON. * `software.py` starts routing protocol software in all namespaces. * `topology.py` creates JSON files with descriptions of common topologies (grids, lines, loop, trees). * `tools.py` contains tools to create ping statistics and to measure traffic. The code is written for Python 3 and uses the `ip`, `ping` and `pkill` commands. You need Linux Kernel >=4.18 to run meshnet-lab. ## Add Traffic Control The command provided via the `--link-command` parameter of the network.py script will be executed twice. Once for every device end of a link (in the `switch` namespace). It is meant to be used to configure the kernel packet scheduler. Given some link: ``` { "links": [ {"source": 0, "target": 1, "rate": "100mbit", "source_latency": 2, "target_latency": 10} ] } ``` The command can now make use of the following variables: ``` ./network.py \ --link-command 'tc qdisc replace dev "{ifname}" root tbf rate {rate} burst 8192 latency {latency}ms' \ apply graph.json ``` Notes: - the command is called for each end of a link - `source_` and `target_` prefixes are omitted - `ifname` is always provided ## Distributed Execution Emulating a lot of nodes can bring a single computer to its limits. Use `network.py --remotes <json-file> ...` to distribute the mesh network on several remotes. The SSH login as root to these computers must be passwordless. Example remotes.json: ``` [ {"address": "192.168.44.133"}, {"address": "192.168.44.135"} ] ``` (Note: You can also specifiy a SSH `"identity_file"`) A typical distributed workflow would be: ``` # create network ./network.py --remotes remotes.json apply graph.json # start software ./software.py --remotes remotes.json start batman-adv # run tests ./tools.py --remotes remotes.json ping ``` ### SSH Connection Sharing Distributed emulation uses SSH to execute commands on remote hosts. To speed up SSH connections a lot, add this to your `~/.ssh/config`: ``` Host * ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p ControlPersist 600 ``` (Note: make sure directory `~/.ssh/sockets/` exists) ## Limitations - no support for multiple connections between two nodes (multigraphs) - only one mesh interface per node/namespace - no discrete event simulation that can run faster than real time - computer performance might influence results ## Internal Working Every node is represented by its own network namespace (`ns-*`) and a namespace called `switch` that contains all the cabling. The node namespace and bridge in `switch` are connected by a veth peer pair `uplink` and `dl-<node>`. All interfaces in the bridges (except the `dl-<node>`) are set to `isolated`. This makes data flow only to and from the non-isolated `dl-<node>` interface, but not between them. All bridges have `ageing_time` and `forward_delay` set to 0 to make them behave link a hub. A packet from the uplink will be send to all connections, but not between them. ![Visual Example](misc/network_mapping.png) - Applications can be started in namespaces `ns-a`, `ns-b`, `ns-c` etc. and see only their interface called `uplink` - bridges have properties `stp_state`, `ageing_time` and `forward_delay` set to 0 - ve-* interfaces have property `isolated` set to `on` - only one simulation can be run at the same time ## Routing Protocol Notes - BATMAN-adv: - needs batctl installed - the current metric limits the maximum hop count to 32 ([source](https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2020-April/019212.html)) - `kworker/u32:1+bat_events` quickly becomes a single threaded bottleneck - change `create_singlethread_workqueue()` to `create_workqueue()` in `net/batman-adv/main.c` ([source](https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2020-April/019214.html)) - this seems to have a very little effect - OGM paket TTL is 50 ([source](https://git.open-mesh.org/batman-adv.git/blob/refs/heads/master:/net/batman-adv/main.h#l26)) - tested with batman-adv 2019.4 - OLSR2 complains when the Linux kernel is not compiled with CONFIG_IPV6_MULTIPLE_TABLES enabled - all routes will land in the main table which can interfere with Internet access - this is of no concern for the test setup - tested with olsr2 0.15.1 - OLSR1 has buggy/broken IPv6 support, we use IPv4 instead - tested with olsr1 0.9.8 - Babel has a maximum metric of 2^16 - 1, a single wired hop has a default metric of 96, a wireless hop with no packet loss has a metric of 256. That allows a maximum hop count of around 683 hops. ([source](https://alioth-lists.debian.net/pipermail/babel-users/2020-April/003688.html)) - use `default rxcost 16` in the configuration file to configure the metric - Yggdrasil needs the most resources (CPU/RAM) of the routing protocol programs supported here - encrypts traffic - CJDNS security can be disabled. Compile for speed using `NS
评论
    相关推荐
    • askreduce:分布式问题
      分布式问题 仅使用intro_python材料进行初始设置 intro_python.md是 CSQ(冒号分隔的问题) csq2fix.py以 JSON 格式转换为 Django 固定装置格式 该输出进入要加载的shufflesort/fixtures 设置新鲜: python ...
    • nsq:实时分布式消息传递平台
      来源: : ... 为了获得最大的灵活性,它与数据格式无关(消息可以是JSON,MsgPack,协议缓冲区或其他任何东西)。 官方提供了Go和Python库(以及许多其他),并且,如果您有兴趣构建自己的库,则有
    • dubbo-admin分布式工具
      dubbo-admin分布式工具,配合 zk使用,能够监控注册的服务及服务消费情况,方便分布式环境查错
    • D-JSON:[已弃用] 分布式 JSON
      D-JSON分布式 JSON 快速开始 npm install d-json 你也可以直接克隆 repo: git clone https://github.com/Krinkle/D-JSON.git 或者 。
    • 分布式服务调用链客户端
      分布式服务调用链客户端
    • Akka.net分布式实例
      Akka.net分布式实例
    • 分布式计算
      分布式计算
    • aposd:分布式自适应投资组合选择(撇号)
      分布式自适应投资组合选择(撇号) 优化的APOSD自动优化方法。 在高性能计算集群的环境... Controusétroitementavecle求解器 ,用于在Internet上模拟互连网络之间的连接的基础,或用于JSON的通信进程间通信的仿真器。
    • DataXWeb分布式数据同步工具
      DataX Web是在DataX之上开发的分布式数据同步工具,提供简单易用的操作界面,降低用户使用DataX的学习成本,缩短任务配置时间,避免配置过程中出错。用户可通过页面选择数据源即可创
    • tracing-examples:将第三方跟踪器与SignalFx一起使用的示例
      只要配置为将跨度发送到SignalFx接收端点的跟踪器使用Zipkin v1 / 2 JSON线格式或Jaeger Thrift格式,我们就将接受跨度,而不论如何对其进行检测-通过上述开放库之一或本地开放库。 我们的目标是在巨型社区的肩膀上...