mininet basics

61
1 / 61 EL-5244 Mininet Basics Eueung Mulyana https://telematika.org/remark/mininet CodeLabs | Attribution-ShareAlike CC BY-SA

Upload: eueung-mulyana

Post on 22-Jan-2018

85 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Mininet Basics

1 / 61

EL-5244

Mininet BasicsEueung Mulyanahttps://telematika.org/remark/mininetCodeLabs | Attribution-ShareAlike CC BY-SA

Page 2: Mininet Basics

Outline

Introduction

Getting Started

MiniNAM

OpenFlow Tutorial

POX Controller

2 / 61

Page 3: Mininet Basics

Mininet 2.2.2 on Ubuntu 14.04 LTS - 64 bit, o�cial VM | POX 0.2.0(carp) | OVS (Open vSwitch) 2.0.2

VirtualBox 5.2.6 on Ubuntu Xenial 16.04.3. Ref: [Mininet VM Images]

3 / 61

Page 4: Mininet Basics

Introduction

4 / 61

Page 5: Mininet Basics

Mininet provides a virtual test bed and development environment for SDN 5 / 61

Page 6: Mininet Basics

6 / 61

Mininet enablesRapid prototyping of software-de�ned networksComplex topology testing without the need towire up a physical networkMultiple concurrent developers to workindependently on the same topology

Page 7: Mininet Basics

7 / 61

Mininet networks run real code includingstandard Unix/Linux network applications as well

as the real Linux kernel and network stack.

Mininet provides an extensible Python API fornetwork creation and experimentations.

Ref: MININET - Open Networking Foundation

Page 8: Mininet Basics

Getting Started

8 / 61

Page 9: Mininet Basics

9 / 61

Mininet

SetupUsing Pre-Made VM

Download a Mininet VM ImageImport the Image (eg. into VirtualBox)Con�gure Access (eg. port forwarding or host-onlynetworking)Run the VMAccess via SSH with Remote Display Forwarding Enabled

Note: in the o�cial Mininet VM image version 2.2.2, there is possibly a con�guration bugif you're using VirtualBox. See comments by isams1 in this thread. So don't use host-onlynetworking to access the VM.

Page 10: Mininet Basics

Import Appliance10 / 61

Page 11: Mininet Basics

Import Appliance11 / 61

Page 12: Mininet Basics

Con�gure Access

12 / 61

Page 13: Mininet Basics

Con�gure Access - Port Forwarding

13 / 61

Page 14: Mininet Basics

Con�gure Access - Port Forwarding

14 / 61

Page 15: Mininet Basics

Run the VM15 / 61

Page 16: Mininet Basics

Access via SSH16 / 61

Page 17: Mininet Basics

Test17 / 61

Page 18: Mininet Basics

Test - Wireshark18 / 61

Page 19: Mininet Basics

19 / 61

Check

$ ssh -Y -l mininet -p 2222 localhost

mininet@mininet-vm:~$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.orimininet@mininet-vm:~$ sudo sed -i 's/http:\/\/us.archive.ubuntu.com\/ubuntu\//http:\/\/kambing.u

mininet@mininet-vm:~$ sudo apt-get updatemininet@mininet-vm:~$ sudo apt-get install tree

mininet@mininet-vm:~$ tree -L 1.|-- install-mininet-vm.sh|-- loxigen|-- mininet|-- oflops|-- oftest|-- openflow|-- pox

Page 20: Mininet Basics

20 / 61

Check

mininet@mininet-vm:~/mininet$ tree -L 2 -d.|-- bin|-- build| |-- bdist.linux-x86_64| |-- lib.linux-x86_64-2.7| |-- scripts-2.7|-- custom|-- debian| |-- source|-- dist|-- doc|-- examples| |-- test|-- mininet| |-- examples -> ../examples| |-- test|-- mininet.egg-info|-- util |-- kbuild |-- nox-patches |-- openflow-patches |-- sch_htb-ofbuf |-- vm

Page 21: Mininet Basics

mininet@mininet-vm:~/mininet/examples$ lltotal 364drwxrwxr-x 3 mininet mininet 4096 Mar 21 2017 ./drwxrwxr-x 13 mininet mininet 4096 Mar 21 2017 ../-rw-rw-r-- 1 mininet mininet 4965 Mar 21 2017 README.md-rw-rw-r-- 1 mininet mininet 48 Mar 21 2017 __init__.py-rwxrwxr-x 1 mininet mininet 1074 Mar 21 2017 baresshd.py*-rwxrwxr-x 1 mininet mininet 2310 Mar 21 2017 bind.py*-rwxrwxr-x 1 mininet mininet 33427 Mar 21 2017 cluster.py*-rwxrwxr-x 1 mininet mininet 501 Mar 21 2017 clusterSanity.py*-rw-rw-r-- 1 mininet mininet 3875 Mar 21 2017 clustercli.py-rwxrwxr-x 1 mininet mininet 639 Mar 21 2017 clusterdemo.py*-rwxrwxr-x 1 mininet mininet 15612 Mar 21 2017 consoles.py*-rwxrwxr-x 1 mininet mininet 1061 Mar 21 2017 controllers.py*-rwxrwxr-x 1 mininet mininet 1612 Mar 21 2017 controllers2.py*-rwxrwxr-x 1 mininet mininet 4967 Mar 21 2017 controlnet.py*-rwxrwxr-x 1 mininet mininet 3725 Mar 21 2017 cpu.py*-rwxrwxr-x 1 mininet mininet 960 Mar 21 2017 emptynet.py*-rwxrwxr-x 1 mininet mininet 1549 Mar 21 2017 hwintf.py*-rwxrwxr-x 1 mininet mininet 1320 Mar 21 2017 intfoptions.py*-rwxrwxr-x 1 mininet mininet 2034 Mar 21 2017 limit.py*-rwxrwxr-x 1 mininet mininet 4062 Mar 21 2017 linearbandwidth.py*-rwxrwxr-x 1 mininet mininet 2826 Mar 21 2017 linuxrouter.py*-rwxrwxr-x 1 mininet mininet 154479 Mar 21 2017 miniedit.py*-rwxrwxr-x 1 mininet mininet 4198 Mar 21 2017 mobility.py*-rwxrwxr-x 1 mininet mininet 834 Mar 21 2017 multilink.py*-rwxrwxr-x 1 mininet mininet 2235 Mar 21 2017 multiping.py*-rwxrwxr-x 1 mininet mininet 2469 Mar 21 2017 multipoll.py*-rwxrwxr-x 1 mininet mininet 1049 Mar 21 2017 multitest.py*-rwxrwxr-x 1 mininet mininet 550 Mar 21 2017 nat.py*-rwxrwxr-x 1 mininet mininet 1948 Mar 21 2017 natnet.py*-rwxrwxr-x 1 mininet mininet 2330 Mar 21 2017 numberedports.py*-rwxrwxr-x 1 mininet mininet 1023 Mar 21 2017 popen.py*-rwxrwxr-x 1 mininet mininet 932 Mar 21 2017 popenpoll.py*-rwxrwxr-x 1 mininet mininet 2032 Mar 21 2017 scratchnet.py*-rwxrwxr-x 1 mininet mininet 2455 Mar 21 2017 scratchnetuser.py*-rwxrwxr-x 1 mininet mininet 1888 Mar 21 2017 simpleperf.py*-rwxrwxr-x 1 mininet mininet 3040 Mar 21 2017 sshd.py*drwxrwxr-x 2 mininet mininet 4096 Mar 21 2017 test/-rwxrwxr-x 1 mininet mininet 522 Mar 21 2017 tree1024.py*-rwxrwxr-x 1 mininet mininet 950 Mar 21 2017 treeping64.py*-rwxrwxr-x 1 mininet mininet 3679 Mar 21 2017 vlanhost.py* 21 / 61

Check

Page 22: Mininet Basics

22 / 61

NotesMininet

Walkthrough

