Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PPJ-09

Eueung Mulyana
November 10, 2015

 PPJ-09

PPJ-09 Mininet
http://eueung.github.io/EL5244/
Software Defined Networking

Eueung Mulyana

November 10, 2015
Tweet

More Decks by Eueung Mulyana

Other Decks in Education

Transcript

  1. This material is mainly a derivative and remix work. Most

    of the texts and illustrations are taken from the talks/lectures given by the referenced networking professors/gurus/ninjas (Credits at the end of the Slide).
  2. What is Mininet? • A virtual network environment that can

    run on a single PC • Runs real kernel, switch, and application code on a single machine • Command-line, UI, Python interfaces • Machine local virtual network : great dev/testing tool • Uses linux virtual network features: Cheaper than VMs • Arbitrary topologies, nodes
  3. Why Use Mininet? • Lightweight + Fast • Open source

    • Easy to use • Can run real programs (anything that can run on Linux can run on a Mininet host) • Possible to create custom topologies
  4. Mininet Rapidly prototype, develop and test • Interestingly-sized networks (16-100

    nodes) start up in seconds • No lengthy lab reconfiguration or rebooting required • Always-accessible network resources, in any topology, at essentially no cost • Designs that work on Mininet transfer seamlessly to hardware for full speed operation
  5. Mininet Repeatably test, analyze, and predict network behavior • Easy

    replication of experimental and test results • Examine effects of code or network changes before testing/deploying on hardware • Allows automated system- level tests and experiments • Recreate real-world network and test cases for a variety of topologies and configurations
  6. Mininet Quickly get up and running • Free and permissively

    licensed (BSD) • Minimal hardware requirements • Accessible to novices thanks to simple CLI • Smooth learning curve thanks to walkthrough, tutorial, examples and API documentation • Strong users and support community
  7. Alternatives? Mininet vs. … • Real system: Pain to configure

    • Networked VMs: Scalability • Simulator: No path to hardware deployment
  8. Basic Operations Basic Commands • Display an xterm for switch

    s1 – mininet> xterm s1 • Inspect flow tables at switch xterm – dpctl dump-flows tcp:127.0.0.1:6634 To view OpenFlow protocol messages, at mininet-VM xterm: • sudo wireshark & • Capture the interface to controller • In wireshark filter box, enter filter to filter OpenFlow messages: of
  9. Basic Operations Testing a Simple Mininet Setup Try setting up

    a simple topology with three hosts connected to a single switch: sudo mn --test pingall --topo single,3 • This setup uses a default switch controller and switch • Mininet also allows you to use custom remote controllers (and custom switches)
  10. Basic Operations Basic Commands Create a network consists of one

    OpenvSwitch, three hosts and is controlled by a remote controller with IP address 192.168.56.1 sudo mn --topo single,3 -- controller remote,ip=192.168.56.1 --switch ovsk • mininet> help • mininet> dump nodes • mininet> h1 ping h2
  11. Basic Operations Basic Params • --topo – defines a topology

    via command line upon mininet start-up. • --switch – defines the switch to be used. By default the OVSK software switch is used. • --controller – defines the controller to be used. If unspecified default controller is used with a default hub behavior.
  12. Topologies Minimal network with two hosts, one switch sudo mn

    –topo minimal Example with 4 hosts and 4 switches sudo mn --topo linear,4 Example with 3 hosts all connected to one switch. sudo mn --topo single,3 Tree topology with defined depth and fan-out. sudo mn --topo tree,depth=2,fanout=2
  13. Backstage: mn Executes Python • “mn” is a launch script

    that executes Python • Consider: “—topo linear, 4” from mininet.net import Mininet from mininet.topo import LinearTopo Linear = LinearTopo(k=4) net = Mininet(topo=Linear) net.start() net.pingAll() net.stop()
  14. The Mininet VM in a Nutshell • Launch mininet process

    • Per host – Bash process – Network namespace • Create veth pairs and assign to namespaces • Create OpenFlow switch to connect hosts • Create OpenFlow controller
  15. Customizing Control • Review of hub and switch • POX

    Controller and simple Mininet topology • Two types of control – Hub – Learning switch • Looking at flow tables with dpctl
  16. Single Topo, 3 Hosts $ sudo mn --topo single,3 --mac

    --switch ovsk --controller remote dpctl to communicate with switches • Switches listen on port 6634 • Can inspect flow table entries, modify flows, etc. Hub/Switch h3 h4 dpctl h2 127.0.0.1:6634
  17. Review: Hub • No forwarding information stored at switch •

    Every input packet is flooded out all ports A B C D
  18. POX Controller $ sudo mn --topo single,3 --mac --switch ovsk

    --controller remote dpctl to communicate with switches • Switches listen on port 6634 • Can inspect flow table entries, modify flows, etc. Hub/Switch h3 h4 dpctl h2 127.0.0.1:6634 POX (hub.py)
  19. POX Hub def _handle_ConnectionUp (event): msg = of.ofp_flow_mod() msg.actions.append(of.ofp_action_output(port =

    of.OFPP_FLOOD)) event.connection.send(msg) log.info("Hubifying %s", dpidToStr(event.dpid)) def launch (): core.openflow.addListenerByName("ConnectionUp", _handle_ConnectionUp) log.info("Hub running.")
  20. Review: Learning Switch Switch table is initially empty For each

    incoming frame, store • The incoming interface from which the frame arrived • The time at which that frame arrived • Delete the entry if no frames with a particular source address arrive within a certain time A B C D Switch learns how to reach A
  21. L2 Learning SW with POX $ sudo mn --topo single,3

    --mac --switch ovsk --controller remote dpctl to communicate with switches • Switches listen on port 6634 • Can inspect flow table entries, modify flows, etc. Hub/Switch h3 h4 dpctl h2 127.0.0.1:6634 POX (l2_learning.py)
  22. POX: l2_learning.py 1. Use source address and switch port to

    update address/port table 2. Is transparent = False and either Ethertype is LLDP or the packet’s destination address is a Bridge Filtered address? If yes, DROP 3. Is destination multicast? If so, FLOOD. 4. Is port for destination address in our address/port table? If not, FLOOD. 5. Is output port the same as input port? If yes, DROP 6. Install flow table entry in the switch so that this flow goes out the appropriate port. Send the packet out appropriate port.
  23. Mininet is a network emulator that runs in a Virtual

    Machine Lightweight OS virtualization to achieve scale. Fast, Easy, Shareable
  24. Credit • Scott Shenker, The Future of Networking and the

    Past of Protocols • Nick McKeown, Stanford University, Many Talks/Articles • Jennifer Rexford, COS 597E, Princeton University • Mike Freedman, COS 461, Princeton University • Nick Feamster, https://www.coursera.org/course/sdn • Li Erran Li, COMS 6998-10, Univ. of Columbia • Marco Cello, SDN Talk @ CNR, Univ. Genova • Guido Appenzeller, Network Virtualization in Multi- tenant Datacenters, VMware