Software Defined Network (SDN) experiment using Mininet and POX Controller



Similar documents
Programming Assignment 2: Using Mininet and Mininet Python API: Instructions

Exercise 1. Contents. 1. Introduction. (a) Installing the required software

Teaching Computer Networking with Mininet

Lab 8 (IP Load Balancer)

Tutorial. Reference for more thorough Mininet walkthrough if desired

Securing Local Area Network with OpenFlow

Lab 7: Software Defined Networking

Getting to know OpenFlow. Nick Rutherford Mariano Vallés

A Network in a Laptop: Rapid Prototyping for So7ware- Defined Networks

OpenFlow based dynamic load balanced switching

Software Defined Networking

GUI Tool for Network Designing Using SDN

Using OpenFlow 1.3 RYU. SDN Framework. RYU project team


Network Programmability Using POX Controller

1000Mbps Ethernet Performance Test Report

TCP Labs. WACREN Network Monitoring and Measurement Workshop Antoine Delvaux perfsonar developer

OpenFlow: Load Balancing in enterprise networks using Floodlight Controller

I. ADDITIONAL EVALUATION RESULTS. A. Environment

On real-time delay monitoring in software-defined networks

GENI Laboratory Exercises for a Cloud Computing course

Benchmarking the SDN controller!

MuL SDN Controller HOWTO for pre-packaged VM

WHITE PAPER. SDN Controller Testing: Part 1

SDN_CDN Documentation

Emulation of Software Defined Networks Using Mininet in Different Simulation Environments

Comparisons of SDN OpenFlow Controllers over EstiNet: Ryu vs. NOX

Project 4: SDNs Due: 11:59 PM, Dec 11, 2014

Software Defined Networking (SDN) T Computer Networks II Hannu Flinck

Software Defined Networking and OpenFlow: a Concise Review

OpenFlow: Concept and Practice. Dukhyun Chang

FRESCO: Modular Composable Security Services for So;ware- Defined Networks

Programming Assignments for Graduate Students using GENI Flow Management using OpenFlow on GENI

An Introduction to Software-Defined Networking (SDN) Zhang Fu

FloodGuard: A DoS Attack Prevention Extension in Software-Defined Networks

Software-Defined Networking

Create bridges, add ports, show bridge and port statistics, status, as well as the OVS database

ITL Lab 5 - Performance Measurements and SNMP Monitoring 1. Purpose

Control of Multiple Packet Schedulers for Improving QoS on OpenFlow/SDN Networking

Software Defined Networking What is it, how does it work, and what is it good for?

A Testbed for research and development of SDN applications using OpenFlow

INNOVATION IN SOFTWARE DEFINED NETWORKING AND THROUGHPUT OPTIMUM SCHEDULING ALGORITHM

Software Defined Networking (SDN)

DESIGN AND ANALYSIS OF TECHNIQUES FOR MAPPING VIRTUAL NETWORKS TO SOFTWARE- DEFINED NETWORK SUBSTRATES

Chandelle: Principles of integration wireless controller and SDN controller. Sergey Monin, Alexander Shalimov, Ruslan Smeliansky

SDN Tutorial. Dean Pemberton NSRC

Dynamic Controller Deployment in SDN

Network performance in virtual infrastructures

ON THE IMPLEMENTATION OF ADAPTIVE FLOW MEASUREMENT IN THE SDN-ENABLED NETWORK: A PROTOTYPE

Falloc: Fair Network Bandwidth Allocation in IaaS Datacenters via a Bargaining Game Approach

SDN and OpenFlow. Naresh Thukkani (ONF T&I Contributor) Technical Leader, Criterion Networks

Understanding Latency in Software Defined Networks

Empowering Software Defined Network Controller with Packet-Level Information

Performance Testing for GDB

How To Monitor And Test An Ethernet Network On A Computer Or Network Card

Lab 5.5 Configuring Logging

Instructor Notes for Lab 3

OpenFlow - the key standard of Software-Defined Networks. Dmitry Orekhov, Epam Systems

During your session you will have access to the following lab configuration. CLIENT1 (Windows XP Workstation) /24

Software Defined Networking (SDN) - Open Flow

Implementation of Address Learning/Packet Forwarding, Firewall and Load Balancing in Floodlight Controller for SDN Network Management

OpenDaylight Performance Stress Tests Report

Real-time Virtual NIC on KVM for Real-Time Network with OpenFlow

Lab - Configure a Windows 7 Firewall

Assignment #3 Routing and Network Analysis. CIS3210 Computer Networks. University of Guelph

Getting traffic statistics from network devices in an SDN environment using OpenFlow

OpenFlow network virtualization with FlowVisor

Performance Analysis of IPv4 v/s IPv6 in Virtual Environment Using UBUNTU