$ sudo mn [--topo=minimal]$ sudo mn --test pingpair$ sudo mn --test iperf$ sudo mn --link tc,bw=10,delay=10ms$ sudo mn --test pingall --topo single,3$ sudo mn --test pingall --topo mytopo --custom ~/mininet/custom/topo-2sw-2host.py $ sudo mn --mac

mininet> h1 ping -c10 h2mininet> pingallmininet> h1 python -m SimpleHTTPServer 80 &mininet> h2 wget -O - h1mininet> iperfmininet> link s1 h1 downmininet> link s1 h1 up

$ sudo ~/mininet/examples/sshd.py

Ref: Mininet Walkthrough - Mininet

Page 23: Mininet Basics

23 / 61

NotesMininet Sample

Work�ow

# Creating a Network$ sudo mn --switch ovs --controller ref --topo tree,depth=2,fanout=8 --test pingall

# Interacting with a Networkmininet> h2 ping h3mininet> h2 python -m SimpleHTTPServer 80 >& /tmp/http.log &mininet> h3 wget -O - h2

# Customizing a Networkfrom mininet.net import Mininetfrom mininet.topolib import TreeTopotree4 = TreeTopo(depth=2,fanout=2)net = Mininet(topo=tree4)net.start()h1, h4 = net.hosts[0], net.hosts[3]print h1.cmd('ping -c1 %s' % h4.IP())net.stop()

Ref: Mininet Sample Work�ow - Mininet

Page 24: Mininet Basics

MiniNAM

24 / 61

Page 25: Mininet Basics

25 / 61

MiniNAMA utility that provides real-time animation of any networkcreated by the Mininet emulator.MiniNAM includes all the components required to initiate,visualize and modify Mininet network �ows in real-time.MiniNAM provides a graphical user interface that allowsdynamic modi�cation of preferences and packet �lters: auser can view selective �ows with options to color codepackets based on packet type and/or nodes (hosts).

Ref: MiniNAM | University College Cork

Page 26: Mininet Basics

26 / 61

Setup

$ ssh -Y -l mininet -p 2222 localhost

$ sudo apt-get install git python-imaging python-imaging-tk

$ git clone https://github.com/uccmisl/MiniNAM.gitmininet@mininet-vm:~/MiniNAM$ tree.|-- conf.config|-- Examples| |-- LoadBalancer| | |-- install.sh| | |-- MiniNAM.py| | |-- paping| | |-- README.md| |-- NAT| | |-- badNAT.py| | |-- conf.config| | |-- goodNAT.py| | |-- MiniNAM.py| | |-- README.md| |-- Routing| |-- MiniNAM.py| |-- README.md| |-- simple_switch_13.py| |-- simple_switch_stp_13.py| |-- spanning_tree.py|-- LICENSE|-- MiniNAM.py|-- README.md

mininet@mininet-vm:~/MiniNAM$ sudo python MiniNAM.py

Page 27: Mininet Basics

MiniNAM | h1 ping -c2 h227 / 61

Page 28: Mininet Basics

OpenFlow Tutorial

28 / 61

Page 29: Mininet Basics

sudo mn --topo single,3 --mac --switch ovsk --controller remote 29 / 61

Page 30: Mininet Basics

sudo python ~/MiniNAM/MiniNAM.py ... | controller & wireshark issues 30 / 61

Page 31: Mininet Basics

31 / 61

Manual FlowEntry

mininet@mininet-vm:~$ sudo ovs-ofctl dump-flows s1NXST_FLOW reply (xid=0x4):

mininet> h1 ping -c3 h2PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.From 10.0.0.1 icmp_seq=1 Destination Host Unreachable...mininet@mininet-vm:~$ sudo ovs-ofctl add-flow s1 in_port=1,actions=output:2mininet@mininet-vm:~$ sudo ovs-ofctl add-flow s1 in_port=2,actions=output:1mininet@mininet-vm:~$ sudo ovs-ofctl dump-flows s1NXST_FLOW reply (xid=0x4): cookie=0x0, duration=25.666s, table=0, n_packets=0, n_bytes=0, idle_age=25, in_port=1 actions=o cookie=0x0, duration=11.374s, table=0, n_packets=0, n_bytes=0, idle_age=11, in_port=2 actions=o

