Search This Blog

Tuesday, January 14, 2014

Installing OpenVSwitch in Ubuntu 12.10

USE: People who are planning to using OpenVswitch, these steps works for the latest version of OVS as of 12/16/2013

With my latest experience with OpenVSwitch, I wanted to write this blog to post all the information I was able to find and all the problems I came across while working with OVS.

The concepts I have covered here are only working with OpenVswitch. There are tons of study materials and tutorials to understand concepts of Openflow and Software Defined Networking out there.

Firstly, I would like to start off with some basic steps to install OpenVswitch and basic facts that you should be aware of:
1. There are many sources out there to help you install openvswitch, try to stick to the main openvswitch man page, they give you the most latest, the rest of the materials might not be updated to the latest one.
2. Openvswitch is Linux version sensitive. Not knowing this fact landed me with many kernel-based issues. Since OVS install some kernel modules, the compatibility of OVS with the OS version and kernel version is important to know.
3. Some of the very useful websites for OpenVSwitch are of Brent Salisbury and Scott Lowe and many others you could find by just googling OVS :)

Installation steps:
1. For latest OVS 2.0, Ubuntu 12.10 is the best performing OS. For earlier versions of OVS, earlier Ubuntu versions would work fine.
2. Following some of the directions from here. Install the following:
     
sudo apt-get update
sudo apt-get install dkms
sudo apt-get install openvswitch-datapath-source bridge-utils
sudo module-assistant auto-install openvswitch-datapath
sudo apt-get install openvswitch-brcompat openvswitch-common openvswitch-controller


apt-get install -y git python-simplejson python-qt4 python-twisted-conch automake autoconf gcc
uml-utilities libtool build-essential git pkg-config linux-headers-uname -r
git clone git://openvswitch.org/openvswitch
cd openvswitch
./boot.sh
./configure --with-linux=/lib/modules/uname -r/build
make && make install
./boot.sh
./configure --with-linux=/lib/modules/uname -r/build
make && make install
make modules_install
/sbin/modprobe openvswitch 
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
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-vsctl --no-wait init
ovs-vswitchd --pidfile --detach

3. then bring_up_br0 using the following steps:
     - write a script file (*.sh) with the following lines and run it in command-line as root
        ovs-vsctl add-br br0
        ovs-vsctl add-port br0 eth0
        ifconfig eth0 0 && br0 192.168.1.x netmask 255.255.255.0
        route del default gw 192.168.1.1 eth0
        route add degfault gw 192.168.1.1 br0

4. Next add the controller IP Address to the switch. 

   ovs-vsctl set-controller br-int tcp:192.168.1.x:6633

5. Next you can start using OVS and Controller for any of your experimentations


Thank you for taking time to read. 

No comments: