meetup#3 
Mininet 
shanyu@sdnds-tw
About me 
❖Shanyua.k.a.Leader31 
❖碩二研究生 
❖NCTU Wireless Internet Lab 
❖Logdown: http://shanyu.logdown.com 
❖Github: https://github.com/evelyn3648/MininetTopo
Outline 
❖Introduction to Mininet 
❖Mininetbasic operation 
❖MininetUse Scenario
Mininetversion 
❖Download: http://mininet.org/download/ 
❖Default version: 2.1.0 
❖Newest version: 2.2.0b1 
❖Improved OpenFlow1.3 support 
❖Mininet2.1.0 support OpenFlow1.3 
❖http://www.sdnlab.com/3460 
❖ovs-vsctlset bridge XX protocols=OpenFlow13 
❖Upgrade OVS 
❖http://www.sdnlab.com/3679 
Modify mininet/mininet/node.py
What Is Mininet? 
❖工欲善其事必先利其器 
❖Mininetis a network emulator 
❖“Mininetcreates a realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native)” –mininet.org 
❖Mininetuses lightweight virtualization to make a single system look like a complete network
Testbed 
Platform 
Advantages 
Disadvantages 
Hardware Testbed 
reality 
accurate: "ground truth" 
expensive 
shared resource? 
hard to reconfigure 
hard to change 
Simulator 
inexpensive, flexible 
detailed (or abstract!) 
virtual time (can be 
"faster" than reality) 
may require app changes 
might not run OS code 
may not be "believable" 
may be slow/non-interactive 
Emulator 
inexpensive, flexible 
real code 
reasonably accurate 
fast/interactive usage 
slower than hardware 
experiments may not fit 
possible inaccuracy from 
multiplexing
A simple network topology 
S1 
h1 
h2 
firefox 
httpd
Full System Virtualization
Lightweight Virtualization(Network Namespaces and Virtual Ethernet pairs) 
virtual Ethernet pairs 
Network namespace: logically another copy of the network stack, with its own routes, firewall rules, and network devices 
VirtualEthernetpairs:A vethpair is a pair of virtual interfaces that act as a 
straight through connection.
Lightweight Virtualization & Performance modeling withLinux 
Network component or 
property 
Modeling mechanism 
Configuration 
command(s) 
Hosts 
Processesin network 
namespaces 
ipnetns 
Links 
Virtual Ethernetpairs 
iplink 
Switches 
Software switches (OVS) 
ovs-vsctl 
Controllers 
Processes 
controller 
Link performance 
Traffic Control (Bandwidth,Delay,loss, max queue) 
tc 
CPU performance 
CPU Control Groups 
cg{create,set,delete, 
classify}
Create it with Linux command 
sudobash 
# Create host namespaces 
ipnetnsadd h1 
ipnetnsadd h2 
# Create switch 
ovs-vsctladd-brs1 
# Create links 
iplink add h1-eth0 type vethpeer name s1-eth1 
iplink add h2-eth0 type vethpeer name s1-eth2 
iplink show 
# Move host ports into namespaces 
iplink set h1-eth0 netnsh1 
iplink set h2-eth0 netnsh2 
ipnetnsexec h1 iplink show 
ipnetnsexec h2 iplink show 
# Connect switch ports to OVS 
ovs-vsctladd-port s1 s1-eth1 
ovs-vsctladd-port s1 s1-eth2 
ovs-vsctlshow 
# Set up OpenFlowcontroller 
ovs-vsctlset-controller s1 tcp:127.0.0.1 
ovs-controller ptcp: & 
ovs-vsctlshow 
# Configure network 
ipnetnsexec h1 ifconfigh1-eth0 10.0.0.1 
ipnetnsexec h1 ifconfiglo up 
ipnetnsexec h2 ifconfigh2-eth0 10.0.0.2 
ipnetnsexec h1 ifconfiglo up 
ifconfigs1-eth1 up 
ifconfigs1-eth2 up 
# Test network 
ipnetnsexec h1 ping -c1 10.0.0.2 
Controller 
S1 
h1 
h2 
將virtual interface/link 
綁訂到對應host的namespace 
建立veth連線和 
兩端的virualinterface
Mininetobject
Classes in MininetTopo 
mininet.topo.Topo 
mininet.topo.LinearTopo 
mininet.topo.SingleSwitchTopo 
mininet.topo.SingleSwitchReversedTopo 
mininet.topolib.TreeTopo 
mininet.topolib.TorusTopo 
linear,n: 每個switch (s1-s2-s3…-sn)上各 有一個host(h1,h2…,hn) 
single,k: 一台switch上面有k個host (h1…,hk) [default topology (h1-s1-h2)] 
reverse,k:一台switch上面有k個host (hk…,h1) 
tree,depth=d,fanout=f: 一顆深度為d,每 個node有f個child的tree 
2-D Torus topology: this topology has LOOPS 
Default 
NEW
Classes in MininetNode 
mininet.node 
.Node 
mininet.node 
.Controller 
mininet.node 
.Host 
mininet.node. 
Switch 
mininet.node 
.Nox 
mininet.node. 
OVSController 
mininet.node. 
RemoteController 
mininet.node. 
CPULimitedHost 
mininet.node. IVSSwitch 
mininet.node. 
OVSLegacyKernelSwitch 
mininet.node 
.OVSSwitch 
mininet.node. 
UserSwitch 
mininet.node. 
OVSBridge 
mininet.node 
.RYU 
mininet.node 
.NAT 
mininet.nodelib. LinuxBridge 
Default 
NEW
Classes in MininetLink 
mininet.link.Link 
mininet.link.Intf 
mininet.link 
.TCLink 
mininet.link 
.TCIntf 
Basicinterface object that can configure itself 
A basic link is just a vethpair
Mininetbasic operation
Mininetcommand line 
❖$sudomn 
連線到外部controller 
$sudomn–controller=remote,ip=<ip>,port=<port> 
Defaultip: 127.0.0.1 
Defaultport: 6633 (IANA define OpenFlowport:6653)
Mininetbasic Command 
❖顯示nodes (controllers, hosts, switches) 列表 
❖mininet> nodes 
❖顯示links 列表 
❖mininet> net 
❖顯示nodes 詳細資訊 
❖mininet> dump 
❖離開CLI 
❖mininet> exit 
❖mininet> <ctrl>+D 
❖清除Mininet 
❖sudomn–c
Virtual Switch / Datapath管理 
❖所有virtual switches 狀態 
❖mininet> dpctlshow 
❖所有switches 支援的OpenFlowversions 
❖mininet> dpctl–version 
❖註: OF1.0 = 0x01, OF1.3 = 0x04 
❖所有switches 上所有flow entries 
❖mininet> dpctldump-flows 
❖所有switches 上ports 的流量統計 
❖mininet> dpctldump-ports
Custom network topology 
❖Mininetscript withpython API 
❖Low-level API: Node and Links 
❖Mid-level API: Network Object 
❖High-level API: Topology templates 
❖sudomn–custom ./<XXX.py> --topo XXX 
❖api.mininet.org 
❖docs.mininet.org 
❖Introduction to Mininet 
❖Some examples in mininet/example 
Controller 
S1 
h1 
h2
Low-level API: Node and Links 
h1 = Host( 'h1' ) 
h2 = Host( 'h2' ) 
s1 = OVSSwitch( 's1', inNamespace=False ) 
c0 = Controller( 'c0', inNamespace=False ) 
Link( h1, s1 ) 
Link( h2, s1 ) 
h1.setIP( '10.1/8' ) 
h2.setIP( '10.2/8' ) 
c0.start() 
s1.start( [ c0 ] ) 
s1.stop() 
c0.stop() 
Controller 
S1 
h1 
h2
Mid-level API: Network object 
net = Mininet() 
h1 = net.addHost( 'h1' ) 
h2 = net.addHost( 'h2' ) 
s1 = net.addSwitch( 's1' ) 
c0 = net.addController( 'c0' ) 
net.addLink( h1, s1 ) 
net.addLink( h2, s1 ) 
net.start() 
CLI( net ) 
net.stop() 
Controller 
S1 
h1 
h2
High-level API: Topology templates 
class SingleSwitchTopo( Topo ): 
"Single switch connected to k hosts.“ 
defbuild( self, k=2, **opts ): 
"k: number of hosts" 
self.k= k 
switch = self.addSwitch( 's1' ) 
for h in irange( 1, k ): 
host = self.addHost( 'h%s' % h ) 
self.addLink( host, switch ) 
net = Mininet( topo=SingleSwitchTopo( 2 ) ) 
net.start() 
CLI( net ) 
net.stop() 
Controller 
S1 
h1 
h2
MininetUse Scenario
Mininethosts connect to internet 
❖Method1: create node (NAT) 
❖through hostOS 
❖Iptablescommand 
❖MASQUERADE, ip_forward 
❖Method2: via OVS command 
❖ovs-vsctladd-port s1 eth0 
❖Host OS also want to access internet 
❖http://rascov.logdown.com/posts/231057-bridge-mininet-to- the-internet
Mininetmulti hosts want to run same service 
❖Mininethosts share the same file system 
❖Problem: multi hosts can’t run same daemon (snmpd, httpd) at the same time 
❖service XXX start/restart/stop 
❖Web Server 
❖python -m SimpleHTTPServer80 & 
❖Snmp 
❖/usr/sbin/snmpd-LS n d -Lf /dev/null -p /var/run/snmpd.pid 
❖Problem: get same CPU usage form all hosts
Multisubnet 
❖S1beaRouter (gateway) 
❖Create a gateway host 
❖Modify routing table & ip_forwardon gateway host 
❖http://shanyu.logdown.com/posts/223708-mininet-with-multi-subnet 
❖Mininetadd linuxrouternode in upcoming version 
❖https://github.com/mininet/mininet/blob/65e33fed9b1d583a90c9dd09e6fd64e5354b377c/examples/linuxrouter.py 
❖Controller act ARP proxy (OpenDaylight) 
❖Using flow rule let switch be a gateway router 
❖http://hwchiu.logdown.com/posts/203260-mininet-and-network-subnet 
10.0.0.0 
/24 
10.1.0.0 
/24 
10.2.0.0 
/24 
S1
References 
❖Tutorial at SIGCOMM 2014 
❖https://github.com/mininet/mininet/wiki/Teaching-and- Learning-with-Mininet 
❖SDNLAB 
❖http://www.sdnlab.com/ 
❖Hwchiublog 
❖http://hwchiu.logdown.com/ 
❖Rascovblog 
❖http://rascov.logdown.com/
Thank you

