Professional Documents
Culture Documents
mininet-demo-180625043021 (2)
mininet-demo-180625043021 (2)
1
INTRODUCTION TO MININET
Mininet
A network emulator which creates realistic virtual network
Runs real kernel, switch and application code on a single machine
Provides both Command Line Interface (CLI) and Application Programming Interface (API)
• CLI: interactive commanding
• API: automation
Abstraction
• Host: emulated as an OS level process
• Switch: emulated by using software-based switch
• E.g., Open vSwitch, SoftSwitch
2
INTRODUCTION TO MININET
Your SDN
Command-Line Interface
Scripting API
3
FLOW OF THE LAB
4
DOWNLOAD THE VIRTUAL MACHINE
5
SETUP THE VIRTUAL MACHINE
6
CHECK LINUX
7
LOGIN VM
8
LOGIN VM
9
VM NETWORK CONFIGURATION
10
VM NETWORK CONFIGURATION
11
VM NETWORK CONFIGURATION
One of the physical interfaces should have a 192 address and the
other a 10 address
We will access the virtual machine using a terminal program using the
192 address
If either of the eth Ethernet interfaces are missing, run this command
sudo dhclient ethx
Where the x in ethx is the number of the interface
12
SET UP NETWORK ACCESS
13
SET UP NETWORK ACCESS
14
SET UP NETWORK ACCESS
15
ACCESS VM VIA SSH
The tutorial VM is shipped without a desktop environment, to reduce its size. All
the exercises will be done through X forwarding, where programs display graphics
through an X server running on the host OS.
16
ALTERNATIVE: RUN A GUI IN THE VM CONSOLE
WINDOW
To not use X11 and log in to the VM console window - not via an ssh
session!
Install GUI
Login VM, and type:
$ sudo apt-get update && sudo apt-get install xinit lxde virtualbox-guest-dkms
17
MININET TUTORIAL
The default run of Mininet sudo mn will create a topology consisting of one controller (c0), one switc
h (s1) and two hosts (h1 and h2).
• Display nodes
mininet> nodes
• Display links
The switches generated with Mininet will
mininet> net
be just simple forwarding devices, without
• Dump information about all nodes any "brain" of their own (no control plane)
mininet> dump
• Exit Mininet:
mininet> exit
18
MININET TUTORIAL
To help you start up, here are the most important options for running Mininet:
--topo=TOPO represents the topology of the virtual network, where TOPO could
be:
minimal - this is the default topology with 1 switch and 2 hosts
single,X - a single switch with X hosts attached to it
linear,X - creates X switches connected in a linear/daisy-chain fashion, each switch with one
host attached
tree,X,Y - a tree topology with X depth, Y fanout
--switch=SWITCH creates different type of switches, such as:
ovsk - this is the default Open vSwitch that comes preinstalled in the VM
user - this is a switch running in software namespace (much slower)
19
MININET TUTORIAL
20
MORE COMMANDS
22
NETWORK TOPOLOGY
23
NETWORK TOPOLOGY
24
EXAMPLE
(h1)-----20ms-----(s1)-----20ms-----(h2)
Q: When you send a ping, you measure the roundtrip delay for
an ICMP packet to travel from one host to another. Assuming
our current deployment, what will be the reported roundtrip
delay?
25
EXAMPLE (CONT..)
A1: ~80 ms
Let’s test that assertion!
mininet> h1 ping -c 8 h2
26
SIMPLE EXERCISE
Do not confuse the dpctl with a controller (it's not the same thing) -
dpctl is just a management/monitoring utility!
27
EXERCISE (CONT..)
STEP 1: Start Mininet with a single switch (the default, Open vSwitch =
ovsk) and 3 hosts:
mininet@mininet-vm:~$ sudo mn --topo=single,3 --mac --switch=ovsk --
controller=remote
28
EXERCISE (CONT..)
29
EXERCISE (CONT..)
STEP 2: Open terminals for each host and run tcpdump on each:
Attention: for Windows/MAC users, make sure you installed & run Xming/XQuartz,
plus you enabled X-forwarding if you are using ssh session to the Mininet VM!
> xterm h1 h2 h3
In the xterms for h2 and h3, run tcpdump, a utility to print the packets seen by a
host:
# tcpdump -XX -n -i h2-eth0
and respectively:
# tcpdump -XX -n -i h3-eth0
In the xterm for h1, send a ping:
# ping -c1 10.0.0.2
30
EXERCISE (CONT..)
31
EXERCISE (CONT..)
Results:
ping will fail, because the switch does NOT know what to do with
such traffic (and remember, we don't run any controller)
32
CHECKING FLOW RULES
Checking the list of flows on the switch (with command dpctl dump-
flows) will show an empty list (again, nobody told the switch how to
deal with the traffic)
33
CHECKING FLOW RULES
34
ADDING FLOW RULES
35
FLOW RULES
36
FLOW RULES
Result:
ping is successful
tcpdump on host h2 shows the traffic from/to h1 (ARP and ICMP)
tcpdump on host h3 does not see anything (not even the ARP which
should be broadcast)!
37
ACTIVATE WIRESHARK
38
OBSERVE SDN TRAFFIC
39
LOAD THE CONTROLLER
40
LOAD THE CONTROLLER
41
LOAD THE CONTROLLER
42
OBSERVE SDN TRAFFIC
43
OBSERVE SDN TRAFFIC
44
MININET APPS
GUI - MiniEdit
Included in Mininet in the examples/ directory. miniedit.py
45
START MINIEDIT
Mininet needs to run with root privileges so start MiniEdit using the
sudo command.
46
MINIEDIT GUI
47
CREATE A CUSTOM NETWORK TOPOLOGY
48
CONFIGURE THE CONTROLLERS
49
CONFIGURE THE CONTROLLERS
50
SET MINIEDIT PREFERENCES
51
SET MINIEDIT PREFERENCES
52
SAVE THE CONFIGURATION
53
RUN THE MINIEDIT NETWORK SCENARIO
To start the simulation scenario, click the Run button on the MiniEdit
GUI
54
EXPERIMENT WITH THE NETWORK
55
CONT..
56
CONT..
57
RUN PROGRAMS TO GENERATE AND MONITOR
TRAFFIC
Open a xterm window on hosts h1 and h8. Right-click on each host in
the MiniEdit GUI and select Terminal from the menu that appears.
In the h1 xterm window, start a Wireshark with the command, wireshark &.
In the h8 xterm window, start a packet trace with the command tcpdump.
$ tcpdump –n –i h8-eth0
58
CONT..
59
SIMULATE A BROKEN LINK
Right-click on link. Choose Link Down from the menu that appears
60
CONT..
Ping again
no more traffic is received at host h8 and that the ping command shows packets
sent from host h1 are not being responded to
Restore the link by choosing Link Up
Check flow tables
$ sudo ovs-ofctl dump-flows s1
61
STOP THE SIMULATION
62
RUN A SAVED MININET CUSTOM TOPOLOGY
SCRIPT
$ cd ~/mininet/<filepath>
$ sudo chmod 777 <filename>.py
$ sudo ./<filename>.py
63
VISUAL NETWORK DESCRIPTION(VND)
64
CREATE A CUSTOM NETWORK TOPOLOGY
65
SAVE TOPOLOGY
66
CONT..
67
CONT..
68
RUN CONTROLLER
Using the l2_multi pox controller module to find the shortest path
from sender to receiver to send packets.
Run the l2_multi pox controller.
Use discovery module to construct the network topology.
When the topology is known, the l2_multi can use Floyd-Warshall
algorithm to find a shortest path.
Note l2_multi.py is under /pox/pox/forwarding and discovery.py is
under /pox/pox/openflow
69
RUN CONTROLLER
70
RUN SCRIPT
71
CONT..
Ping test
72
CONT..
73
CONT..
74
CONT..
Check the rules for s4 (we can see the rules for arp and ip operations
between 10.0.0.1 (h1) and 10.0.0.2(h2))
75
CONT..
76
RYU CONTROLLER
77
INSTALL RYU
78
SWITCHING HUB
79
SWITCHING HUB BY OPENFLOW
Initial status
80
SWITCHING HUB BY OPENFLOW
81
SWITCHING HUB BY OPENFLOW
82
SWITCHING HUB BY OPENFLOW
83
EXECUTION OF RYU APPLICATION
84
CONT..
85
CONT..
86
CONT..
87
EXECUTING THE SWITCHING HUB
88
CONT..
89
CONFIRMING OPERATION
90
PING TEST
91
CONT..
92
CONT..
93
DUMP FLOW RULES
94
CONT..
95
CONT..
96
REFRENCES
for more:http://www.brianlinkletter.com/how-to-use-miniedit-mininets-
graphical-user-interface/
https://github.com/ramonfontes/vnd-sdn-
version/blob/master/README.md
97
98