Playing with Openvswitch.

I’ve been playing with openvswitch a little bit this evening. Here are some notes that I took for a very basic configuration on Ubuntu 12.04.

Documentation References

Install, Update, and Configure Ubuntu

Installed Ubuntu 12.04 from a thumb drive.

apt-get -y install vim openssh-server lvm2
apt-get -y update
apt-get -y dist-upgrade

apt-get -y purge network-manager

echo "auto eth0
iface eth0 inet static
gateway" >> /etc/network/interfaces

/etc/init.d/networking restart 

Install Openvswitch

apt-get -y install openvswitch-datapath-source bridge-utils
module-assistant auto-install openvswitch-datapath
apt-get -y install openvswitch-brcompat openvswitch-common 

Test Openvswitch Install

service openvswitch-switch status
ovs-vsctl show 

Configure Openvswitch

The first thing that we’ll want to do is enable bridging compatibility.

Bridging will act as the interface between the hypervisor physical network cards and the virtual machines. This will be controlled by openvswitch.

sed -i 's/# BRCOMPAT=no/BRCOMPAT=yes/g' /etc/default/openvswitch-switch
service openvswitch-switch restart 

Once the bridging compatibility has been enabled and openvswitch restarted, we’ll need to define a bridging interface and add the physical nic to the bridge.

/ NOTE: This should be performed on the physical computer as it will bring down the networking to the host /

sed -i 's/eth0/br0/g' /etc/network/interfaces
echo "auto eth0
iface eth0 inet manual
up ip link set eth0 up" >> /etc/network/interfaces
ovs-vsctl add-br br0
ovs-vsctl add-port br0 eth0
/etc/init.d/networking restart

At this point, the networking should be working again and you should be able to log into the host remotely.