More Related Content

PDF
Mininet Basics
PPTX
Mininet demo
PDF
Mininet introduction
PDF
OpenStack networking
PPTX
Open v switch20150410b
PDF
Mininet: Moving Forward
PDF
Virtualized network with openvswitch
PPTX
Docker Networking with New Ipvlan and Macvlan Drivers
Mininet Basics
Mininet demo
Mininet introduction
OpenStack networking
Open v switch20150410b
Mininet: Moving Forward
Virtualized network with openvswitch
Docker Networking with New Ipvlan and Macvlan Drivers

What's hot (20)

PDF
Open stack advanced_part
PPTX
The Basic Introduction of Open vSwitch
PDF
Understanding Open vSwitch
PDF
Pipework: Software-Defined Network for Containers and Docker
PPTX
ON.LAB Mininet
PPTX
Docker networking basics & coupling with Software Defined Networks
PPTX
Tutorial on using CoreOS Flannel for Docker networking
PDF
Openstack Networking Internals - first part
PPTX
Mininet multiple controller
PDF
debugging openstack neutron /w openvswitch
PPTX
Networking in Docker Containers
PPTX
OVN - Basics and deep dive
PDF
Sdnds tw-meetup-2
PDF
Open stack networking vlan, gre
PDF
Linux Networking Explained
PDF
How Networking works with Data Science
PDF
Docker network
PDF
Open VSwitch .. Use it for your day to day needs
PPTX
Docker networking tutorial 102
Open stack advanced_part
The Basic Introduction of Open vSwitch
Understanding Open vSwitch
Pipework: Software-Defined Network for Containers and Docker
ON.LAB Mininet
Docker networking basics & coupling with Software Defined Networks
Tutorial on using CoreOS Flannel for Docker networking
Openstack Networking Internals - first part
Mininet multiple controller
debugging openstack neutron /w openvswitch
Networking in Docker Containers
OVN - Basics and deep dive
Sdnds tw-meetup-2
Open stack networking vlan, gre
Linux Networking Explained
How Networking works with Data Science
Docker network
Open VSwitch .. Use it for your day to day needs
Docker networking tutorial 102
Ad

