Monday, September 20, 2021


Containernet is a fork of the Mininet network emulator that uses Docker containers as hosts in emulated network topologies.

Multipass describes how build a Mininet testbed that provides real-time traffic visbility using sFlow-RT. This article adapts the testbed for Containernet.

multipass launch --name=containernet bionic
multipass exec containernet -- sudo apt update
multipass exec containernet -- sudo apt -y install ansible git aptitude default-jre
multipass exec containernet -- git clone
multipass exec containernet -- sudo ansible-playbook -i "localhost," -c local containernet/ansible/install.yml
multipass exec containernet -- sudo /bin/sh -c "cd containernet; make develop"
multipass exec containernet -- wget
multipass exec containernet -- tar -xzf sflow-rt.tar.gz
multipass exec containernet -- ./sflow-rt/ sflow-rt mininet-dashboard

Run the above commands in a terminal to create the Containernet virtual machine. 

multipass list

List the virtual machines

Name                    State             IPv4             Image
primary                 Stopped           --               Ubuntu 20.04 LTS
containernet            Running     Ubuntu 18.04 LTS

Find the IP address of the mininet virtual machine we just created (

multipass exec containernet -- ./sflow-rt/

Start sFlow-RT. Use a web browser to connect to the VM and access the Mininet Dashboad application running on sFlow-RT, in this case

Open a second shell.

multipass shell containernet

Connet to the Containernet virtual machine.

cp containernet/examples/ .

Copy the Containernet Get started example script.

This is the most simple example to showcase Containernet.
from import Containernet
from mininet.node import Controller
from mininet.cli import CLI
from import TCLink
from mininet.log import info, setLogLevel


net = Containernet(controller=Controller)
info('*** Adding controller\n')
info('*** Adding docker containers\n')
d1 = net.addDocker('d1', ip='', dimage="ubuntu:trusty")
d2 = net.addDocker('d2', ip='', dimage="ubuntu:trusty")
info('*** Adding switches\n')
s1 = net.addSwitch('s1')
s2 = net.addSwitch('s2')
info('*** Creating links\n')
net.addLink(d1, s1)
net.addLink(s1, s2, cls=TCLink, delay='100ms', bw=1)
net.addLink(s2, d2)
info('*** Starting network\n')
info('*** Testing connectivity\n')[d1, d2])
info('*** Running CLI\n')
info('*** Stopping network')

Edit the copy and add the highlighted line to enable sFlow monitoring:

sudo python3

Run the Containernet example script.

Finally, the network topology will appear under the Mininet Dashboard topology tab.