September 28, 2020
ovs in raspberry pi

Install OVS (Openvswitch) in Raspberry-Pi

OVS is a programmable Openflow switch that can be controlled via SDN Controller from anywhere in the world.

Step 1: Download the TAR file

wget http://openvswitch.org/releases/openvswitch-2.7.0.tar.gz

Step 2: Unzip and navigate to openvswitch folder

tar -xvf openv

Step 3: Make sure you have super user privileges

sudo su

Step 4: Install the following packages which are necessary for running openvswitch in your Raspberry Pi

apt-get install python-simplejson python-qt4 libssl-dev python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential pkg-config

Step 5: Check the Kernel Release of the OS(eg:-linux-headers-4.9.0.4-rpi ) and copy it and run the following commands

uname -r

apt-cache search linux-headers

apt-get install -y linux-headers-4.9.0.4-rpi

Step 6: Configure and Build the kernel module

./configure --with-linux=/lib/modules/4.9.0.4-rpi/build

Step 7: Make Install

make
make install

Step 8: Browse into datapath/linux located inside the extracted openvswitch folder and run the following commands

cd datapath/linux

modprobe openvswitch

cat /etc/modules

echo "openvswitch" >> /etc/modules

cat /etc/modules

Step 9: Navigate back to openvswitch folder and create a ovs database file by running the following commands

cd ../..

touch /usr/local/etc/ovs-vswitchd.conf

mkdir -p /usr/local/etc/openvswitch

ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema

Step 10: Create and open a file named “script” using nano or any editor of your choice(Make sure you have superuser privileges when you run the command)

nano script

Step 11: Copy-paste the following codes into the file named “script”

ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
                     --remote=db:Open_vSwitch,Open_vSwitch,manager_options \
                     --private-key=db:Open_vSwitch,SSL,private_key \
                     --certificate=db:Open_vSwitch,SSL,certificate \
                     --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
                     --pidfile --detach
ovs-vswitchd --pidfile --detach
ovs-vsctl --no-wait init
ovs-vsctl show

Step 12: Save the file by hitting Ctrl+o and exit the editor by hitting Ctrl+x

Step 13: Create the executable version of the file and run it

chmod +x script
./script

That’s it. Your Openvswitch would work every time you run the script file.

Rohit Das

Rohit Kumar Das is a Research Scholar at the Department of Information Technology, North-Eastern Hill University. Google Scholar

View all posts by Rohit Das →

Leave a Reply

Your email address will not be published. Required fields are marked *