Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

Mesh Network Routing Algorithm Simulator

Currently not maintained - I write routing protocols in C now and use my emulator.

This is a simple discrete event simulator for sketching mesh network routing strategies in the hopes to find better approaches to mesh routing. Please note that this simulator does not virtualize a TCP/IP stack nor all characteristics of wireless connections. The dynamic nature of MANETs is also not (yet) covered by this simulator.

The simulator is controled via a command line that can also be reached over a network. The output from the simulator is a json files and can be displayed using the Mesh Graph Viewer.

The motivation for this project is that community networks such as Freifunk struggle with scaling issues of their MANETs. The cause is management traffic caused by hundreds of nodes. But testing new algorithms for scalability is a problem since many nodes are required. That is what this high speed simulator is helping with.

Also part of this repository are basic information about mesh routing protocols.

Note: While some routing algorithms have been implemented. Most of them are not in a working state right now.

Overall Workflow

  1. Design algorithm
  2. Test algorithm (<= MeshNetSimulator)
  3. Code program
  4. Test on virtual hardware
  5. Test on real hardware

How to Use

Run the program and use the command line commands to create/load a topology. Then select a routing algorithm, perform a few simulation steps and run the test command.

$ mkdir ~/simulation
$ cd simulation
$ ./MeshNetSimulator-amd64-linux
Listen for commands on

Every time toplogy or node state changes, a new graph.json file is written. You can use the GraphViewer frontend to visualize the topology and node states:

$ ./MeshNetViewer-amd64-linux ~/simulation/graph.json --call tcp:// --config config.json --open

Now the web browsers opens and commands can be passed to the MeshNetSimulator from the command line in the web browser interface. Results will be displayed.

Command Line

The interactive command line allows to control the routing simulator. It is accessible from the terminal and via TCP/UDP/Unix socket.


  • algo [<name>]
    Set current routing algorithm or print list of available algorithms.
  • sim_step [<steps>]
    Run simulation steps. Default is 1.
  • sim_reset
    Reset simulator state.
  • sim_info
    Show simulator state.
  • progress <true|false>
    Show simulation progress.
  • test [<samples>]
    Test routing algorithm with optional sample size.
    Does not change node state.
  • debug_init <source> <target>
    Debug routing path from source to target.
    Does not change node state.
  • debug_step
    Perform a routing step on the path that was initialized.
    Does not change node state.

Graph info:

  • graph_info
    Show graph state.
  • get <key>
    Get node property.
  • set <key> <value>
    Set node property.

Graph topology:

  • graph_clear
    Clear graph.
  • line <node_count> <create_loop>
    Add a line of nodes. Connect ends to create a loop.
  • star <edge_count>
    Add star structure of nodes.
  • tree <node_count> [<inter_count>]
    Add a tree structure of nodes with interconnections
  • lattice4 <x_xount> <y_count>
    Create a lattice structure of squares.
  • lattice8 <x_xount> <y_count>
    Create a lattice structure of squares and diagonal connections.
  • remove_nodes <node_list>
    Remove nodes. Node list is a comma separated list of node ids.
  • connect_nodes <node_list>
    Connect nodes. Node list is a comma separated list of node ids.
  • disconnect_nodes <node_list>
    Disconnect nodes. Node list is a comma separated list of node ids.
  • remove_unconnected
    Remove nodes without any connections.

Graph positions:

  • positions <true|false>
    Enable geo positions.
  • move_node <node_id> <x> <y> <z>
    Move a node by x/y/z (in km).
  • move_nodes <x> <y> <z>
    Move all nodes by x/y/z (in km).
  • move_to <x> <y> <z>
    Move all nodes to x/y/z (in degrees).
  • rnd_pos <range>
    Randomize node positions in an area with width (in km) around current node center.
  • connect_in_range <range>
    Connect all nodes in range of less then range (in km).


  • run <file>
    Run commands from a script.
  • import <file>
    Import a graph as JSON file.
  • export <file>
    Export a graph as JSON file.
  • show_mst
    Mark the minimum spanning tree.
  • crop_mst
    Only leave the minimum spanning tree.
  • exit
    Exit simulator.
  • help
    Show this help.

Build Program

Use cargo build or cargo run to build the project. Cargo is the Rust package manager and build tool.

Similar Software

Big Projects

OMNeT++: OMNeT++ is an extensible, modular, component-based C++ simulation library and framework, primarily for building network simulators.

ns-3: ns-3 is a discrete-event network simulator for Internet systems, targeted primarily for research and educational use.

EMANE: Extendable Mobile Ad-hoc Network Emulator.

Small Projects

MLC: Use lxc containers to simulate mesh networks.

Network Mesh Emulator: Use VirtualBox images with OpenWrt.

Various Links

Various Scientific Papers

A collection of scientific papers somewhat related to Mobile Ad-Hoc Mesh Routing.

Mesh Radio Projects

A collection of projects.