Virtual riot network
Clone this wiki locally
RIOT features the native port with networking support. This allows you to run any RIOT application on your Linux or Mac computer and setup a virtual connection between these processes. In order to do this, the nativenet module uses TAP devices (https://www.kernel.org/doc/Documentation/networking/tuntap.txt) and provides a simple script to configure an Ethernet bridge connecting these devices.
Your first topology (2 nodes, 1 hop)
The easiest way is to use the shell script
RIOT/dist/tools/tapsetup/tapsetup -c 2 which sets up a bridge for two tap devices to communicate over (say tap0 and tap1).
Under Ubuntu or Debian, if the script fails because it does not find
brctl install the bridge utils, for example using apt-get
sudo apt-get install bridge-utils
Once this is in place, run one RIOT instance using tap0 and another using tap1. For example, example/default/ open a terminal and run
make term PORT=tap0. Then open a second terminal and run
make term PORT=tap1. In each RIOT shell, set node address using the
addr shell command. Then you can send messages between the two RIOT instances using the
txtsnd shell command (and you can view available shell commands as usual, by typing
Once you are done with your tests, remove the bridge by using the script
For the virtualization of the DES-Testbed we developed a Python framework called desvirt (Virtualizing a testbed). Desvirt allows to setup a virtual network, by starting qemu instances, connect them over TAP devices, and implementing the packet loss rates between the interfaces with ebtables and tc.
Desvirt also supports RIOT nativenet. You can use the topology_generator to define a virtual network. For example:
./topology_creator -e /tmp/default-native.elf -n riot_native -r ieee802154 -s2 -tline -l50 -f line2
will create an XML configuration file, for a very basic network, containing two connected RIOT native instances and 50% packet loss. Copy the resulting XML file to .desvirt/, read in the configuration by running
./vnet -n line2 -d
and start the network:
./vnet -n line2 -s
There is a hard limit of 1024 interfaces per bridge in Linux at the moment. If you need more instances in one network you will have to modify and recompile your kernel. Compare https://github.com/dotcloud/docker/issues/1320#issuecomment-22346764 .
On the bright side, 1000 instances only need 200MB of RAM (examples/default with ltc disabled) and about no CPU (while they're not doing anything), so at least the trouble pays off.
Due to a bug in desvirt, it is not possible to define grid networks with more than 26 nodes per line. Compare https://github.com/des-testbed/desvirt/issues/10 .