Ditching LINC for Open vSwitch in RaspberryPi

As mentioned in a previous post, I turned a Raspberry Pi into am Openflow LINC switch. Nevertheless, I was not able to connect it to a Ryu controller on an external machine. I even installed Ryu into another Rasbperry Pi on the same network and got the same problem.

As my goal is to create an Openflow SDN with Raspberry Pi, particularly for IoT applications, the need of an effective connection to an external controller is mandatory. Additionally, I want to use the Ryu controller given its support and community.

So, as the title of this post states, we are ditching LINC and turning our Pi into an Open vSwitch (OVS).

To detail the procedure, I will simply transcribe what is mentioned in a video by IoTPhile/Startup Scaleup.

Dependencies, compilation and installation

It is important to highlight the user mode for issuing the commands:

  • $: means normal user privileges.
  • #: means root privileges.
  1. Download OVS and uncompress:
    1. raspi@raspi:~$ wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
      1. Check. It might be newer versions available (like 2.5).
    2. raspi@raspi:~$ tar -xvzf openvswitch-2.3.1.tar.gz
  2. Then, cd into the uncompressed directory and download dependencies using apt (remember, using root privileges, that is why we issue the sudo su command):
    1. raspi@raspi:~cd openvswitch-2.3.1
    2. raspi@raspi:~/openvswitch-2.3.1$ sudo su
    3. root@raspi:~/openvswitch-2.3.1# apt-get install python-simplejson python-qt4 libssl-dev python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential pkg-config
    4. root@raspi:~/openvswitch-2.3.1# apt-get install linux-headers-3.12-1-rpi
  3. Next, we configure, compile and install OVS using the aforementioned Linux headers
    1. root@raspi:~/openvswitch-2.3.1# ./configure –with-linux=/lib/modules/3.12-1-rpi/build
    2. root@raspi:~/openvswitch-2.3.1# make
    3. root@raspi:~/openvswitch-2.3.1# make install
  4. Load the OVS module into the operating system
    1. root@raspi:~/openvswitch-2.3.1# cd datapath/linux/
    2. root@raspi:~/openvswitch-2.3.1/datapath/linux# modprobe openvswitch
  5. Create an OVS configuration file and the database that will store such configuration:
    1. root@raspi:~/openvswitch-2.3.1/datapath/linux# cd ../..
    2. root@raspi:~/openvswitch-2.3.1# touch /usr/local/etc/ovs-vswitchd.conf
    3. root@raspi:~/openvswitch-2.3.1# mkdir -p /usr/local/etc/openvswitch
    4. root@raspi:~/openvswitch-2.3.1# ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
  6. In order to expedite the process of bringing up the OVS daemon, we create the following script using your favorite text editor. I’m using vim:
    1. root@raspi:~/openvswitch-2.3.1# vim script
    2. Copy and paste the code I copied into pastebin.
    3. Save and close the file.
  7. Fireup OVS:
    1. root@raspi:~/openvswitch-2.3.1# chmod 755 script
    2. root@raspi:~/openvswitch-2.3.1# ./script

These steps effectively install OVS into the Pi. Any further configuration of the switch and other controller settings will be detailed in other post.

UPDATE (29/07/16): I strongly recommend listening to this podcast with main contributors to the Open vSwitch project.

UPDATE (02/08/16): It is important to change the OVS bridge internal interface hardware address for the one belonging to the management interface. That is, the MAC address of the interface with an IP address. This is detailed here and is very important for you OVS to work properly without a controller.

Regards,

L.

Posted under: Openflow, OpenvSwitch, SDN

Tagged as: , , ,