Viewers also liked (13)

PDF
Developing SDN apps in Ryu
PPTX
RYU Introduction
PPT
Ryu Learning Guide
PPTX
SDN ryu 專題安裝
PPTX
Mininet CE
PDF
Ryu SDN Framework
PPTX
2015 COSCUP SDN Workshop -- SDN Quick Start
PPTX
Mininet Learning Guide(Mininet 学习指南)
PDF
Ryu sdn framework
PPSX
PPTX
Sdn 之旅 open suse_asia_summit_20151206
PPTX
ONOS
PPT
OpenFlow tutorial
Developing SDN apps in Ryu
RYU Introduction
Ryu Learning Guide
SDN ryu 專題安裝
Mininet CE
Ryu SDN Framework
2015 COSCUP SDN Workshop -- SDN Quick Start
Mininet Learning Guide(Mininet 学习指南)
Ryu sdn framework
Sdn 之旅 open suse_asia_summit_20151206
ONOS
OpenFlow tutorial
Ad

Similar to SDNDS.TW Mininet (20)

PDF
PPTX
Virtual Networking (1) (1).pptx
PPTX
cn mininet----- power point presentation
PDF
mininet-intro.pdf
PDF
MininetasSDNPlatform.pdf
PPTX
Sdn command line controller lab
PPTX
Coscup SDN workshop - mininet
PDF
What is SDN and how to approach it with Python
PPTX
Training open stack networking -neutron
PPTX
Harmonia open iris_basic_v0.1
PPTX
Openstack openswitch basics
PDF
SDN Presentation
PDF
Open daylight and Openstack
PPTX
Meetup docker using software defined networks
PPT
Docker Multi Host Networking, Rachit Arora, IBM
PPTX
Thebasicintroductionofopenvswitch
PPTX
SDN Demystified, by Dean Pemberton [APNIC 38]
PDF
SDN and Mininet: Some Basic Concepts
DOCX
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
PPTX
Introduction to OpenStack.
Virtual Networking (1) (1).pptx
cn mininet----- power point presentation
mininet-intro.pdf
MininetasSDNPlatform.pdf
Sdn command line controller lab
Coscup SDN workshop - mininet
What is SDN and how to approach it with Python
Training open stack networking -neutron
Harmonia open iris_basic_v0.1
Openstack openswitch basics
SDN Presentation
Open daylight and Openstack
Meetup docker using software defined networks
Docker Multi Host Networking, Rachit Arora, IBM
Thebasicintroductionofopenvswitch
SDN Demystified, by Dean Pemberton [APNIC 38]
SDN and Mininet: Some Basic Concepts
CSC 451551 Computer Networks Fall 2016Project 4 Softwar.docx
Introduction to OpenStack.