mininet> h1 ping -c3 h2PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.979 ms...3 packets transmitted, 3 received, 0% packet loss, time 2003msrtt min/avg/max/mdev = 0.099/0.402/0.979/0.408 ms

Page 32: Mininet Basics

sudo wireshark & 32 / 61

Page 33: Mininet Basics

Capture Interfaces - Loopback 33 / 61

Page 34: Mininet Basics

34 / 61

StartingControllerOF Reference

Controller

$ controller ptcp: &

# Issue: controller must first be run, before mininet# Could be an issue related with the image

$ controller ptcp: &$ sudo mn --topo single,3 --mac --switch ovsk --controller remote

# clean up arpmininet> h1 ip -s -s neigh flush allmininet> h2 ip -s -s neigh flush all

# in case, there's still flow entriesmininet@mininet-vm:~$ sudo ovs-ofctl del-flows s1

mininet> h1 ping -c1 h2

Page 35: Mininet Basics

Filter - of 35 / 61

Page 36: Mininet Basics

Inspect Packet 36 / 61

Page 37: Mininet Basics

Inspect Packet 37 / 61

Page 38: Mininet Basics

of and not (of10.echo_request.type or of10.echo_reply.type) 38 / 61

Page 39: Mininet Basics

OF Packets Captured After : h1 ping -c1 h2 39 / 61

Page 40: Mininet Basics

40 / 61

h1 ping -c1 h2

Page 41: Mininet Basics

41 / 61

Flow Entriesmininet> dpctl dump-flowsmininet@mininet-vm:~$ sudo ovs-ofctl dump-flows s1NXST_FLOW reply (xid=0x4): cookie=0x0, duration=25.373s, table=0, n_packets=1, n_bytes=42, idle_timeout=60, idle_age=25, p cookie=0x0, duration=30.373s, table=0, n_packets=1, n_bytes=42, idle_timeout=60, idle_age=30, p cookie=0x0, duration=25.374s, table=0, n_packets=1, n_bytes=42, idle_timeout=60, idle_age=25, p cookie=0x0, duration=30.371s, table=0, n_packets=1, n_bytes=98, idle_timeout=60, idle_age=30, p cookie=0x0, duration=30.37s, table=0, n_packets=1, n_bytes=98, idle_timeout=60, idle_age=30, prmininet@mininet-vm:~$ sudo ovs-ofctl dump-flows s1NXST_FLOW reply (xid=0x4):

Page 42: Mininet Basics

42 / 61

Benchmarkkernel- vs. user-

space

mininet> iperf+++ Iperf: testing TCP bandwidth between h1 and h3+++ Results: ['27.5 Gbits/sec', '27.6 Gbits/sec']mininet> exit

mininet@mininet-vm:~$ sudo mn --topo single,3 --controller remote --switch usermininet> iperf+++ Iperf: testing TCP bandwidth between h1 and h3+++ Results: ['658 Mbits/sec', '659 Mbits/sec']

# Notes user-space:mininet> sh ovs-ofctl dump-flows s1ovs-ofctl: s1 is not a bridge or a socket

Page 43: Mininet Basics

NotesMy personal notes with previous versions of Mininet. Some are not tested yet with the current

version.

43 / 61

Page 44: Mininet Basics

44 / 61

Notesmininet> xterm h1 h2 h3h1# tcpdump -ne -i h1-eth0

mininet>1 h1 ping -c1 h2mininet>1 h1 arp -na

# deprecated??$ sudo ovs-controller --verbose ptcp:& #$ sudo controller ptcp:& #$ sudo ovs-controller --hub ptcp:& # --noflow --normal --verbose$ sudo ovs-controller --hub --verbose ptcp:&$ sudo ovs-controller --noflow --verbose ptcp:&

Page 45: Mininet Basics

45 / 61