SDN Programming Languages. Programming SDNs!

Procedure: You can find the problem sheet on Drive D: of the lab PCs. Part 1: Router & Switch

A Scalable Multi-Datacenter Layer-2 Network Architecture

Routing in packet-switching networks

基 於 SDN 與 可 程 式 化 硬 體 架 構 之 雲 端 網 路 系 統 交 換 器

Packet Sniffer using Multicore programming. By B.A.Khivsara Assistant Professor Computer Department SNJB s KBJ COE,Chandwad

Set Up a VM-Series Firewall on an ESXi Server

How To Write A Network Plan In Openflow V1.3.3 (For A Test)

Software Defined Networking and the design of OpenFlow switches

Flexible Building Blocks for Software Defined Network Function Virtualization (Tenant-Programmable Virtual Networks)

EstiNet OpenFlow Network Simulator and Emulator

Software Defined Networking What is it, how does it work, and what is it good for?

Simulation Analysis of Characteristics and Application of Software-Defined Networks

MASTER THESIS. Performance Comparison Of the state of the art Openflow Controllers. Ahmed Sonba, Hassan Abdalkreim

Floodlight tutorial. Chen Liang

Detour planning for fast and reliable fault recovery in SDN with OpenState

Configuring IPS High Bandwidth Using EtherChannel Load Balancing

This presentation will define what we mean by hybrid mode, how that concept is supported by the OpenFlow specification, and some of the benefits of

Lecture 8 Performance Measurements and Metrics. Performance Metrics. Outline. Performance Metrics. Performance Metrics Performance Measurements

Lab - Configure a Windows Vista Firewall

co Characterizing and Tracing Packet Floods Using Cisco R

Programming Assignments for Graduate Students using GENI

OFCProbe: A Platform-Independent Tool for OpenFlow Controller Analysis

Troubleshooting the Firewall Services Module

Set Up a VM-Series Firewall on an ESXi Server

A denial of service attack against the Open Floodlight SDN controller

GLBP Gateway Load Balancing Protocol

Chapter 52 WAN Load Balancing

Troubleshooting the Firewall Services Module

OpenFlow Tutorial. January, Version: 4.

Transcription:

Software Defined Network (SDN) experiment using Mininet and POX Controller Chih-Heng Ke ( 柯 志 亨 ) Associate Professor, CSIE, National Quemoy University, Kimen, Taiwan smallko@gmail.com

Outline Lab1: basic mininet operations Lab2: manually control the switch Lab3: move the rules to the POX controller Lab4: set different forwarding rules for each switch in the controller

