VirtualBox Mininet Setup

These instructions are for setting up a VM on your local machine for completing PA2.

Set up your VM

Mininet can create virtual networks with arbitrary topologies, which run within a Virtual Machine (VM) that you install at your laptop.

If you have any problems go to Mininet website for a tutorial and more detailed instructions.

  • Download and install VirtualBox, a virtualization platform.
  • Download the PA2 VM.
  • Enable host-only network: On VirtualBox go to Preferences->Network->Host-only Networks and add a host-only network adapter (vboxnet0).
  • Import VM: On VirtualBox, go to File->Import Appliance and select the .ova file from your unzipped folder. Follow the steps to create your VM.
  • Enable host-only adapter: On your newly created VM, go to Settings->Network->Adapter 2 and add a host-only-network adapter (using vboxnet0).
  • Start and login in your VM. When prompted, login using cs244/cs244 as user/password.
  • Check the available networks in your VM by typing “ifconfig”.
    • You should see both eth0 and eth1. One should have a 192.168.X.X (host-only) and the other 10.0.X.X (NATted). If one of the two is missing, run “sudo dhclient ethX” (replace with eth0 or eth1).
    • Check again with ifconfig. Write down the IP address for host-only - it should be something like You’ll use this to SSH to your VM shortly.
  • Check Internet connectivity: Make sure you can access the Internet from your VM.
    • ping
  • The following should be installed for you, so skip this step.
    • Download a necessary tool for Python plotting:
      • sudo apt-get install python-matplotlib
    • Download pip, a Python package installation tool:
      • sudo apt-get install python-pip
    • Download termcolor, a Python package for color formatting in terminal:
      • pip install termcolor
  • SSH into your VM: Go back to your laptop. Open a terminal (Windows users try putty), and try to connect to your VM through ssh.
    • ssh cs244@192.168.X.X (replace with your host-only IP address)

By the end of this step you should be able to run the VM at your laptop, connect to it through SSH, and reach the Internet from within your VM.

Get familiar with Mininet

SSH into your VM. You can see a list with Mininet options using:

$ sudo mn -h

Start Mininet. By default, it will create a simple network with 2 hosts (h1, h2) and 1 switch (s1).

$ sudo mn

Now, while you are at the mininet CLI you can send commands to hosts. Start a ping from h1 to h2 using the following command. You should be seing replies from

mininet> h1 ping h2

iperf is a networking tool to test network performance. To see the maximum TCP throughput between the two hosts use the following command (NOTE: as h1 and h2 are connected locally within your VM you should get a very high bandwidth. )

mininet> iperf h1 h2

See what other commands are available through Mininet’s CLI, and try a few of them.

mininet> help

Make sure you properly shutdown Mininet, otherwise it won’t start correctly.

mininet> quit

If Mininet didn’t shutdown correctly use the following to clean-up:

$ sudo mn -c

You can explore a much more detailed walkthrough here . A walkthrough of the Mininet Python API is available here.