Notes

# IP-Source-Address-Based Rule --> may need Reset$ sudo ovs-ofctl del-flows s1$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,dl_type=0x0800,nw_src=10.0.0.1,acti$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,dl_type=0x0800,nw_src=10.0.0.2,acti

# IP-Dest-Address-Based Rule --> may need Reset$ sudo ovs-ofctl del-flows s1$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,ip,nw_dst=10.0.0.3,actions=output:3$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,ip,nw_dst=10.0.0.2,actions=output:2$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,ip,nw_dst=10.0.0.1,actions=output:1$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,arp,actions=NORMAL

# Alternatives$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,dl_type=0x0806,actions=FLOOD$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,dl_type=0x0806,actions=ALL$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,dl_type=0x0800,nw_proto=1,actions=N$ sudo ovs-ofctl add-flow s1 idle_timeout=600,priority=33001,icmp,nw_dst=10.0.0.2,actions=output# NORMAL sends packet to non-openflow function of switch - not all switch# sudo ovs-ofctl del-flows s1 in_port=1# sudo ovs-ofctl del-flows s1 dl_type=0x0800

Page 46: Mininet Basics

46 / 61

Notes

Page 47: Mininet Basics

47 / 61

Notes

Page 48: Mininet Basics

POX Controller

48 / 61

Page 49: Mininet Basics

49 / 61

POX Controller

POX is a Python-based SDN controllerplatform geared towards research andeducation.POX provides a framework forcommunicating with SDN switches usingeither the OpenFlow or OVSDB protocol.Developers can use POX to create an SDNcontroller using the Python programminglanguage. Ref: [brianlinkletter ]

Page 50: Mininet Basics

50 / 61

POX ControllerFiles

mininet@mininet-vm:~/pox/pox/misc$ lltotal 76drwxrwxr-x 3 mininet mininet 4096 Mar 21 2017 ./drwxrwxr-x 15 mininet mininet 4096 Mar 21 2017 ../-rw-rw-r-- 1 mininet mininet 689 Mar 21 2017 __init__.py-rw-rw-r-- 1 mininet mininet 1240 Mar 21 2017 cbench.py-rw-rw-r-- 1 mininet mininet 1079 Mar 21 2017 full_payload.py-rw-rw-r-- 1 mininet mininet 5214 Mar 21 2017 gephi_topo.py-rw-rw-r-- 1 mininet mininet 10251 Mar 21 2017 ip_loadbalancer.py-rw-rw-r-- 1 mininet mininet 3794 Mar 21 2017 mac_blocker.py-rw-rw-r-- 1 mininet mininet 14375 Mar 21 2017 nat.py-rw-rw-r-- 1 mininet mininet 4582 Mar 21 2017 of_tutorial.py-rw-rw-r-- 1 mininet mininet 2096 Mar 21 2017 pidfile.pydrwxrwxr-x 2 mininet mininet 4096 Mar 21 2017 telnetd/

mininet@mininet-vm:~/pox/pox/forwarding$ lltotal 96drwxrwxr-x 2 mininet mininet 4096 Mar 21 2017 ./drwxrwxr-x 15 mininet mininet 4096 Mar 21 2017 ../-rw-rw-r-- 1 mininet mininet 651 Mar 21 2017 __init__.py-rw-rw-r-- 1 mininet mininet 1092 Mar 21 2017 hub.py-rw-rw-r-- 1 mininet mininet 4426 Mar 21 2017 l2_flowvisor.py-rw-rw-r-- 1 mininet mininet 6692 Mar 21 2017 l2_learning.py-rw-rw-r-- 1 mininet mininet 15558 Mar 21 2017 l2_multi.py-rw-rw-r-- 1 mininet mininet 4324 Mar 21 2017 l2_nx.py-rw-rw-r-- 1 mininet mininet 2105 Mar 21 2017 l2_nx_self_learning.py-rw-rw-r-- 1 mininet mininet 2882 Mar 21 2017 l2_pairs.py-rw-rw-r-- 1 mininet mininet 12330 Mar 21 2017 l3_learning.py-rw-rw-r-- 1 mininet mininet 14102 Mar 21 2017 topo_proactive.py

