openvswitch is a powerful Linux based utility for working with vlans, traffic filtering, monitoring, and QoS management within a hosted virtualization environment.
The current stable version of Debian, which as of this writing is version 7.1, has an older version
of openvswitch. The version is many versions ago.
To use the most recent version of openvswitch will require manually building. These are the steps I performed
to get the basic system in place.
wget http://openvswitch.org/releases/openvswitch-1.10.0.tar.gz
tar -zxvf openvswitch-1.10.0.tar.gz
cd openvswitch-1.10.0
apt-get install linux-headers-`uname -r`
apt-get install build-essential
apt-get install libssl-dev openssl pkg-config
apt-get remove bridge-utils
tc
./configure \
--prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=/usr/lib \
--includedir=/usr/include \
--datarootdir=/usr/share \
--with-linux=/lib/modules/`uname -r`/build
make
make install
insmod datapath/linux/openvswitch.ko
lsmod | grep switch
/sbin/modinfo ./datapath/linux/openvswitch.ko
make modules_install
ovsdb-tool create /etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
ovsdb-server \
--remote=punix:/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,manager_options \
--private-key=db:SSL,private_key \
--certificate=db:SSL,certificate \
--bootstrap-ca-cert=db:SSL,ca_cert \
--pidfile --detach
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach
I put the following lines in /etc/rc.local to get things started after a reboot:
ovsdb-server \
--remote=punix:/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,manager_options \
--private-key=db:SSL,private_key \
--certificate=db:SSL,certificate \
--bootstrap-ca-cert=db:SSL,ca_cert \
--pidfile --detach
ovs-vswitchd --pidfile --detach
Since I have a number of other servers requiring the same treatement, the openvswitch distribution comes
with the meta files necessary for creating suitable Debian packages. The packages can be copied to
the other servers and installed. The packages end up in the parent directory of the source distribution.
Part of the packaging process involves running a series of unit tests, which appear to take more time than the build itself. The
readme files explain options to turn those tests off.
cd /usr/src/openvswitch-1.10.0
apt-get install fakeroot debhelper
apt-get install autoconf automake python-all python-qt4 python-zopeinterface python-twisted-conch
dpkg-checkbuilddeps
make distclean
fakeroot debian/rules binary
apt-get install module-assistant
module-assistant auto-install openvswitch-datapath
When installing the .deb packages, auto-start stuff should automatically be dealt with, unlike the manual start stuff I performed at the beginning of this
document.
There are a number of .deb packages, but only the following are really needed:
- openvswitch-common_1.10.0-1_amd64.deb
- openvswitch-switch_1.10.0-1_amd64.deb
- openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb
These are secondary files. The controller is a simple OpenFlow controller. ovsdbmonitor is a GUI tool for remotely viewing OVS databases and OpenFlow flow tables.
- openvswitch-controller_1.10.0-1_amd64.deb
- ovsdbmonitor_1.10.0-1_all.deb
- python-openvswitch_1.10.0-1_all.deb
To install on another server, copy the .deb files over and then:
apt-get install uuid-runtime
dpkg -i openvswitch-common_1.10.0-1_amd64.deb
dpkg -i openvswitch-switch_1.10.0-1_amd64.deb
dpkg -i openvswitch-datapath-module-3.2.0-4-amd64_1.4.2+git20120612-9_amd64.deb
I recieved errors like:
FATAL: Module openvswitch not found.
Inserting openvswitch module ... failed!
Starting ovsdb-server.
Configuring Open vSwitch system IDs.
FATAL: Module openvswitch not found.
Inserting openvswitch module ... failed!
I ran the following commands to get things operational:
depmod
modprobe openvswitch_mod
dpkg -i openvswitch-switch_1.10.0-1_amd64.deb
echo openvswitch_mod >> /etc/modules