Mininet and OpenFlow

Created

2/4/2025

Control Plane Approaches

In SDN there are two ways to maintain the control plane:

  • proactive: install rules from controller to switches before any packet goes through the network
    • you would have to install all the rules yourself
  • reactive: packet comes into the switch, it won't find a rule to match to that packet, then it will send that packet to the controller, which would look at it from a global perspective and find a route, then it would send that rule to the switch which will save it.
    • this means the first request will be the slowest.

Platforms for Network Research

What are platforms for network / systems research and teaching?

  • Hardware is
    • advantage: fast and accurate
    • disadvantage: hard to reconfigure / change and it will cost a lot of money
  • Emulators (mininet)
    • advantages: cheap, flexible, accurate
    • disadvantages: super slow. some experiments might not fit, possible inaccuracy
    • has multiple servers, controllers, and switches; an actual virtual network
  • simulators (omnet + / inet)
    • advantages: cheap, flexible, can be "faster" than reality
    • disadvantages: require app changes, might not run OS code

Mininet commands

nodes: list all nodes

dump: dump information about all nodes

net see what network cards are connected to the nodes

pingall: check if there is a connection between all the nodes in the network

  • pings all destinations

links shows every link in the network

h1 ping h2: can node h1 ping node h2

sudo mn -c: clears all topology

sudo mn --topo=<> predefined ways to set up the topology.

  • e.g., --topo=single,4 means there's one central switch connected to four nodes
  • --topo=linear,4: a line of four switches, each with one host
  • --topo=tree,2,2: means to create a tree of switch depth 2 and then the second number is the fan out of the switches (i.e., 2 hosts at each switch)
  • mininet only has single and linear topology pre-defined.

OpenFlow

There should be a language that the switch and controller can communicate in (i.e., between control and data plane). This is the OpenFlow API

  • standardized by Open Networking Foundation (ONF)
  • allows to add functionality in the switches.

Initially, OpenFlow functionality was simple:

  1. look at the destination address
  2. see if there is a match in the routing table- if so, perform the action
    1. matches can be input port, ethernet header fields, IP header fields, or some TCP header fields
    2. actions can be drop, forward, send to controller, or modification

Controller shows routes between each pair, so you need OpenFlow messages that are used to communicate between the controller and the switch. The types of OpenFlow messages are:

  • Packet_In
    • going into the controller
    • the switch will send a Packet_In to the controller that they received x packet and need to know what rule to use
  • Packet_Out
    • going out of the controller
    • the controller sends back the rule that the switch should perform and the switch will save this
  • Flow-MOD
    • changing switch rule
    • e.g., before we sent packet to h2 but the Flow-MOD tells that switch you should send that packet to h3 instead.