...
These should always be run prior to attempting to use OVS. Without these prerequisite commands, OVS will likely report an error stating something along the lines of "unable to connect to database."
...
Configuring the Open vSwitch Bridge
The agent code running on the agent machine will communicate with devices on the data plane via an OVS bridge. This will allow us to exert control over the packets traversing to and from the agent. We can use OVS's virtual switch control program to instantiate a bridge:
Code Block | ||
---|---|---|
| ||
$ sudo ovs-vsctl add-br br_ovs |
where br_ovs is the name of the bridge (which we will also use throughout these instructions). You can name this whatever you want as long as it does not conflict with any interfaces listed in ifconfig.
...
Code Block | ||
---|---|---|
| ||
$ sudo ovs-vsctl add-port br_ovs ethX |
where ethX is the interface on the agent machine leading to the data plane. ethX is just a placeholder in this instruction, which should be swapped for the valid data plane interface name in ifconfig.
![]() | Be careful to not accidentally add your control interface to the bridge – you might lock yourself out of the machine if using SSH. |
---|
Then, we can set the DPID of the OVS bridge to something that's easier to remember. This is not required; however, it makes it easier to reason with the topology and to debug if necessary. Note that this same DPID should be used when configuring the controller with this agent bridge.
...
Code Block | ||
---|---|---|
| ||
$ sudo ovs-vsctl set-fail-mode br_ovs secure |
LastlyAfter that, the OVS bridge needs to be connected to the controller:
Code Block | ||
---|---|---|
| ||
$ sudo ovs-vsctl set-controller br_ovs tcp:<your-controller-ip>:6653 |
where <your-controller-ip> is the IP address of the SOS-enabled Floodlight controller you are running or will run. The default port of 6653 is used; however, if desired, you can change the port both here and on the controller as long as you do it consistently.
Finally, we need to route packets through our new OVS bridge instead of the old ethX data plane interface. This can be accomplished by removing the IP address and route from ethX and adding it instead to br_ovs:
Code Block | ||
---|---|---|
| ||
$ sudo ifconfig ethX 0
$ sudo ifconfig br_ovs <your-desired-ip>/<your-desired-CIDR-mask> up |
where <your-desired-ip> is the IP address you want the agent machine's data plane interface to have, and where <your-desired-CIDR-mask> is the CIDR subnet mask you would like to use as your data plane subnet. For example, a valid IP and netmask might look like 10.0.0.1/24.
As a double-check, you can check the routes to verify the OVS bridge is now being used to route traffic into and out of the data plane:
Code Block | ||
---|---|---|
| ||
$ sudo route -n |