0% found this document useful (0 votes)
19 views25 pages

Practica3 Intro To Mininet

This document outlines a lab session focused on using Mininet for designing and testing Software Defined Networks (SDNs). It includes instructions for setting up a virtual machine, configuring the environment, and performing various exercises with Mininet, such as testing connectivity, running a web server, and customizing topologies. The lab aims to provide hands-on experience with network simulation and management using Mininet.

Uploaded by

sabofo6632
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views25 pages

Practica3 Intro To Mininet

This document outlines a lab session focused on using Mininet for designing and testing Software Defined Networks (SDNs). It includes instructions for setting up a virtual machine, configuring the environment, and performing various exercises with Mininet, such as testing connectivity, running a web server, and customizing topologies. The lab aims to provide hands-on experience with network simulation and management using Mininet.

Uploaded by

sabofo6632
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Network Planning Lab 3

Introduction to Mininet

March 25, 2024

1 Objectives
The main objective of this lab is to introduce the student in the use of Mininet as a
easy-to-use tool for designing, executing and testing Software Defined Networks
(SDNs).

2 Setting up the lab


In order to carry out this lab session, a virtual machine (VM) is necessary. The
required VM has been properly configured with the correct X11 settings and
keyboard layout. This machine is available at Aula Virtual through the link https:
//nuvol.uv.es/owncloud/index.php/s/9ie3Dj3zZGJ86GA. In order
to download the virtual machine, you will need to enter the password ”pr-git”.

However, if the student by any reason cannot access to this VM or he/she simply
wants to get trained in setting up linux machines, the next subsection explains
how to download the mininet VM ,and install and configure all the necessary
packages. Those who have downloaded the VM from Aula Virtual can skip
the next subsection and go directly to Section 3

2.1 Setting up the lab from the scratch


In order to carry out this lab, we need to download a Ubuntu Virtual Machine
(VM) with Mininet already installed. This lab guide is adapted to the Ubuntu
20.04.1 VM image which can be downloaded from https://github.com/mininet/
mininet/releases/.

