Skip to content

Open vSwitch

Open vSwitch (OVS) is a service that allows for virtualization of network device functionality. Open vSwitch is platform agnostic, allowing it to be installed as a software package on a general processing system or deployed directly into open switch-fabrics. The service can be controlled in various ways including through OpenFlow integration with an SDN-controller or through the use of local rules. This wiki-page will focus on the usage of local control-functionality.

Service structure and setup

The ovs service is split into two components, the ovs-database (ovsdb-server) and the ovs-switch-service (ovs-vswitchd). The two services can be described as analogous to the FIB and switching-fabric of the a regular switch, with the database storing flow-rules that device the forwarding behaviour of the switching-service.

As the two services are able to operate individually, they must be instantiated individually.

After the database is properly set up, the switch-daemon can be started, connecting to the socket made available by the database-server. After the OVS-services are instantiated, they can simply be started after system reboots, without the need to re-instantiate the components.

Specifics regarding command syntax is available in the OVS-reference "Starting" section.

OVS Bridges/Switches

The OVS services act as a network hypervisor. In essence, this means that it does not act as a networking device on its own, but supplies a platform on which virtual network devices can be instantiated. When OVS is running on a system, it is possible to create networking devices, called bridges or switches, simply through declaring them:

ovs-vsctl add-br SWITCHNAME
The networking device is not automatically associated with any of the devices physical interfaces and these must therefore be added explicitly:
ovs-vsctl add-port SWITCHNAME eth1
These settings are set in volatile memory, so will have to be re-inserted on device restart.

To verify that a bridge exists and receive information regarding its information, the ovs-ofctl show SWITCHNAME command can be used. Take note that the indexing of interfaces for the bridge does not need to follow the indexing of the physical interfaces, and more likely will follow the order the interfaces were added to the bridge.

OpenFlow Forwarding Rules

The OVS-service has the ability to integrate OpenFlow functionality locally on the OVS-device. In essence, this means it is possible to apply OpenFlow-formatted forwarding-rules without the use of an OpenFlow-compatible SDN-controller. Although the command-structure to add forwarding rules, called flows, is quite simple, the structure of the rules themselves can be quite unintuitive at first glance. The full reference on OVS' OpenFlow tool is available on its man-page. The command to add a new flow to a switch is:

ovs-ofctl add-flow SWITCHNAME FLOW-DEFINITION
For further information on how to construct flow-definitions, see the flow-rule page.

Connecting to an SDN-controller

OVS is able to run with locally constructed rules, but a more practical approach to utilize its OpenFlow capacity by connecting it to an SDN-controller. SDN controllers are typically equipped to leverage the benefits of softwarization of the networks devices. To connect an OVS instance to an SDN-controller, the following command can be used (presuming that a controller is exposed at the destination):

ovs-vsctl set-controller SWITCHNAME tcp:CONTROLLER-ADDRESS:CONTROLLER-PORT