Open VSwitch Getting Started

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6
At a glance
Powered by AI
The document outlines the steps to install and configure Open vSwitch on Ubuntu to function as a software switch.

The steps include upgrading the system, installing dependencies, downloading and extracting Open vSwitch, compiling and installing it, loading modules, initializing the database, and starting the daemon.

You create a bridge, add ports, configure IP addresses, and connect the POX controller to the bridge using scripts and commands shown on pages 4-5.

Open vSwitch Getting Started

System Requirements:
Ubuntu 12.04
Good internet connection
This document will help you install Open vSwitch on your system, enabling it to
perform like a Switch
Note: If you are not the root user of the system, use sudo before every
command in the terminal. DO NOT copy paste the commands given in this
document directly onto the terminals, as it might result in an error.
Open a terminal on your Linux system and type the text that follow Command
to install Open vSwitch
Upgrade Linux system and security update
o Command: sudo apt-get update
Install updates when prompted by the Update Manager
Install dependencies
o Command: sudo apt-get install python-simplejson python-qt4 python-
twisted-conch automake autoconf gcc uml-utilities libtool build-essential
pkg-config
Download Open vSwitch
o Goto openvswitch.org, click on the download button shown


Copy the link shown within the red circle

Goto terminal, paste the address after wget to download open vswitch
o Command: wget http://openvswitch.org/releases/openvswitch-
2.1.2.tar.gz
Extract contents
o Command: tar xf openvswitch-2.1.2.tar.gz
The contents will be extracted into a folder called openvswitch-
2.1.2
Navigate to the folder
o Command: cd openvswitch-2.1.2
Install the following dependencies
o Command: uname -r
Copy the x.x.x-23-generic-pae text that shows up and paste it in the
following command
o Command: sudo apt-get install libssl-dev iproute tcpdump linux-headers-
x.x.x-23-generic-pae
Compile and install
o Command: ./boot.sh
o Command: ./configure --with-linux=/lib/modules/ x.x.x-23-generic-
pae/build
o Command: sudo make
o Command: sudo make install
Load openvswitch.ko module
o Command: sudo insmod datapath/linux/openvswitch.ko
Create an empty conf file
o Command: sudo touch /usr/local/etc/ovs-vswitchd.conf
o Command: sudo mkdir -p /usr/local/etc/openvswitch
o Command: sudo ovsdb-tool create /usr/local/etc/openvswitch/conf.db
Open a new tab to check the rest of the installation steps from INSTALL.Linux
document
Check if INSTALL.Linux is present
o Command: l
In terminal, type
o Command: less INSTALL.Linux
The terminal will state that the OVS server needs to start before starting ovs switch
itself, similar to what is shown in the figure below


In a new tab, enter all the commands shown within the circle sequentially
o Command: sudo ovsdb-server --remote-
punix:/usr/local/var/run/openvswitch/db.sock --remote-
db:Open_vSwitch,manager_options --private-key=db:SSL,private_key --
certificate=db,certificate --bootstrap-ca-cert=db:SSL,ca_cert --pidfile --
detach
Initialize database
o Command: sudo ovs-vsctl --no-wait init
Start the main Open vSwitch deamon
o Command: sudo ovs-vswitched --pidfile --detach

Install POX networking software platform
o Open a terminal and type the following
git clone http://github.com/noxrepo/pox
o Navigate into the folder from the terminal and type
cd pox
o To invoke POX type
./pox.py py log.level forwarding.l3_learning

To enable the system to act like a switch, create a folder with suitable name and
copy the following commands into a file called buildbridge.sh. This code is used to
build a bridge

#Build a bridge
sudo ovs-vsctl add-br sdn_switch
#Create tp links for veth- veth0 and veth1
sudo ip link add veth0 type veth peer name veth1
#Connect the existing eth ports and veth0 to the bridge s1
sudo ovs-vsctl add-port sdn_switch ethx
sudo ovs-vsctl add-port sdn_switch ethx
sudo ovs-vsctl add-port sdn_switch veth0
#Up link all the connections
sudo ifconfig ethx up
sudo ifconfig ethx up
sudo ifconfig veth0 up
sudo ifconfig veth1 up
sudo ifconfig sdn_switch up
#Connect the POX controller to the bridge with the default internal tcp ip
sudo ovs-vsctl set-controller sdn_switch tcp:127.0.0.1:6633
#Display the bridge
sudo ovs-vsctl show
In order to find out which ethx are available, type ifconfig in the terminal which
will display the ethx available. An example of what would be displayed is shown
below
eth0 Link encap:Ethernet HWaddr 08:00:27:5f:06:f4
inet6 addr: fe80::a00:27ff:fe5f:6f4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:165 errors:0 dropped:0 overruns:0 frame:0
TX packets:147 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22496 (22.4 KB) TX bytes:30704 (30.7 KB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:2800 errors:0 dropped:0 overruns:0 frame:0
TX packets:2800 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:229600 (229.6 KB) TX bytes:229600 (229.6 KB)

Open a terminal and navigate to the location where the buildbridge.sh file is located.
Type ./buildbridge.sh in the terminal to run the build bridge script in order to
establish the bridge.
Your system is now ready to act like a switch. In order to test the switch, imagine the
following diagram:
System
(Open vSwitch)
eth0
eth1
eth2
eth3
Host 1
Host 2


Connect two systems (Host 1 & Host 2) to two Ethernet ports on the Open vSwitch.
Configure an ip address for each of the host using the following command, depending
on which eths are the host connected to
On Host 1, open a terminal and type
ifconfig ethx 192.168.56.1
On Host 2, open a terminal and type
ifconfig ethx 192.168.56.2
Ping one host from the other to view the switch packets. For example, open a terminal
on Host 2 and type ping 192.168.56.1 to view packets being exchanged between
both the hosts much like how it is depicted in the figure below

You might also like