Lab 1: basic mininet operations """Custom topology example Two directly connected switches plus a host for each switch: host --- switch --- switch --- host Adding the 'topos' dict with a key/value pair to generate our newly defined topology enables one to pass in '--topo=mytopo' from the command line. "" from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def init ( self ): "Create custom topo." # Initialize topology Topo. init ( self ) # Add hosts and switches lefthost = self.addhost( 'h1' ) righthost = self.addhost( 'h2' ) leftswitch = self.addswitch( 's3' ) rightswitch = self.addswitch( 's4' ) # Add links self.addlink( lefthost, leftswitch ) self.addlink( leftswitch, rightswitch ) self.addlink( rightswitch, righthost ) topos = { 'mytopo': ( lambda: MyTopo() ) } lab1.py

The OpenFlow reference controller is used.

Display Mininet CLI commands: Display nodes: Display links:

Dump information about all nodes: Run a command on a host process:

Tests connectivity between hosts

Open an xterm for host h1 and test connectivity between h1 and h2. 2 1

Measure the bandwidth between hosts using iperf 2 3 1

Exit Mininet

Lab 2: manually control the switch

Lab 2-1 Set the rules for s3 and s4 Record what h1 has sent or received

Test connectivity between h1 and h2 dump-flows results from s3 and s4

DPID: Unique identifier assigned by the switch for this OpenFlow instance Number of tables and buffer size Port Information

Use wireshark to see what h1 has sent or received

Lab 2-2

Set the rules for s3

Set the rules for s4

Test connectivity between h1 and h2 arp Ping (echo) Ping (reply)

lab3_1.py #!/usr/bin/python Lab 3: move the rules to the POX controller from mininet.topo import Topo from mininet.net import Mininet from mininet.node import CPULimitedHost from mininet.link import TCLink from mininet.util import dumpnodeconnections from mininet.log import setloglevel from mininet.node import Controller import os class POXcontroller1( Controller): def start(self): self.pox='%s/pox/pox.py' %os.environ['home'] self.cmd(self.pox, "lab3_1_controller &") def stop(self): self.cmd('kill %' +self.pox) controllers = { 'poxcontroller1': POXcontroller1} class SingleSwitchTopo(Topo): "Single switch connected to n hosts." def init (self, n=2, **opts): Topo. init (self, **opts) switch = self.addswitch('s1') # Each host gets 50%/n of system CPU h1=self.addhost('h1', cpu=.5/n) h2=self.addhost('h2', cpu=.5/n) # 10 Mbps, 10ms delay, 0% loss, 1000 packet queue self.addlink('h1', switch, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true) self.addlink('h2', switch, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true)

def perftest(): "Create network and run simple performance test" topo = SingleSwitchTopo(n=2) net = Mininet(topo=topo, host=cpulimitedhost, link=tclink, controller=poxcontroller1) net.start() print "Dumping host connections" dumpnodeconnections(net.hosts) print "Testing network connectivity" net.pingall() print "Testing bandwidth between h1 and h2" h1, h2 = net.get('h1', 'h2') net.iperf((h1, h2)) net.stop() if name == ' main ': setloglevel('info') perftest() from pox.core import core import pox.openflow.libopenflow_01 as of from pox.lib.util import dpidtostr log = core.getlogger() lab3_1_controller.py def _handle_connectionup (event): msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =1 msg.actions.append(of.ofp_action_output(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =2 msg.actions.append(of.ofp_action_output(port = 1)) event.connection.send(msg) def launch (): core.openflow.addlistenerbyname("connectionup", _handle_connectionup)

Put the lab3_1_controller.py under ~/pox/ext

lab3_2.py from mininet.node import CPULimitedHost from mininet.link import TCLink from mininet.util import dumpnodeconnections from mininet.log import setloglevel from mininet.node import Controller import os class POXcontroller2( Controller): def start(self): self.pox='%s/pox/pox.py' %os.environ['home'] self.cmd(self.pox, "lab3_2_controller &") def stop(self): self.cmd('kill %' +self.pox) controllers = { 'poxcontroller1': POXcontroller2} class SingleSwitchTopo(Topo): "Single switch connected to n hosts." def init (self, n=2, **opts): Topo. init (self, **opts) switch = self.addswitch('s1') # Each host gets 50%/n of system CPU h1=self.addhost('h1', cpu=.5/n) h2=self.addhost('h2', cpu=.5/n) # 10 Mbps, 10ms delay, 0% loss, 1000 packet queue self.addlink('h1', switch, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true) self.addlink('h2', switch, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true)

def perftest(): "Create network and run simple performance test" topo = SingleSwitchTopo(n=2) net = Mininet(topo=topo, host=cpulimitedhost, link=tclink, controller=poxcontroller2) net.start() h1, h2 = net.get('h1', 'h2') h1.setip( '192.168.123.1/24' ) h2.setip( '192.168.123.2/24' ) print "Dumping host connections" dumpnodeconnections(net.hosts) print "Testing network connectivity" net.pingall() print "Testing bandwidth between h1 and h2" #net.iperf((h1, h2)) h2.cmd('iperf -s -u -i 1 > /tmp/lab3_2 &') print h1.cmd('iperf -c 192.168.123.2 -u -b 10m -t 10') h2.cmd('kill %iperf') f=open('/tmp/lab3_2') lineno=1 for line in f.readlines(): print "%d: %s" % (lineno, line.strip()) lineno+=1 net.stop() if name == ' main ': setloglevel('info') perftest()

from pox.core import core import pox.openflow.libopenflow_01 as of from pox.lib.util import dpidtostr lab3_2_controller.py Put the lab3_2_controller.py under ~/pox/ext log = core.getlogger() def _handle_connectionup (event): msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =1 msg.actions.append(of.ofp_action_output(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =2 msg.actions.append(of.ofp_action_output(port = 1)) event.connection.send(msg)

msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "192.168.123.2" msg.actions.append(of.ofp_action_output(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "192.168.123.1" msg.actions.append(of.ofp_action_output(port = 1)) event.connection.send(msg) def launch (): core.openflow.addlistenerbyname("connectionup", _handle_connectionup)

Lab 4: set different forwarding rules for each switch in the controller Loss=50 % s1 H2 H1 s0 s3 Loss=10 % s2 H3 H1->H2: H1-s0-s1-s3-H2 H1->H3: H1-s0-s2-s3-H3

#!/usr/bin/python from mininet.topo import Topo from mininet.net import Mininet from mininet.node import CPULimitedHost from mininet.link import TCLink from mininet.util import dumpnodeconnections from mininet.log import setloglevel from mininet.node import Controller from mininet.cli import CLI import os lab4.py class POXcontroller1( Controller): def start(self): self.pox='%s/pox/pox.py' %os.environ['home'] self.cmd(self.pox, "lab4_controller > /tmp/lab4_controller &") def stop(self): self.cmd('kill %' +self.pox) controllers = { 'poxcontroller': POXcontroller1} class MyTopo(Topo): def init (self, n=2,**opts): Topo. init (self, **opts) s0 = self.addswitch('s0') s1 = self.addswitch('s1') s2 = self.addswitch('s2') s3 = self.addswitch('s3') h1=self.addhost('h1', cpu=.5/n) h2=self.addhost('h2', cpu=.5/n) h3=self.addhost('h3', cpu=.5/n) self.addlink(h1, s0, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true) self.addlink(s0, s1, bw=10, delay='10ms', loss=50, max_queue_size=1000, use_htb=true) self.addlink(s0, s2, bw=10, delay='10ms', loss=10, max_queue_size=1000, use_htb=true) self.addlink(s1, s3, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true) self.addlink(s2, s3, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true) self.addlink(s3, h2, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true) self.addlink(s3, h3, bw=10, delay='10ms', loss=0, max_queue_size=1000, use_htb=true)

def perftest(): "Create network and run simple performance test" topo = MyTopo(n=3) net = Mininet(topo=topo, host=cpulimitedhost, link=tclink, controller=poxcontroller1) net.start() print "Dumping host connections" dumpnodeconnections(net.hosts) CLI(net) net.stop() if name == ' main ': setloglevel('info') perftest() Command line interface

from pox.core import core import pox.openflow.libopenflow_01 as of from pox.lib.util import dpidtostr log = core.getlogger() s0_dpid=0 s1_dpid=0 s2_dpid=0 s3_dpid=0 lab4_controller.py Put the lab4_controller.py under ~/pox/ext def _handle_connectionup (event): global s0_dpid, s1_dpid, s2_dpid, s3_dpid print "ConnectionUp: ", dpidtostr(event.connection.dpid) #remember the connection dpid for switch for m in event.connection.features.ports: if m.name == "s0-eth1": s0_dpid = event.connection.dpid print "s0_dpid=", s0_dpid elif m.name == "s1-eth1": s1_dpid = event.connection.dpid print "s1_dpid=", s1_dpid elif m.name == "s2-eth1": s2_dpid = event.connection.dpid print "s2_dpid=", s2_dpid elif m.name == "s3-eth1": s3_dpid = event.connection.dpid print "s3_dpid=", s3_dpid

def _handle_packetin (event): global s0_dpid, s1_dpid, s2_dpid, s3_dpid print "PacketIn: ", dpidtostr(event.connection.dpid) if event.connection.dpid==s0_dpid: msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0806 msg.actions.append(of.ofp_action_output(port = of.ofpp_all)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "10.0.0.1" msg.actions.append(of.ofp_action_output(port = 1)) event.connection.send(msg)

msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "10.0.0.2" msg.actions.append(of.ofp_action_output(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "10.0.0.3" msg.actions.append(of.ofp_action_output(port = 3)) event.connection.send(msg)

elif event.connection.dpid==s1_dpid: msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =1 msg.actions.append(of.ofp_action_output(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =2 msg.actions.append(of.ofp_action_output(port = 1)) event.connection.send(msg) elif event.connection.dpid==s2_dpid: msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =1 msg.actions.append(of.ofp_action_outp ut(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.in_port =2 msg.actions.append(of.ofp_action_outp ut(port = 1)) event.connection.send(msg)

elif event.connection.dpid==s3_dpid: msg = of.ofp_flow_mod() msg.priority =1 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0806 msg.actions.append(of.ofp_action_output(port = of.ofpp_all)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "10.0.0.2" msg.actions.append(of.ofp_action_output(port = 3)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_dst = "10.0.0.3" msg.actions.append(of.ofp_action_output(port = 4)) event.connection.send(msg)

msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_src="10.0.0.3" msg.match.nw_dst = "10.0.0.1" msg.actions.append(of.ofp_action_output(port = 2)) event.connection.send(msg) msg = of.ofp_flow_mod() msg.priority =10 msg.idle_timeout = 0 msg.hard_timeout = 0 msg.match.dl_type = 0x0800 msg.match.nw_src="10.0.0.2" msg.match.nw_dst = "10.0.0.1" msg.actions.append(of.ofp_action_output(port = 1)) event.connection.send(msg) def launch (): core.openflow.addlistenerbyname("connectionup", _handle_connectionup) core.openflow.addlistenerbyname("packetin", _handle_packetin)

References http://mininet.org/ http://eventos.redclara.net/indico/getfile.py/ access?contribid=1&resid=3&materialid=slide s&confid=197 https://github.com/mininet/mininet/wiki/intr oduction-to-mininet https://openflow.stanford.edu/display/onl/p OX+Wiki