Page 51: Mininet Basics

from pox.core import coreimport pox.openflow.libopenflow_01 as of

log = core.getLogger()

#============class Tutorial (object): #------------------------------- def __init__ (self, connection): self.connection = connection connection.addListeners(self) self.mac_to_port = {} #------------------------------- def resend_packet (self, packet_in, out_port): msg = of.ofp_packet_out() msg.data = packet_in

action = of.ofp_action_output(port = out_port) msg.actions.append(action)

self.connection.send(msg) #------------------------------- def act_like_hub (self, packet, packet_in): self.resend_packet(packet_in, of.OFPP_ALL) #------------------------------- def act_like_switch (self, packet, packet_in): #------------------------------- def _handle_PacketIn (self, event): packet = event.parsed # This is the parsed packet data. if not packet.parsed: log.warning("Ignoring incomplete packet") return

packet_in = event.ofp # The actual ofp_packet_in message.

self.act_like_hub(packet, packet_in) #self.act_like_switch(packet, packet_in)#============def launch (): def start_switch (event): log.debug("Controlling %s" % (event.connection,)) Tutorial(event.connection) core.openflow.addListenerByName("ConnectionUp", start_switch) 51 / 61

of_tutorial.py

Page 52: Mininet Basics

52 / 61

POX ControllerHub Behavior

mininet@mininet-vm:~/pox$ ./pox.py log.level --DEBUG misc.of_tutorialPOX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al.DEBUG:core:POX 0.2.0 (carp) going up...DEBUG:core:Running on CPython (2.7.6/Oct 26 2016 20:30:19)DEBUG:core:Platform is Linux-4.2.0-27-generic-x86_64-with-Ubuntu-14.04-trustyINFO:core:POX 0.2.0 (carp) is up.DEBUG:openflow.of_01:Listening on 0.0.0.0:6633INFO:openflow.of_01:[None 1] closedINFO:openflow.of_01:[00-00-00-00-00-01 2] connectedDEBUG:misc.of_tutorial:Controlling [00-00-00-00-00-01 2]

$ sudo mn --topo single,3 --mac --switch ovsk --controller remote

mininet> xterm h1 h2 h3h1# tcpdump -XX -n -i h1-eth0 > h1.txt &h2# tcpdump -XX -n -i h2-eth0 > h2.txth3# tcpdump -XX -n -i h3-eth0 > h3.txt

h1# ping -c1 10.0.0.2

Page 53: Mininet Basics

53 / 61

POX ControllerHub Behavior

mininet@mininet-vm:~$ cat h1.txt16:33:33.273970 ARP, Request who-has 10.0.0.2 tell 10.0.0.1, length 2816:33:33.305723 ARP, Reply 10.0.0.2 is-at 00:00:00:00:00:02, length 2816:33:33.305730 IP 10.0.0.1 > 10.0.0.2: ICMP echo request, id 4108, seq 1, length 6416:33:33.306899 IP 10.0.0.2 > 10.0.0.1: ICMP echo reply, id 4108, seq 1, length 6416:33:38.356385 ARP, Request who-has 10.0.0.1 tell 10.0.0.2, length 2816:33:38.356425 ARP, Reply 10.0.0.1 is-at 00:00:00:00:00:01, length 28

mininet@mininet-vm:~$ cat h2.txt16:33:33.305056 ARP, Request who-has 10.0.0.2 tell 10.0.0.1, length 2816:33:33.305079 ARP, Reply 10.0.0.2 is-at 00:00:00:00:00:02, length 2816:33:33.306329 IP 10.0.0.1 > 10.0.0.2: ICMP echo request, id 4108, seq 1, length 6416:33:33.306344 IP 10.0.0.2 > 10.0.0.1: ICMP echo reply, id 4108, seq 1, length 6416:33:38.317451 ARP, Request who-has 10.0.0.1 tell 10.0.0.2, length 2816:33:38.359253 ARP, Reply 10.0.0.1 is-at 00:00:00:00:00:01, length 28

