Docker testbed and Docker DDoS testbed describe how to use containers to experiment with network visibility and control. However, not all software is amenable to running in containers, and so the ability to quickly create and configure virtual machines is a useful complement. This article demonstrates how to use Multipass to quickly build a virtual machine to run Mininet network emulation software.
multipass launch --name=mininet bionic multipass exec mininet -- sudo apt update multipass exec mininet -- sudo apt -y install mininet python-ryu multipass exec mininet -- sudo apt -y install default-jre python-requests hping3 multipass exec mininet -- wget https://inmon.com/products/sFlow-RT/sflow-rt.tar.gz multipass exec mininet -- tar -xzf sflow-rt.tar.gz multipass exec mininet -- ./sflow-rt/get-app.sh sflow-rt mininet-dashboard
Run the above commands in a terminal to create the virtual machine. Multipass commands can easily be scripted to automate the creation and configuration of virtual machines.
multipass listList the virtual machines.
Name State IPv4 Image test Running 192.168.64.2 Ubuntu 18.04 LTS
Find the IP address of the mininet virtual machine we just created (192.168.64.2).
multipass exec mininet -- ./sflow-rt/start.sh
Start sFlow-RT.
Use a web browser to connect to the VM and access the Mininet Dashboard application running on sFlow-RT, in this case http://192.168.64.2:8008/app/mininet-dashboard/html/multipass exec mininet -- sudo mn --custom sflow-rt/extras/sflow.py \ --link tc,bw=10 --topo tree,depth=2,fanout=2 --test iperfIn a separate terminal, run a test using Mininet.
The Mininet Dashboard shows the test traffic, the links in the emulated network carrying the traffic, and the diameter of the emulated network.
The Topology tab shows a Mininet weathermap, displaying a dynamic view of topology in which link widths update in real-time to reflect traffic flowing over the virtual network.An external SDN controller can be used to control packet forwarding in the network.
multipass exec mininet -- ryu-manager ryu.app.simple_switch,ryu.app.ofctl_restStart the Ryu SDN controller in a terminal window.
multipass exec mininet -- sudo mn --custom sflow-rt/extras/sflow.py \ --link tc,bw=10 --topo tree,depth=2,fanout=2 \ --controller=remote,ip=127.0.0.1 --test iperfRun the same test as before, but this time connecting to the SDN controller. For a more interesting example, Ryu measurement based control describes how to detect and block denial of service attacks using the controller.
There are additional multipass commands available to manage the virtual machine.
multipass shell mininet
Connect to the virtual machine and access a command shell.
multipass stop mininetStop the virtual machine.
multipass start mininetStart the virtual machine.
multipass delete mininet multipass purgeDelete the virtual machine.
There are a number of Mininet articles on this blog describing projects that can be run using the virtual machine that demonstrate performance aware software defined networking concepts.