Recently uploaded (20)

DOCX
Powerful Ways AIRCONNECT INFOSYSTEMS Pvt Ltd Enhances IT Infrastructure in In...
PDF
si manuel quezon at mga nagawa sa bansang pilipinas
PDF
Exploring The Internet Of Things(IOT).ppt
PDF
Uptota Investor Deck - Where Africa Meets Blockchain
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
PPTX
Top Website Bugs That Hurt User Experience – And How Expert Web Design Fixes
PDF
Buy Cash App Verified Accounts Instantly – Secure Crypto Deal.pdf
PPTX
Database Information System - Management Information System
PDF
Course Overview and Agenda cloud security
PDF
BIOCHEM CH2 OVERVIEW OF MICROBIOLOGY.pdf
PDF
SlidesGDGoCxRAIS about Google Dialogflow and NotebookLM.pdf
PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
PPTX
AI_Cyberattack_Solutions AI AI AI AI .pptx
PDF
Understand the Gitlab_presentation_task.pdf
PPTX
Introduction to cybersecurity and digital nettiquette
PPTX
IPCNA VIRTUAL CLASSES INTERMEDIATE 6 PROJECT.pptx
PPT
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
PDF
simpleintnettestmetiaerl for the simple testint
PDF
Lean-Manufacturing-Tools-Techniques-and-How-To-Use-Them.pdf
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
Powerful Ways AIRCONNECT INFOSYSTEMS Pvt Ltd Enhances IT Infrastructure in In...
si manuel quezon at mga nagawa sa bansang pilipinas
Exploring The Internet Of Things(IOT).ppt
Uptota Investor Deck - Where Africa Meets Blockchain
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
Top Website Bugs That Hurt User Experience – And How Expert Web Design Fixes
Buy Cash App Verified Accounts Instantly – Secure Crypto Deal.pdf
Database Information System - Management Information System
Course Overview and Agenda cloud security
BIOCHEM CH2 OVERVIEW OF MICROBIOLOGY.pdf
SlidesGDGoCxRAIS about Google Dialogflow and NotebookLM.pdf
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
AI_Cyberattack_Solutions AI AI AI AI .pptx
Understand the Gitlab_presentation_task.pdf
Introduction to cybersecurity and digital nettiquette
IPCNA VIRTUAL CLASSES INTERMEDIATE 6 PROJECT.pptx
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
simpleintnettestmetiaerl for the simple testint
Lean-Manufacturing-Tools-Techniques-and-How-To-Use-Them.pdf
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)