1
From the URL above we can download an .ovf file. If we have VMware
workstation installed in our computer, we must double click on this file, and
VMware workstation will import the file to make a VM virtual machine, and it
will start that VM. Nevertheless, if you have any problem during the VM setup or
you must use another VM for your operating system, you can follow the Mininet
setup notes (http://mininet.org/vm-setup-notes/)
Nevertheless, this VM comes with the English keyboard layout by default.
In order to change it to the Spanish layout, you should execute the following
command in the VM terminal:
$ sudo dpkg-reconfigure keyboard-configuration A screen for selecting the type
of keyboard will appear. You can select the generic 105-key PC keyboard selected
by default, or the keyboard model correct for your machine. Then, a selection
screen like the one in Figure 1 will appear, where you should select the Spanish
keyboard configuration. The default option selected in the next screens should
work fine for the standard case.

Figure 1: Example

When the configuration script finishes, you must reboot the VM to make the
changes take effect.
If you need your VM to have the correct European time, you should execute
the following command on the xterm: $ sudo rm /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/Europe/Madrid /etc/localtime

2
2.2 Setting X11
If instead of “sudoing” with -E option, you can just just run a GUI in your VM
console window. First, log in to the VM in its console window (i.e. type directly
into the VM window without using ssh) and make sure apt is up to date:
$ sudo apt-get update

Then, install the desktop environment of your choice.


$ sudo apt-get install xinit x11-xserver-utils [environment]

where [environment] is your GUI environment of choice. Some options:

• flwm lxterminal: compact and very basic (some would say primitive) window
environment, along with the lxterminal terminal emulator

• lxde: a reasonably compact and and efficient desktop environment

• ubuntu-desktop: the full, heavyweight, and slow Ubuntu Unity desktop


environment

If you installed lxde or ubuntu-desktop, reboot to start the graphical login


manager. At this point, you will have the same VM which is available at Aula
Virtual.

3 Realization of the lab


In this lab session we will carry out the exercises and tests described in the
Mininet walkthrough (http://mininet.org/walkthrough), plus some more exercises
to practice with this tool.
If you have downloaded and started the VM at Aula Virtual, you can log in to
the VM, using the following name and password:
mininet-vm login: mininet
Password: mininet

Once you are in the Genome desktop, you should click on the ”Activities”
menu and select the LXTerminal. Is in this terminal (which is the Command Line
Interface (CLI)) where you should carry out the steps and exercises described in
this lab. Figure 2 illustrates this initial state of the VM which you should reach to
start this lab.

3
Figure 2: Initial state of the Virtual Machine

3.1 Interact with Hosts and Switches


As a first step, you should start Mininet with the minimal topology, using the
CLI. However, first we will start Wireshark, in order to see the frames exchanged
between the switch to the reference controller. In the LXTerminal, just type the
command :
$ sudo wireshark &
Then, start Mininet with the minimal topology by typing
$ sudo mn
The default topology is the minimal topology, shown in Figure 3, which includes
one OpenFlow kernel switch connected to two hosts, plus the OpenFlow reference
controller. This topology could also be specified on the command line with –
topo=minimal. Other topologies are also available out of the box; see the –topo
section in the output of mn -h.
All four entities (2 host processes, 1 switch process, 1 basic controller) are
now running in the VM. If no specific test is passed as a parameter, the Mininet
CLI comes up, with the messages shown in the CLI shown in Figure 3. In the
Wireshark window, you should see the kernel switch connect to the reference
controller.
Once the topology is up, the mininet CLI can accept different commands. In

4
Figure 3: Example

order to know which commands are available and the corresponding syntax, you
can type

mininet> help

to get information about all the commands that you can type in the mininet
CLI, and their syntax. For example, there are commands for displaying the different
elements of the network:
Display nodes: mininet> nodes

Display links: mininet> links

Display the links for all the devices in the network: mininet> net

Dump information about all nodes: mininet> dump

You should see the switch and two hosts listed.

Exercise 1 (0,2 points): Try the following mininet invocation: $sudo mn


--topo linear,4
¿How many network links, switches and hosts exist in this topology?. Use
the commands above to find and list the links by the name given by Mininet,
and describe the devices which connects each link.

5
Answer:

If the first string typed into the Mininet CLI is a host, switch or controller
name, the command is executed on that node. After exiting the CLI of Question
1, run again the $ sudo mn command. Once in this topology, run:
mininet> h1 ifconfig -a

You should see the host’s h1-eth0 and loopback (lo) interfaces. Note that this
interface (h1-eth0) is not seen by the primary Linux system when ifconfig is run,
because it is specific to the network namespace of the host process.
In contrast, the switch by default runs in the root network namespace, so
running a command on the ”switch” is the same as running it from a regular
terminal:
mininet> s1 ifconfig -a
This will show the switch interfaces, plus the VM’s connection out (eth0).
For other examples highlighting that the hosts have isolated network state, run
arp and route on both s1 and h1.

Exercise 2 (0,2 points): List the IPs of all the devices in the topology.
Answer:

6
It would be possible to place every host, switch and controller in its own
isolated network namespace, but there’s no real advantage to doing so, unless you
want to replicate a complex multiple-controller network. Mininet does support
this; see the –innamespace option.
Note that only the network is virtualized; each host process sees the same
set of processes and directories. For example, print the process list from a host
process:
mininet> h1 ps -a
This should be the exact same as that seen by the root network namespace:
mininet> s1 ps -a
It would be possible to use separate process spaces with Linux containers, but
currently Mininet doesn?t do that. Having everything run in the ”root” process
namespace is convenient for debugging, because it allows you to see all of the
processes from the console using ps, kill, etc.

3.2 Test connectivity between hosts


Now, verify that you can ping from host 0 to host 1:
mininet> h1 ping -c 1 h2
If a string appears later in the command with a node name, that node name is
replaced by its IP address; this happened for h2.
You should see OpenFlow control traffic. The first host ARPs for the MAC
address of the second, which causes a packet in message to go to the controller.
The controller then sends a packet out message to flood the broadcast packet to
other ports on the switch (in this example, the only other data port). The second
host sees the ARP request and sends a reply. This reply goes to the controller,
which sends it to the first host and pushes down a flow entry.
Now the first host knows the MAC address of the second, and can send its ping
via an ICMP Echo Request. This request, along with its corresponding reply from
the second host, both go the controller and result in a flow entry pushed down

7
(along with the actual packets getting sent out).
Repeat the last ping:
mininet> h1 ping -c 1 h2
You should see a much lower ping time for the second try (¡ 100us). A
flow entry covering ICMP ping traffic was previously installed in the switch, so
no control traffic was generated, and the packets immediately pass through the
switch.
An easier way to run this test is to use the Mininet CLI built-in pingall command,
which does an all-pairs ping:
mininet> pingall

3.3 Run a simple web server and client


Remember that ping isn’t the only command you can run on a host. Mininet
hosts can run any command or application that is available to the underlying
Linux system (or VM) and its file system. You can also enter any bash command,
including job control (&, jobs, kill, etc..)
Next, try starting a simple HTTP server on h1 1 , making a request from h2,
then shutting down the web server:
mininet> h1 python -m http.server 80 &
mininet> h2 wget -O - h1
...
mininet> h1 kill %python

In order to exit the CLI, you can use the exit command:
mininet> exit

3.4 Cleanup
If at any time Mininet crashes for some reason, you should clean it up the next
time you invoke it.
$ sudo mn -c
Then, you can start it again as normal:
$ sudo mn
1
NOTE: For Python 3, the HTTP server is called http.server; for Python 2, it is called
SimpleHTTPServer. Make sure you are using the right one for the version of Mininet you are
running. To find out which Python version Mininet is using, you can type mininet> py
sys.version

8
3.5 Self-contained tests
Mininet can also run self-contained regression tests, such a regression test:
$ sudo mn --test pingpair
This command creates a minimal topology, starts up the OpenFlow reference
controller, run ping test among all pairs of nodes, and finally tears down both the
topology and the controller.
Another useful test is iperf (give it about 10 seconds to complete):
$ sudo mn --test iperf
This command created the same Mininet, ran an iperf server on one host, ran
an iperf client on the second host, and parsed the bandwidth achieved.

3.6 Changing Topology Size and Type


The default topology is a single switch connected to two hosts. This topology
can be changed to a different topo with --topo, and pass parameters for that
topology?s creation. For example, to verify all-pairs ping connectivity with one
switch and three hosts, we can use :
$ sudo mn --test pingall --topo single,3
Another example, with a linear topology (where each switch has one host, and
all switches connect in a line):
$ sudo mn --test pingall --topo linear,4
Parameterized topologies are one of Mininet’s most powerful features.
Exercise 3 (0,2 points): Using the help command in mininet, find and list here
all the possible topologies you can use as a parameter in the mininet invocation.
Answer:

3.6.1 Torus topology


Whenever a network topology has loops, the default network controller cannot be
used, neither any Ethernet bridge without STP turned on. It can be used with STP,
e.g.: sudo mn --topo torus,3,3 --switch ovsbr,stp=1

9
Exercise 4 (0,2 points): Build a 3x4 torus and use the ping command to find
the average latency between several pairs of nodes, including the most separated
pair of nodes. Type in the answer box the mininet command(s) you have used:
Answer:

3.7 Link variations


Mininet 2.0 allows you to set link parameters, and these can even be set automatically
from the command line. Try these parameters:
$ sudo mn --link tc,bw=10,delay=10ms
mininet> iperf
...
mininet> h1 ping -c10 h2

If the delay for each link is 10 ms, the round trip time (RTT) should be about
40 ms, since the ICMP request traverses two links (one to the switch, one to the
destination) and the ICMP reply traverses two links coming back.
You can customize each link using Mininet?s Python API. You can fin more
information at https://github.com/mininet/mininet/wiki/Introduction-to-Mininet.

Exercise 5 (0,2 points): Build a network composed of 5 switches with a single


host connected to each of them, and using links of 0.6 Mbps, and a delay of 14
milliseconds. Use the Iperf test to ensure that the bandwidth is correct. Also, issue
a ping command from h1 to h5 and check that the obtained result is correct
Answer:

10
3.8 Adjustable Verbosity
The default verbosity level is info, which prints what Mininet is doing during
startup and teardown. Compare this with the full debug output with the -v param:
$ sudo mn -v debug

Lots of extra detail will print out. On the opposite side is the ”output” option,
a setting that only prints the CLI output: $ sudo mn -v output

3.9 Custom Topologies


Custom topologies can be easily defined as well, using a simple Python API. An
example is provided in the file custom/topo-2sw-2host.py. This example connects
two switches directly, with a single host off each switch. Figure 4 shows the
python code for this example, which is quite intuitive:

Figure 4: Code for a mininet custom topology

This python file uses the Topo class to define the desired topology. First, all
the host and switches are instantiated. Then, the links among them are defined.

11
Finally, as commented in the code itself, the adding of the ’topos’ dict with a
key/value pair to generate our the newly defined topology enables the user to pass
in ’–topo=mytopo’ from the command line.
In order to use the customized topology, the following invocation should be
made:

$ sudo mn --custom /home/mininet/mininet/custom/topo-2sw-2host.py --topo mytopo

When a custom mininet file is provided, it can add new topologies, switch
types, and tests to the command-line. For example, we can add the pingall test to
a custom topology:
$ sudo mn --custom /home/mininet/mininet/custom/topo-2sw-2host.py --topo mytopo
--test pingall

Exercise 6 (0,5 points): Modify the previous custom topology to build a


network with two linked switches S1 and S2. S1 should have the host H1
linked, while S2 should have hosts H2 and H3 attached to it. Write the python
code for this topology and the command to be used to build it in mininet
Answer:

12
Figure 5: Exercise 7

13
Exercise 7 (0,5 points): Modify the previous custom topology to build a
network like the one shown in Figure 5
Answer:

3.10 Setting the MAC and IP of the host


By default, hosts start with randomly assigned MAC addresses. This can make
debugging tough, because every time the Mininet is created, the MACs change,
so correlating control traffic with specific hosts is tough.
The –mac option is super-useful, and sets the host MAC and IP address to
small, unique, easy-to-read IDs.
The normal behavior is:
$ sudo mn
...
mininet> h1 ifconfig
h1-eth0 Link encap:Ethernet HWaddr f6:9d:5a:7f:41:42
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0

14
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:392 (392.0 B) TX bytes:392 (392.0 B)
mininet> exit

The behavior with the –mac option is the following one:


$ sudo mn --mac
...
mininet> h1 ifconfig
h1-eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:01
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
mininet> exit

In contrast, the MACs for switch data ports reported by Linux will remain random.
This is because you can ’assign’ a MAC to a data port using OpenFlow.

3.11 XTerm Display


For more complex debugging, you can start Mininet so that it spawns one or more
xterms.
To start an xterm for every host and switch, pass the -x option:
$ sudo mn -x
After a second, the xterms will pop up, with automatically set window names.
Alternately, you can bring up additional xterms as shown below.
By default, only the hosts are put in a separate namespace; the window for
each switch is unnecessary (that is, equivalent to a regular terminal), but can be
a convenient place to run and leave up switch debug commands, such as flow
counter dumps.
Xterms are also useful for running interactive commands that you may need
to cancel, for which you’d like to see the output.
For example:
In the xterm labeled ”switch: s1 (root)”, run:
# ovs-ofctl dump-flows tcp:127.0.0.1:6654

15
Nothing will print out; the switch has no flows added. To use ovs-ofctl with
other switches, start up mininet in verbose mode and look at the passive listening
ports for the switches when they?re created.
Now, in the xterm labeled ”host: h1”, run:
# ping 10.0.0.2
Go back to s1 and dump the flows:# ovs-ofctl dump-flows tcp:127.0.0.1:6654
You should see multiple flow entries now. Alternately (and generally more
convenient), you could use the dpctl command built into the Mininet CLI without
needing any xterms or manually specifying the IP and port of the switch.
You can tell whether an xterm is in the root namespace by checking ifconfig; if
all interfaces are shown (including eth0), it’s in the root namespace. Additionally,
its title should contain ”(root)”.
Close the setup, from the Mininet CLI:
mininet> exit
The xterms should automatically close. Alternatively, you can display an
xterm only for particular hosts. For example, in order to display a xterm for h1
and h2 you can type:
mininet> xterm h1 h2

3.12 Other Switch Types


Other switch types can be used. For example, to run the user-space switch:
$ sudo mn --switch user --test iperf
Note the much lower TCP iperf-reported bandwidth compared to that seen
earlier with the kernel switch.
If you do the ping test shown earlier, you should notice a much higher delay,
since now packets must endure additional kernel-to-user-space transitions. The
ping time will be more variable, as the user-space process representing the host
may be scheduled in and out by the OS.
On the other hand, the user-space switch can be a great starting point for
implementing new functionality, especially where software performance is not
critical.
Another example switch type is Open vSwitch (OVS), which comes preinstalled
on the Mininet VM. The iperf-reported TCP bandwidth should be similar to the
OpenFlow kernel module, and possibly faster:
$ sudo mn --switch ovsk --test iperf

3.13 Mininet Benchmark


To record the time to set up and tear down a topology, use test ’none’:
$ sudo mn --test none

16
Everything in its own Namespace (user switch only).
By default, the hosts are put in their own namespace, while switches and the
controller are in the root namespace. To put switches in their own namespace,
pass the –innamespace option:
$ sudo mn --innamespace --switch user
Instead of using loopback, the switches will talk to the controller through a
separately bridged control connection. By itself, this option is not terribly useful,
but it does provide an example of how to isolate different switches. Note that this
option does not work with Open vSwitch.
Now, exit mininet by typing mininet> exit

3.14 Python Interpreter


If the first phrase on the Mininet command line is py, then that command is
executed with Python. This might be useful for extending Mininet, as well as
probing its inner workings. Each host, switch, and controller has an associated
Node object. Try the following commands:
At the Mininet CLI, run: mininet> py ’hello ’ + ’world’
Print the accessible local variables: mininet> py locals()
Next, see the methods and properties available for a node, using the dir()
function: mininet> py dir(s1)
You can read the on-line documentation for methods available on a node
by using the help() function: mininet> py help(h1) (Press ”q” to quit reading the
documentation.)
You can also evaluate methods of variables:mininet> py h1.IP()
If you want to run some of the example python programs, you should only
change to the examples directory and issue the following command:

sudo python3 program.py

where ”program.py” is the name of the program we want to execute.

3.15 Link Up/Down


For fault tolerance testing, it can be helpful to bring links up and down.
To disable both halves of a virtual ethernet pair:, you can type
mininet> link s1 h1 down
You should see an OpenFlow Port Status Change notification get generated.
To bring the link back up:
mininet> link s1 h1 up

17
4 Network performance measurement with an heterogeneous
topology
As a joint exercise of all these previous examples, you should complete the following
exercise: Download the file named heterogeneous topology.py and start this topology
in mininet. This heterogeneous topology is illustrated in Figure 4, and the IP
address of each node is 10.0.0.x, where x is the node number, from 1 to 10. The
code for this program is shown below

Listing 1: Code for an heterogenous topology


from mininet . c l i import CLI
from mininet . n e t import M i n i n e t
from mininet . l i n k import TCLink
from mininet . t o p o import Topo
from mininet . l o g import s e t L o g L e v e l

c l a s s A s s i g n m e n t N e t w o r k s ( Topo ) :
def init ( s e l f , ** o p t s ) :
Topo . init ( s e l f , ** o p t s )
h1 = s e l f . a d d H o s t ( ’ h1 ’ )
h2 = s e l f . a d d H o s t ( ’ h2 ’ )
h3 = s e l f . a d d H o s t ( ’ h3 ’ )
h4 = s e l f . a d d H o s t ( ’ h4 ’ )
h5 = s e l f . a d d H o s t ( ’ h5 ’ )
h6 = s e l f . a d d H o s t ( ’ h6 ’ )
h7 = s e l f . a d d H o s t ( ’ h7 ’ )
h8 = s e l f . a d d H o s t ( ’ h8 ’ )
h9 = s e l f . a d d H o s t ( ’ h9 ’ )
h10 = s e l f . a d d H o s t ( ’ h10 ’ )
s1 = s e l f . addSwitch ( ’ s1 ’ )
s2 = s e l f . addSwitch ( ’ s2 ’ )
s3 = s e l f . addSwitch ( ’ s3 ’ )
s4 = s e l f . addSwitch ( ’ s4 ’ )
s5 = s e l f . addSwitch ( ’ s5 ’ )
s6 = s e l f . addSwitch ( ’ s6 ’ )

18
self . a d d L i n k ( h1 , s1 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h7 , s1 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h8 , s1 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h2 , s2 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h3 , s3 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h4 , s4 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h9 , s4 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h10 , s4 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h5 , s5 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( h6 , s6 , bw = 0 . 1 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( s1 , s2 , bw = 0 . 2 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( s2 , s3 , bw = 0 . 2 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( s3 , s4 , bw = 0 . 2 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( s2 , s5 , bw = 0 . 2 0 , d e l a y = ’ 5ms ’ )
self . a d d L i n k ( s3 , s6 , bw = 0 . 2 0 , d e l a y = ’ 5ms ’ )

if name == ’ m a i n ’ :
setLogLevel ( ’ info ’ )

# Create data network


topo = AssignmentNetworks ( )
n e t = M i n i n e t ( t o p o = t o p o , l i n k =TCLink , a u t o S e t M a c s = True ,
a u t o S t a t i c A r p =True )

# Run n e t w o r k
net . s t a r t ()
CLI ( n e t )
net . stop ()

Study carefully this program, taking into account the examples carried out in
the previous section. Then, answer the following questions:
Exercise 8 (0,5 points): Which RTT could you expect for a ping command
from host h4 to host h5?Why?
Answer:

19
Exercise 9 (0,5 points): Annotate the bandwidth assigned to each link, and
based on these data explain which links could become a bottleneck and under
which circumstances
Answer:

4.1 Latency for two different traffic patterns.


Next, we are going to study the effects that the traffic pattern can have on the
average network latencyfor a given topology. You should flood the network with
ICMP packets from all the nodes, using the command ping -f IP address from each
of the xterm in each node. You must carry out the flooding twice, but following
each time a different traffic pattern: the first time the nodes h1 and h7 will flood
h8, and h8 will flood h1; the nodes h2 and h5 wiill flood each other, and so will
do h3 and h6; finally, nodes h4 and h9 will flood h10, and h1 will try to flood h9.
In the second flooding, all the nodes should flood h10, and h10 should flood h9.
Exercise 10 (0,5 points): For each traffic pattern, after stopping the flooding
in each terminal (by typing CTRL+C), you should compute the average latency
value obtained for each node, and the average value for all the nodes. Compare
the results for both patterns and explain the results and where are the bottlenecks.

20
Answer:

After this exercise, you should type ”exit” in the mininet lxterminal to close all
the terminals and get out of the mininet application. In case any error has arisen,
you must use the clearing command to clear up the mininet topology: $ sudo
mn -c

4.2 Measuring Throughput with Iperf3


In order to analyze the network throughput, we will use the same topology with
different links bandwidth, and the iperf3 utility. Since the VM does not have
this utility installed, we should first install it. Open an LXTerminal and type the
commands:
sudo apt-get update -y

sudo apt-get install -y iperf3

Next, download the file named assign1 topo.py and edit this file using the
command gedit assign1 topo.py

Exercise 11 (0,5 points): Explain the differences between this network and
the previous network in the file heterogeneous topology.py.

21
Answer:

The iperf3 application is very similar to the iperf tool, except the tcp port
used. You should issue the command iperf3 -s in the host acting as server, and
the command iperf3 -c 10.0.0.x in the host acting as client. Remember that the
IP address of the host in this topology has the corresponding host number as the
last number x. Thus, for example host h5 has the IP address 10.0.0.5.
Exercise 12 (0,5 points): Start this topology in mininet and open an xterm in
each host. Run three iperf3 tests, one at a time, for the pairs h1-h9, h8-h10 and
h3-h4, where the first node in each of this pair is the client host and the second
one is the server. Explain if the results of the iperf tests are the ones expected and
why.
Answer:

Exercise 13 (1 point): Repeat exercise 11 but now simultaneously executing

22
the same three tests (try to issue the ping command from h1, h8 and h3 at the same
time). Explain the reasons for the differences in the results.
Answer:
.

Exercise 14 (1 point): Exit mininet and, using the gedit editor, change the
bandwidth of the s1-s2 link from 20 to 25 Mbits/s. Repeat exercise 11. Explain
the reasons for the differences in the results.
Answer:

23
5 Miniedit
Miniedit is a graphical tool for Mininet which allows to graphically create and
run network simulations. In this section, we will use MiniEdit to build a network,
configure network elements, save the topology, and run the simulation.
The MiniEdit script is located in Mininet’s examples folder. To run MiniEdit,
execute the command:
$ sudo /home/mininet/mininet/examples/miniedit.py
WARNING: The original python code for miniedit, ”miniedit.py” is ready for
python 2.7, but it does not save any topology nor python code if python3 is used.
So, in order to use miniedit in this lab session, students must download the file
named ”fixed miniedit.py” from Aula Virtual and overwrite the file ”miniedit.py”.
A graphical interface similar to the one shown in Figure 5 should appear.

Exercise 15 (0,5 points): Build and run with Miniedit the same network
topology used for Exercise 11. You must show the teacher the results for the
tests performed.
Answer:

24
6 Assessment of the lab session
The evaluation of this lab session will consist of two parts. The first one will
weight 30% of the mark and will be bases in the answers to the individual written
exam that will take place at the beginning of the session. The second part will
consist in the assessment of the report with the answers to the exercises in this
guide. This report must be uploaded to the corresponding task at Aula Virtual.

25

You might also like