Managing networks with OpenFlow
The OpenFlow protocol and its surrounding technologies are bringing the promise of SDN to real networks – and it might not be long before you see them on your real network.
Several leading Internet companies founded the Open Networking Foundation (ONF)  to promote the adoption of software-defined networking through open standard development. According to the ONF, their "signature accomplishment" is fostering and maintaining the OpenFlow standard , which defines a protocol for communicating with software-defined network (SDN)-ready network devices (Figure 1). A striking number of proprietary and free SDN projects now implement the OpenFlow standard.
OpenFlow has gained some momentum since it first appeared in 2008. Between the test suite 0.8.1 from June 2008 and version 1.0 of the specification from December 2009, the developers released seven updates. Since then, eight further iterations have appeared; the current version is numbered 1.4.
In this article, I describe how OpenFlow implements the principles of SDN and take a brief tour of OpenFlow configuration and management using the Mininet simulation tool. See the article on Mininet elsewhere in this issue for more on installing and using Mininet.
OpenFlow at Work
As you learned in the previous article in this issue, the basic idea of software-defined networking is to centralize control of network devices such as routers and switches in a way that allows the network to behave more intelligently. Processing power on the network device is therefore kept to a minimum: the hardware just forwards packets and does not need to execute complex logic to make individual forwarding decisions. The controller maintains an overview of the network, passing simple instructions to the networking devices in the form of a flow table, which the device will use as a roadmap for forwarding packets (see the "OpenFlow Controllers" box).
A variety of controllers are available for OpenFlow networks. These controllers implement the OpenFlow protocol and take care of communication with the switches. Additionally, most controllers provide an API for a popular programming language (Figure 4). The API lets developers write applications that manage and control the network of OpenFlow devices.
Some popular OpenFlow controllers include:
- Nox – The Nox controller  was released under the GPLv3 and has been in development since 2008. Nox follows a modular approach, with a C++ and a Python API.
- Floodlight – The Floodlight Controller  is based on the cross-platform Java programming language. Floodlight also comes with some apps and pursues a module and app-based approach. The standard version comes with a module that offers an additional REST interface for actively setting static flows. Floodlight is available under the open source Apache license.
- Frenetic – Frenetic  is a project by Princeton University released under the LGPLv3. The network programming language runs as an application on the Nox controller, uses a separate run-time environment, and speaks Ocaml or Python. Frenetic adds a further abstraction layer for app development, which makes it possible to reduce the amount of source code and write application-oriented code that can be encapsulated and reused in functions.
This separation of data and control reduces the unit cost significantly, because the software-side implementation of the various protocols for operating a device in a Layer 2 domain (bridged/switched network) is expensive. Also, the admin does not have to pre-configure the devices individually. Since all the intelligence is in the controller, you don't need to leave your desk; instead, you can manage the network from a central point.
OpenFlow uses a flow-based routing concept. By considering the network as a whole, the controller can set up end-to-end connections across multiple switches for certain types of packets. OpenFlow maps the packet type to the transport protocol.
As soon as the controller detects the signature, it instructs the participating switches in the network to set their forwarding entries accordingly. The admin thus no longer needs to train the local switches but can use the controller to develop granular rules for the entire adaptive network.
The OpenFlow forwarding logic basically consists of a flow table, which in turn contains various flow entries (Figure 2). Included with the entries is a header, which collects an identification pattern in several fields; this identifier information will play a role in packet detection (matching patterns). The flow entries define actions applicable to the pattern or packet type.
The specifications are sometimes very extensive, because they provide detailed explanations of the flow entry structures, the structure of the flow tables, the possible actions, and the counter fields. If you're interested in the details, you'll find the OpenFlow specifications at the website for the Open Networking Foundation.
When a packet in an OpenFlow network arrives at one of the ports reserved for OpenFlow, the switch examines the header field (Figure 3). The switch compares the bits with the entries in its flow table, which may use wildcards as entries. In case of a match, the switch performs the actions defined in the flow entries and updates the counter.
The action can be, for example, forwarding the packet to a port, modifying its header field, or forwarding it to another flow table. If the switch fails to find the entry in the header field in a flow table, it encapsulates the packet and sends it to the controller, which then decides how to proceed. The controller either forwards the packet directly or instructs the switches to add the flow entry to their flow tables so that they can handle packets with this pattern in the future.
The controller has two types of flow entries: proactive and reactive. Proactive means the controller instructs the switch to set a flow record for a given flow table without the switch first asking for permission. Reactive tells the switch to encapsulate an unknown packet and send it to the controller; in response, the controller generates a matching flow record for the unknown packet.
Once a switch has set a flow entry, it waves through the packets that belong to the flow. This approach reduces the response time because it saves the detour via the controller.
OpenFlow has evolved into production use as an SDN concept; the dedicated switches that support OpenFlow are described by their vendors as OpenFlow enabled. These are hybrid switches that, in addition to their legacy switch functionality and the associated protocols, such as the Link Local Discovery Protocol (LLDP), offer an OpenFlow configuration. To use them, network managers need, depending on the vendor and model, to complete various configurations of the OpenFlow instance on the switch. This usually means switching the appropriate ports or VLANs to OpenFlow mode so that an external controller can manage the switch.
Examples with Mininet
I'll describe three practical examples that illustrate how to use OpenFlow. To cook up these simulations, I'll use Mininet , a tool designed for testing and simulating network configurations. (See the article on Mininet elsewhere in this issue.)
Buy this article as PDF
Innovative system adds a hard drive and Ubuntu Core to the RPi for an IoT hub.
Linux is two weeks younger than we thought!
The Apache Software Foundation considers retiring OpenOffice
Adobe won’t kill the plugin in 2017
Linux Foundation's big event celebrates the 25th anniversary of Linux
Linux has evolved from “won’t be a professional” project to one of the most professional software projects in the history of computers.
Competitors get in the game with RHEL without Red Hat
Security researchers have already notified Microsoft; some fixes are available
The company is collaborating with Google and Intel to use Kubernetes as an engine for Fuel