SDNDS.TW Mininet

  • 2. About me ❖Shanyua.k.a.Leader31 ❖碩二研究生 ❖NCTU Wireless Internet Lab ❖Logdown: http://shanyu.logdown.com ❖Github: https://github.com/evelyn3648/MininetTopo
  • 3. Outline ❖Introduction to Mininet ❖Mininetbasic operation ❖MininetUse Scenario
  • 4. Mininetversion ❖Download: http://mininet.org/download/ ❖Default version: 2.1.0 ❖Newest version: 2.2.0b1 ❖Improved OpenFlow1.3 support ❖Mininet2.1.0 support OpenFlow1.3 ❖http://www.sdnlab.com/3460 ❖ovs-vsctlset bridge XX protocols=OpenFlow13 ❖Upgrade OVS ❖http://www.sdnlab.com/3679 Modify mininet/mininet/node.py
  • 5. What Is Mininet? ❖工欲善其事必先利其器 ❖Mininetis a network emulator ❖“Mininetcreates a realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native)” –mininet.org ❖Mininetuses lightweight virtualization to make a single system look like a complete network
  • 6. Testbed Platform Advantages Disadvantages Hardware Testbed reality accurate: "ground truth" expensive shared resource? hard to reconfigure hard to change Simulator inexpensive, flexible detailed (or abstract!) virtual time (can be "faster" than reality) may require app changes might not run OS code may not be "believable" may be slow/non-interactive Emulator inexpensive, flexible real code reasonably accurate fast/interactive usage slower than hardware experiments may not fit possible inaccuracy from multiplexing
  • 7. A simple network topology S1 h1 h2 firefox httpd
  • 9. Lightweight Virtualization(Network Namespaces and Virtual Ethernet pairs) virtual Ethernet pairs Network namespace: logically another copy of the network stack, with its own routes, firewall rules, and network devices VirtualEthernetpairs:A vethpair is a pair of virtual interfaces that act as a straight through connection.
  • 10. Lightweight Virtualization & Performance modeling withLinux Network component or property Modeling mechanism Configuration command(s) Hosts Processesin network namespaces ipnetns Links Virtual Ethernetpairs iplink Switches Software switches (OVS) ovs-vsctl Controllers Processes controller Link performance Traffic Control (Bandwidth,Delay,loss, max queue) tc CPU performance CPU Control Groups cg{create,set,delete, classify}
  • 11. Create it with Linux command sudobash # Create host namespaces ipnetnsadd h1 ipnetnsadd h2 # Create switch ovs-vsctladd-brs1 # Create links iplink add h1-eth0 type vethpeer name s1-eth1 iplink add h2-eth0 type vethpeer name s1-eth2 iplink show # Move host ports into namespaces iplink set h1-eth0 netnsh1 iplink set h2-eth0 netnsh2 ipnetnsexec h1 iplink show ipnetnsexec h2 iplink show # Connect switch ports to OVS ovs-vsctladd-port s1 s1-eth1 ovs-vsctladd-port s1 s1-eth2 ovs-vsctlshow # Set up OpenFlowcontroller ovs-vsctlset-controller s1 tcp:127.0.0.1 ovs-controller ptcp: & ovs-vsctlshow # Configure network ipnetnsexec h1 ifconfigh1-eth0 10.0.0.1 ipnetnsexec h1 ifconfiglo up ipnetnsexec h2 ifconfigh2-eth0 10.0.0.2 ipnetnsexec h1 ifconfiglo up ifconfigs1-eth1 up ifconfigs1-eth2 up # Test network ipnetnsexec h1 ping -c1 10.0.0.2 Controller S1 h1 h2 將virtual interface/link 綁訂到對應host的namespace 建立veth連線和 兩端的virualinterface
  • 13. Classes in MininetTopo mininet.topo.Topo mininet.topo.LinearTopo mininet.topo.SingleSwitchTopo mininet.topo.SingleSwitchReversedTopo mininet.topolib.TreeTopo mininet.topolib.TorusTopo linear,n: 每個switch (s1-s2-s3…-sn)上各 有一個host(h1,h2…,hn) single,k: 一台switch上面有k個host (h1…,hk) [default topology (h1-s1-h2)] reverse,k:一台switch上面有k個host (hk…,h1) tree,depth=d,fanout=f: 一顆深度為d,每 個node有f個child的tree 2-D Torus topology: this topology has LOOPS Default NEW
  • 14. Classes in MininetNode mininet.node .Node mininet.node .Controller mininet.node .Host mininet.node. Switch mininet.node .Nox mininet.node. OVSController mininet.node. RemoteController mininet.node. CPULimitedHost mininet.node. IVSSwitch mininet.node. OVSLegacyKernelSwitch mininet.node .OVSSwitch mininet.node. UserSwitch mininet.node. OVSBridge mininet.node .RYU mininet.node .NAT mininet.nodelib. LinuxBridge Default NEW
  • 15. Classes in MininetLink mininet.link.Link mininet.link.Intf mininet.link .TCLink mininet.link .TCIntf Basicinterface object that can configure itself A basic link is just a vethpair
  • 17. Mininetcommand line ❖$sudomn 連線到外部controller $sudomn–controller=remote,ip=<ip>,port=<port> Defaultip: 127.0.0.1 Defaultport: 6633 (IANA define OpenFlowport:6653)
  • 18. Mininetbasic Command ❖顯示nodes (controllers, hosts, switches) 列表 ❖mininet> nodes ❖顯示links 列表 ❖mininet> net ❖顯示nodes 詳細資訊 ❖mininet> dump ❖離開CLI ❖mininet> exit ❖mininet> <ctrl>+D ❖清除Mininet ❖sudomn–c
  • 19. Virtual Switch / Datapath管理 ❖所有virtual switches 狀態 ❖mininet> dpctlshow ❖所有switches 支援的OpenFlowversions ❖mininet> dpctl–version ❖註: OF1.0 = 0x01, OF1.3 = 0x04 ❖所有switches 上所有flow entries ❖mininet> dpctldump-flows ❖所有switches 上ports 的流量統計 ❖mininet> dpctldump-ports
  • 20. Custom network topology ❖Mininetscript withpython API ❖Low-level API: Node and Links ❖Mid-level API: Network Object ❖High-level API: Topology templates ❖sudomn–custom ./<XXX.py> --topo XXX ❖api.mininet.org ❖docs.mininet.org ❖Introduction to Mininet ❖Some examples in mininet/example Controller S1 h1 h2
  • 21. Low-level API: Node and Links h1 = Host( 'h1' ) h2 = Host( 'h2' ) s1 = OVSSwitch( 's1', inNamespace=False ) c0 = Controller( 'c0', inNamespace=False ) Link( h1, s1 ) Link( h2, s1 ) h1.setIP( '10.1/8' ) h2.setIP( '10.2/8' ) c0.start() s1.start( [ c0 ] ) s1.stop() c0.stop() Controller S1 h1 h2
  • 22. Mid-level API: Network object net = Mininet() h1 = net.addHost( 'h1' ) h2 = net.addHost( 'h2' ) s1 = net.addSwitch( 's1' ) c0 = net.addController( 'c0' ) net.addLink( h1, s1 ) net.addLink( h2, s1 ) net.start() CLI( net ) net.stop() Controller S1 h1 h2
  • 23. High-level API: Topology templates class SingleSwitchTopo( Topo ): "Single switch connected to k hosts.“ defbuild( self, k=2, **opts ): "k: number of hosts" self.k= k switch = self.addSwitch( 's1' ) for h in irange( 1, k ): host = self.addHost( 'h%s' % h ) self.addLink( host, switch ) net = Mininet( topo=SingleSwitchTopo( 2 ) ) net.start() CLI( net ) net.stop() Controller S1 h1 h2
  • 25. Mininethosts connect to internet ❖Method1: create node (NAT) ❖through hostOS ❖Iptablescommand ❖MASQUERADE, ip_forward ❖Method2: via OVS command ❖ovs-vsctladd-port s1 eth0 ❖Host OS also want to access internet ❖http://rascov.logdown.com/posts/231057-bridge-mininet-to- the-internet
  • 26. Mininetmulti hosts want to run same service ❖Mininethosts share the same file system ❖Problem: multi hosts can’t run same daemon (snmpd, httpd) at the same time ❖service XXX start/restart/stop ❖Web Server ❖python -m SimpleHTTPServer80 & ❖Snmp ❖/usr/sbin/snmpd-LS n d -Lf /dev/null -p /var/run/snmpd.pid ❖Problem: get same CPU usage form all hosts
  • 27. Multisubnet ❖S1beaRouter (gateway) ❖Create a gateway host ❖Modify routing table & ip_forwardon gateway host ❖http://shanyu.logdown.com/posts/223708-mininet-with-multi-subnet ❖Mininetadd linuxrouternode in upcoming version ❖https://github.com/mininet/mininet/blob/65e33fed9b1d583a90c9dd09e6fd64e5354b377c/examples/linuxrouter.py ❖Controller act ARP proxy (OpenDaylight) ❖Using flow rule let switch be a gateway router ❖http://hwchiu.logdown.com/posts/203260-mininet-and-network-subnet 10.0.0.0 /24 10.1.0.0 /24 10.2.0.0 /24 S1
  • 28. References ❖Tutorial at SIGCOMM 2014 ❖https://github.com/mininet/mininet/wiki/Teaching-and- Learning-with-Mininet ❖SDNLAB ❖http://www.sdnlab.com/ ❖Hwchiublog ❖http://hwchiu.logdown.com/ ❖Rascovblog ❖http://rascov.logdown.com/