Introduction to OpenFlow
OpenFlow is a foundational protocol in the world of Software-Defined Networking (SDN). It provides a standardized way for a central SDN controller to communicate with the forwarding plane of network devices like switches and routers. This separation of the control plane from the data plane is the core concept of SDN, and OpenFlow is the most well-known protocol that enables it.
This article will provide a technical deep dive into the OpenFlow protocol, exploring its architecture, message types, and how it enables programmatic control of the network.
OpenFlow Architecture
The OpenFlow architecture consists of three main components:
- OpenFlow Controller: The controller is the brain of the network. It runs on a server and is responsible for making all the decisions about how traffic should be forwarded.
- OpenFlow Switch: The switch is a network device that forwards traffic according to the rules that are pushed down to it by the controller.
- OpenFlow Protocol: The protocol is the language that the controller and the switch use to communicate with each other.
The communication between the controller and the switch happens over a secure channel, which is typically a TLS connection.
The OpenFlow Flow Table
The heart of an OpenFlow switch is the flow table. The flow table is a list of flow entries, each of which tells the switch what to do with a particular type of traffic. A flow entry consists of three main parts:
- Match Fields: These fields are used to match incoming packets. They can include a wide range of fields, such as the source and destination MAC addresses, the source and destination IP addresses, the TCP/UDP port numbers, and the VLAN ID.
- Priority: This field is used to determine the order in which flow entries are matched. Higher priority entries are matched before lower priority entries.
- Instructions: These fields tell the switch what to do with a packet that matches the flow entry. The instructions can include a variety of actions, such as forwarding the packet to a particular port, dropping the packet, or modifying the packet’s headers.
OpenFlow Message Types
The OpenFlow protocol defines three main types of messages:
- Controller-to-Switch Messages: These messages are sent from the controller to the switch. They are used to manage the switch, to query the switch’s capabilities, and to add, modify, and delete flow entries in the flow table.
- Asynchronous Messages: These messages are sent from the switch to the controller. They are used to notify the controller of events that have occurred on the switch, such as a port going down or a packet arriving that does not match any flow entry.
- Symmetric Messages: These messages can be sent from either the controller or the switch. They are used for things like keep-alive messages and error messages.
A Closer Look at Controller-to-Switch Messages
Controller-to-Switch messages are the most important type of message in the OpenFlow protocol. They are what allow the controller to program the switch’s forwarding plane. Some of the most important Controller-to-Switch messages include:
- OFPT_FEATURES_REQUEST: This message is sent by the controller to the switch to query its capabilities. The switch will respond with an
OFPT_FEATURES_REPLYmessage that contains information about the switch, such as the number of ports it has and the version of the OpenFlow protocol it supports. - OFPT_FLOW_MOD: This message is used to add, modify, or delete flow entries in the flow table.
- OFPT_PACKET_OUT: This message is used to send a packet out of a particular port on the switch. This is useful for things like sending ARP requests or for injecting traffic into the network.
A Closer Look at Asynchronous Messages
Asynchronous messages are what allow the switch to communicate with the controller in a reactive way. Some of the most important Asynchronous messages include:
- OFPT_PACKET_IN: This message is sent by the switch to the controller when a packet arrives that does not match any flow entry in the flow table. The controller can then decide what to do with the packet, and it can install a new flow entry in the switch to handle similar packets in the future.
- OFPT_PORT_STATUS: This message is sent by the switch to the controller when the status of a port changes, such as when a port goes down or comes up.
- OFPT_FLOW_REMOVED: This message is sent by the switch to the controller when a flow entry is removed from the flow table. This can happen for a variety of reasons, such as when the flow entry’s idle timeout expires.
Conclusion
The OpenFlow protocol is a powerful and flexible protocol that is the foundation of Software-Defined Networking. It provides a standardized way for a central SDN controller to program the forwarding plane of network devices, which enables a wide range of new and innovative applications. As SDN continues to gain traction in the networking industry, the importance of the OpenFlow protocol will only continue to grow.