Most people who use the Mininet network simulator will download and set up the Mininet virtual machine image. However, there are times when we may want to use a different version of Mininet than the one already installed in the Mininet VM.
For example, we may want to use the newest features of Mininet currently being developed. The Mininet project releases beta-quality source code that user can download and install themselves.
Do not install Mininet on your host computer
Warning: Do not install Mininet on your host computer. Install in in a virtual machine.
The Mininet install script may overwrite files in your home directory (depending on what you already have installed)1. If Mininet makes changes that cause problems on an existing virtual machine, you can just delete the VM and try again with a fresh Ubuntu Server image. But, if you install Mininet directly on your host computer you may cause problems.
In my own experience, I tried installing Mininet on my host computer to see what would happen. After the installation was complete, I encountered system error messages and my current installation of Open vSwitch stopped working on my computer.
Unless you are a Linux expert, ensure that you install Mininet only on a VM.
The Mininet documentation provides installation instructions. In this post we describe the procedure we followed and add a few details we think are helpful. The Mininet documentation also provides information about how to uninstall Mininet, how to install Mininet in other Linux distributions, and other details that we do not cover in this post.
To install Mininet 2.2 Beta on a new virtual machine, we will execute the following steps:
- Install Ubuntu Server 14.04 on a new VirtualBox virtual machine image
- Update the Ubuntu Server system and install required software
- Install Mininet 2.2 on the Ubuntu Server virtual machine
- Set up the virtual machine to work with the host computer
- Login to the Ubuntu Server VM and enable X11 forwarding using SSH
Download the Ubuntu Server 14.04 ISO image from ubuntu.com.
Create a new virtual machine in VirtualBox and install Ubuntu Server on it. Use the steps described in my previous post about installing Debian in a VirtualBox VM. The procedure is the same.
When installing Ubuntu Server, you can use all the default configurations and choose setting specific to your needs that will be obvious to you (like country, keyboard layout, and time zone).
In our example, I chose to name the server mininet-2-2 and to create a userid brian so all the following examples will use these names. You may choose different names.
First download and install system updates.
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get dist-upgrade
Install required software
Install git. Git is the software version control system used by the Mininet project.
$ sudo apt-get install git
Use git to download the Mininet 2.2.0 source code.
$ git clone git://github.com/mininet/mininet
This creates a folder in the home directory named mininet that contains the project file structure.
To find the latest beta version of Mininet, list all tagged releases in the Mininet project.
$ cd mininet $ git tag 1.0.0 2.0.0 2.1.0 2.1.0p1 2.1.0p2 2.2.0b0 2.2.0b1 2.2.0b2 2.2.0b3 cs244-spring-2012-final
Above, we see the latest available beta release is 2.2.0b3. So, we switch to that branch on our virtual machine.
$ git checkout -b 2.2.0b3 Switched to a new branch '2.2.0b3'
The Mininet project provides an install script. Run the script. This will install Mininet 2.2 because the script is run using the files in the Mininet 2.2.0b3 branch.
$ ~/mininet/util/install.sh -a
After the script stops running, test that the installation was successful. Execute the following command to test the installation. It should run a short Mininet scenario successfully.
$ sudo mn --test pingall
Now we will set up the virtual machine so that we can connect to it from the host computer using SSH.
Shut down the Ubuntu Server VM.
$ sudo shutdown -h now
In VirtualBox, Add a host-only adapter to the VM. Use the procedures listed below in my post about setting up the Mininet VM.
- Add a Host-only Adapter in VirtualBox
- Add Network Adapter to Mininet virtual machine
- Start the Ubuntu Server VM again and log in via the VirtualBox console window
- Configure a new virtual ethernet interface on the virtual machine
In the VirtualBox console menu, login to the VM and make a note of the IP address used by the host-only adapter:
$ ifconfig eth1
You may log out of the VirtualBox console if you want.
In our example above, the VM’s host-only adapter IP address is 192.168.56.101. So we will connect to this address via SSH from a terminal window on the host computer. This enables X11 forwarding so we can run X applications, such as Wireshark or MiniEdit.
admin@Host:~$ ssh -Y email@example.com brian@mininet-2-2:~$
In the example above, we have a user account blinklet on the Ubuntu Server named mininet-2-2. You may have defined a different username and server name.
We installed Mininet 2.2 Beta on a virtual machine running Ubuntu Server 14.04.
See the README.md file in the ~/mininet directory after you download the Mininet source code ↩