Managing networks with OpenFlow

Flow Control

Article from Issue 162/2014

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) [1] 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 [2], 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.

Figure 1: An OpenFlow-capable switch connected to the controller.

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).

OpenFlow Controllers

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 [3] 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 [4] 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 [5] 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.

Figure 2: The flow table regulates the data flow by reference to the flow entries.

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.

Figure 3: Schematic of the header field from the OpenFlow 1.0 specification.

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 [6], a tool designed for testing and simulating network configurations. (See the article on Mininet elsewhere in this issue.)

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Mininet

    Mininet lets you test new controller features for your software-defined network in a sandbox before releasing them onto your production network.

  • SDN Up Close

    Globalization, rapidly increasing numbers of devices, virtualization, the cloud, and "bring your own device" make classically organized IP networks difficult to plan and manage. Instead of quarreling, some admins address these problems with a radically new approach: Software-defined networking.

  • OpenDaylight

    Several well-known companies are collaborating on the foundations of future SDN products under the umbrella of the OpenDaylight open source project.

  • Software-Defined Networks

    Even as the tech world works to figure out just what to do with the potential of cloud computing and big data, along comes a new bit of technology fueled by open source software: software-defined networks.

  • Open Networking Foundation Formed

    “Stronger definition of network behavior in software is a growing trend, and open interfaces are going to lead to faster innovation,” said Nick McKeown, ONF Board member and professor at Stanford University.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More