mininet@mininet-vm:~$ cat h3.txt16:33:33.305054 ARP, Request who-has 10.0.0.2 tell 10.0.0.1, length 2816:33:33.305722 ARP, Reply 10.0.0.2 is-at 00:00:00:00:00:02, length 2816:33:33.306328 IP 10.0.0.1 > 10.0.0.2: ICMP echo request, id 4108, seq 1, length 6416:33:33.306898 IP 10.0.0.2 > 10.0.0.1: ICMP echo reply, id 4108, seq 1, length 6416:33:38.356378 ARP, Request who-has 10.0.0.1 tell 10.0.0.2, length 2816:33:38.359247 ARP, Reply 10.0.0.1 is-at 00:00:00:00:00:01, length 28

Page 54: Mininet Basics

54 / 61

POX ControllerHub Behavior

h1# ping -c1 10.0.0.5

mininet@mininet-vm:~$ cat h1.txt16:45:33.285777 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 2816:45:34.285666 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 2816:45:35.285632 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 28

mininet@mininet-vm:~$ cat h3.txt16:45:33.335877 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 2816:45:34.310252 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 2816:45:35.287537 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 28

mininet@mininet-vm:~$ cat h2.txt16:45:33.335881 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 2816:45:34.310257 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 2816:45:35.287542 ARP, Request who-has 10.0.0.5 tell 10.0.0.1, length 28

Page 55: Mininet Basics

Packets Captured After : h1 ping -c1 10.0.0.2 55 / 61

Page 56: Mininet Basics

Packets Captured After : h1 ping -c1 10.0.0.5 56 / 61

Page 57: Mininet Basics

57 / 61

POX ControllerHub Behavior

mininet> sh ovs-ofctl dump-flows s1NXST_FLOW reply (xid=0x4):

mininet> pingpairh1 -> h2h2 -> h1+++ Results: 0% dropped (2/2 received)

mininet> pingall+++ Ping: testing ping reachabilityh1 -> h2 h3h2 -> h1 h3h3 -> h1 h2+++ Results: 0% dropped (6/6 received)

mininet> iperf+++ Iperf: testing TCP bandwidth between h1 and h3+++ Results: ['19.0 Mbits/sec', '20.3 Mbits/sec']

mininet@mininet-vm:~$ sudo python MiniNAM/MiniNAM.py --topo single,3 --mac --switch ovsk --contr

Page 58: Mininet Basics

def act_like_switch (self, packet, packet_in): self.mac_to_port[packet.src] = packet_in.in_port if packet.dst in self.mac_to_port: print("Packet sent to Control Plane")

self.resend_packet(packet_in, self.mac_to_port[packet.dst])

# log.debug("Installing flow...") msg = of.ofp_flow_mod() msg.match.dl_dst = packet.dst # msg.match = of.ofp_match.from_packet(packet)

msg.actions.append(of.ofp_action_output(port=self.mac_to_port[packet.dst])) self.connection.send(msg) else: self.resend_packet(packet_in, of.OFPP_ALL)

58 / 61

of_tutorial.py

Page 59: Mininet Basics

Refs/Resources

59 / 61

Page 60: Mininet Basics

Refs/Resources1. Learn Development Tools - mininet/open�ow-tutorial Wiki2. Create a Learning Switch - mininet/open�ow-tutorial Wiki3. MININET - Open Networking Foundation4. MiniNAM | University College Cork5. uccmisl/MiniNAM: A Network Animator for Visualizing Real-Time Packet Flows in Mininet6. FAQ - mininet/mininet Wiki7. Learn Development Tools - mininet/open�ow-tutorial Wiki8. Create a Learning Switch - mininet/open�ow-tutorial Wiki

60 / 61

Page 61: Mininet Basics

61 / 61

ENDEueung Mulyanahttps://telematika.org/remark/mininetCodeLabs | Attribution-ShareAlike CC BY-SA