CEG5101 Lab01
CEG5101 Lab01
Laboratory 01
Introduction to Mininet
LEARNING OBJECTIVES
Upon successful completion of this laboratory, the students will be able to learn:
i. To download and install Mininet.
ii. To become familiar with the Mininet Interface.
EQUIPMENT
DISCUSSION
1.1 Mininet is a network emulator for prototyping a large network on a single machine.
1.2 It is a virtual environment that allows network administrators to experiment and run
a collection of network devices, such as routers, switches, and other related network
devices on a Linux kernel.
1.4 Mininet offers a user-friendly environment for development and research and allows
users to deploy custom networks through the CLI and/or GUI interfaces.
1.5 Mininet is an open-source project, and its source code can be explored on
https://github.com/mininet
1.6 To download and install Mininet, you need a Linux environment. NOTE: If you are not
using Linux, follow and complete lab-00 first before proceeding to the next steps.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 1
1.8 Next, open the terminal on Ubuntu and follow the given steps to complete the
installation process.
1.9 The first step is to get the source code using the command, “git clone
https://github.com/mininet/mininet”
1.10 Next, open the mininet folder (using the command “cd mininet”) and check for
the latest available version using the command “git tag # list available
versions”. You can continue with any version, but it’s recommended to install the
latest one.
1.11 Choose your version for installation with the command “git checkout -b
mininet-2.3.1b4 2.3.1b4”. Note: I have chosen the latest available version
here.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 2
1.12 Next, go back to the source tree or home location of your PC with the command
“cd ..”.
1.13 Once you are at the root location, then type the command
“mininet/util/install.sh [options]” to begin the installation process.
1.14 Once the installation is complete, you will see the process ended with a message
“Enjoy Mininet!”.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 3
1.15 To test the mininet, type “sudo mn” and you will see a small network of 2 hosts
connected with a single switch and a controller is created, and the mininet is initiated
as shown below.
1.18 It is optional but recommended to sign up for the mininet-discuss mailing list at
https://mailman.stanford.edu/mailman/listinfo/mininet-discuss to get support and
discuss with the Mininet community.
2.1 In this activity, we will become familiar with the Mininet environment and start with
building a simple network by connecting two end devices with the switch.
2.2 After completing the installation, launch a terminal and type “sudo mn -h” to get
help describing Mininet options and commands. This gives a list of commands to be
used to create a network emulation.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 4
2.3 Following the above help, the command to build a custom topology of a single switch
and two hosts is “sudo mn --topo single,2”
2.4 The default topology is a minimal topology, and it can be changed with the command
“--topo=NAME”. The available NAME for defining different topologies can be found
from the output of “sudo mn -h” in step 2.2.
2.5 To find out more about the current network topology, type “net” and enter. The
window is shown below. It shows that port eth0 of host h1 is connected to port eth1
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 5
of switch s1. Similarly, port eth0 of host h2 is connected to eth2 of a switch s1. Also,
switch s1 has a loopback interface lo.
2.6 Mininet allows users to issue a specific command on a device with the format of
“DEVICE-NAME COMMAND”. The first string typed into Mininet CLI is the name of the
host, controller, or switch, and the command typed next to the device name is the one
executed on that node. As an example, to check the configured IP address for the host
h1, type “h1 ifconfig”, and for host h2 type “h2 ifconfig”. To print the
process list from host h1 type “h1 ps -a” and so on.
2.7 To find and explore more on available Mininet commands, type “help”. As an
example, the command “nodes” display nodes, “links” displays links and their
active status, and so on.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 6
2.8 You can check network connectivity by sending a ping command from one host to
another. (control + C to quit the ping process)
2.9 To leave Mininet and end the current network setup, type “exit”.
2.10 Next, we will learn to use the GUI interface of Mininet, known as MiniEdit.
2.11 To get started with MiniEdit, locate the folder where mininet is installed and type
“sudo python3 mininet/examples/miniedit.py” The default
interface window for MiniEdit is shown below. (if you are using python2, you can use
the command : “sudo ~/mininet/examples/miniedit.py” )
2.12 You can move your cursor around different icons and a help option will appear with
an explanatory title. Some of the key interface bars and their functioning is highlighted
below.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 7
2.13 We can add devices to the workspace by selecting the device type from the sidebar
and clicking it on the workspace. A link between two devices can be created by
dragging the link option from one device and dropping it on another device.
2.14 Next, to configure a device, right-click on the icon, and select the properties.
2.15 Below shows the property window of host h1 and switch s1, to add or remove
different parameters to the devices.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 8
2.16 We can configure the IP address of host h1 and host h2 using the device property
window. As an example, we use 10.0.0.1/8 for host h1 and 10.0.0.2/8 for host
h2.
2.18 After starting the simulation, we can view the network summary by clicking “Show
OVS summary” from the Run tab.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 9
2.19 We can also check connectivity between devices by sending a ping command from
one host to another. To do so, right-click on the host and select terminal. Type
ping from one host with the address of another host.
2.20 Finally, to save your file as a completed network and for future use, click on
File>save and then save it with .mn (mininet activity file) file format.
https://github.com/mininet/mininet/wiki/Introduction-to-Mininet
http://mininet.org/walkthrough/
pg. 10