Nanonet takes as input a description of a network in the form of link descriptions (attached nodes, weight, delay, bandwidth) and generates a list of commands that will create a network namespace for each node, a virtual Ethernet pair for each link, automatically generate loopback and interface IPv6 addresses, configure the link properties, and finally generate a set of static routes such that each node can reach each other according to the configured link weights. Note that if there is Equal-Cost Multi-Path (ECMP) in the network, appropriate routes will be generated to leverage the available paths.
A network is described in an NTFL file, with one link per line. The first two columns are the name of each peer of the link.
The third column is the link weight (integer), used in the shortest-path computation. The fourth column is the link delay in milliseconds (float). It is
tc, through the
netem module. A value of
0 is valid and means that no
netem rule will be inserted.
The fifth column is the link bandwidth (integer), expressed in Kbps (kilobits per second). It is implemented with
tc, using a Hierarchy Token Bucket.
The following example creates a network of three nodes connected in a triangle, with unit link weights, 0.2 milliseconds of one-way delay per link, and 100 Mbps of bandwidth.
$ cat example.ntfl A B 1 0.2 100000 A C 1 0.2 100000 B C 1 0.2 100000
Note that all links are symmetric. It is not possible to specify asymmetric link properties. Each node receives a /64 prefix and the corresponding
<prefix>::1 loopback address. A /64 prefix is also assigned to each link. The two interfaces of the link receives the addresses
<prefix>::2. The prefixes for loopback addresses are taken from the wider
fc00:42::/32 prefix, and the prefixes for interface addresses are taken from
fc00:2::/32. These default values can be changed in the
Nanonet.__init__ function, in
To generate the topology file, run the following command:
Finally, the list of commands is generated as follows.
All the commands are written in a bash file. In this case, it will be the
To instantiate the virtual topology, simply run the file:
To enter a particular node, run the following command.
This will give you a bash prompt within the virtual node.
Important: Nanonet computes static routes for each node so that any node is reachable from any other node, however the routes are computed only for the loopback addresses, not the interfaces address. Thus, you have to force the source IP of packets to be the loopback address. For exemple, if you wish to ping node C from node A (with loopbacks loC and loA), do the following: