Mininet Installation PDF
Mininet Installation PDF
Learning Objective:
Learn how to use Mininet on CSE Lab machines
Learn the basic commands and facilities of Mininet
Notation: In the examples below, we have used the $ sign to represent the prompt from the
command interpreter (shell). The actual prompt may look quite different on your computer
(e.g. it may contain the computer's hostname, or your username, or the current directory
name). You should only type the name of the command and then press return. In the example
interactions, all of the things that the computer displays are in this font. The commands
that you are supposed to type are in this bold font.
Mininet VM
Mininet is a network emulator which runs a collection of end‐hosts, switches, routers, and links on a
single Linux kernel. It uses lightweight virtualization to make a single system look like a complete
network, running the same kernel, system, and user code. The easiest way to get started is to use a
pre‐packaged Mininet/Ubuntu virtual machine (VM). This VM consists of Mininet itself, all
OpenFlow1 binaries and tools pre‐installed, and tweaks to the kernel configuration to support larger
Mininet networks.
Note: You can also install Mininet through source codes and packages. Find the details in
http://mininet.org/download/.
For your convenience, we already installed a recent Mininet VM image, Mininet 2.2.1, on CSE lab
machines. These instructions describe how to use the VM on the CSE lab machines. If you want to
install the Mininet VM on your personal computer you can follow the instructions at
http://mininet.org/vm‐setup‐notes/.
Setting up your VM
You should first log in to a CSE lab machine and obtain a terminal console. Now run the following
command on the terminal.
$ vm mininet
This launches a Mininet VM for you. Once the VM is up, you can see a login prompt as shown in the
figure on the next page
OpenFlow is communication protocol between switches and controllers. We do not need to know the details
1
of the OpenFlow protocol in this course.
4
Log in to VM
Once the Mininet VM is up, you can log in to the VM, using the following username and password:
mininetvm login: mininet
Password: mininet
The root account is not enabled for login; you can use sudo to run a command with superuser
privileges (just as in a Unix‐based machine).
Note that once the VM starts, it controls the input devices including mouse and keyboard. If you
want to release the input from the VM, press Shift+Ctrl+Alt. If you want to return back to the VM,
click on its window.
For security reasons, it is highly recommended that you change the password of the mininet
user after launching the Mininet VM. To this end use the passwd command at the Mininet
prompt and select a new password. Please change the password each time you login to the
Mininet VM.
SSH into VM
The mininet VM boots into a text console of a fixed resolution. You may find it useful to be have a
console with a larger resolution which is also capable of running applications with a GUI (e.g., gedit).
For this we recommend that you start up a new terminal and SSH into the VM. The lab machines
have a host entry for the IP address of the Mininet VM. Thus, the simplest way to SSH into the VM is
to use the following command:
$ ssh –Y mininet@mininet
4
You can also try to find the VM’s IP address, which for VMware is probably in the range 192.168.x.y.
To this end, in the VM console, run the command ifconfig. The following figure shows a sample
output of the command where the VM’s IP address is 192.168.0.140.
Mount your CSE home directory (VERY IMPORTANT)
It is worth noting that the disk storage in the Mininet VM is not persistent. Thus, all the new
files that you create will disappear after you logout.
Since the disk on Mininet VM is not persistent, you will need to store your experiments including
your source code and results on a persistent disk, e.g. your CSE home directory. One way to do this is
to copy all of your files into your CSE home directory using SCP. Another solution (which we
recommended) is to mount your CSE home directory into the Mininet VM. For this, run the following
command, where Account must be replaced with your CSE account name.
$ sshfs [email protected]:/home/Account/ /home/mininet/cse
Note that the above command will ask you for the password of your CSE account. This command will
mount your CSE home directory at /home/mininet/cse in the VM. After that, you have access to your
CSE home directory (which is a persistent disk) in the Mininet VM. You should store all your files in
the above directory.
IMPORTANT: You will have to mount your CSE home directory in the VM each time you login to
the Mininet VM. Please remember to do so else all your work will be lost.
Mininet Walkthrough
4
You are now ready to do the first lab on your Mininet VM: Introduction to Mininet. It is also highly
recommend that you read through the Mininet Walkthrough at the following link:
http://mininet.org/walkthrough/ and follow the tutorials.
Useful Resources
Useful introduction to Mininet (Recommended Reading)
1. https://github.com/mininet/mininet/wiki/Introduction‐to‐Mininet
2. https://github.com/mininet/mininet/wiki/FAQ
Useful Background for Using Mininet
You will need some basic knowledge of Python programming for using Mininet. The following links
are excellent resources for picking up the basics:
1. Python documentation is a good place to start: http://docs.python.org/tutorial/index.html
2. Beginner’s guide: http://www.python.org/about/gettingstarted
3. Importing Python modules: http://docs.python.org/tutorial/modules.html
4. Invoking system utilities from Python: http://docs.python.org/library/subprocess.html
5. Parsing output files in your own format: http://docs.python.org/library/re.html
6. Passing command line arguments to your script:
http://docs.python.org/dev/library/argparse.html