Thursday, November 19, 2020

Multipass

Multipass is a command line tool for running Ubuntu virtual machines on Mac or Windows. Multipass uses the native virtualization capabilities of the host operating system to simplify the creation of virtual machines.

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 list
List 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 iperf
In 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_rest
Start 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 iperf
Run 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 mininet
Stop the virtual machine.
multipass start mininet
Start the virtual machine.
multipass delete mininet
multipass purge
Delete 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.

5 comments:

  1. snehas-MacBook-Pro:mininet sneha$ multipass exec mininet -- ./sflow-rt/start.sh -Dscript.file=../ryu.js

    2020-12-03T17:55:30-05:00 INFO: Starting sFlow-RT 3.0-1538

    2020-12-03T17:55:31-05:00 INFO: Version check, running latest

    2020-12-03T17:55:31-05:00 INFO: Listening, sFlow port 6343

    2020-12-03T17:55:32-05:00 INFO: Listening, HTTP port 8008

    2020-12-03T17:55:32-05:00 INFO: ../ryu.js started

    2020-12-03T17:55:32-05:00 INFO: app/mininet-dashboard/scripts/metrics.js started

    2020-12-03T17:58:19-05:00 WARNING: ../ryu.js ../ryu.js#37 not found

    2020-12-03T17:58:19-05:00 INFO: ../ryu.js stopped



    snehas-MacBook-Pro:~ sneha$ multipass exec mininet -- ryu-manager ryu.app.simple_switch,ryu.app.ofctl_rest

    loading app ryu.app.simple_switch

    loading app ryu.app.ofctl_rest

    loading app ryu.controller.ofp_handler

    instantiating app None of DPSet

    creating context dpset

    creating context wsgi

    instantiating app ryu.app.simple_switch of SimpleSwitch

    instantiating app ryu.app.ofctl_rest of RestStatsApi

    instantiating app ryu.controller.ofp_handler of OFPHandler

    (12097) wsgi starting up on http://0.0.0.0:8080

    (12097) accepted ('127.0.0.1', 44758)

    No such Datapath: 2

    127.0.0.1 - - [03/Dec/2020 17:58:19] "POST /stats/flowentry/add HTTP/1.1" 404 141 0.070637

    ReplyDelete
  2. If you are trying to run the example in Ryu measurement based control, you need to copy the ryu.js file to the mininet virtual machine. You can open a shell in the virtual machine and edit the file.

    ReplyDelete
    Replies
    1. Yes i did that , as you can see ryu.js file did start running
      2020-12-03T17:55:32-05:00 INFO: ../ryu.js started
      There seems to be something wrong with the path /stats/flowentry/add because of which it is giving 404 error.
      127.0.0.1 - - [03/Dec/2020 17:58:19] "POST /stats/flowentry/add HTTP/1.1" 404 141 0.070637

      Delete
    2. Are you sure that Mininet is connected to the Ryu controller? The "No such Datapath: 2" message indicates that the OpenFlow connection to Ryu hasn't been established and so it doesn't know about switch 2.

      Delete
    3. Thanks for the reply, you were right mininet was not connected to ryu i missed --controller=remote when creating topology, may be in the documentation that could be added.
      When i used the following command to create topology it worked fine,thanks a ton!!!!

      multipass exec mininet -- sudo mn --custom sflow-rt/extras/sflow.py --link tc,bw=10 --topo tree,depth=2 --controller=remote

      Delete