Hi,
I’ve posted about this topic again in case you really need to use Openvswitch 1.9 (LTS version), it worked for me but I can’t guarantee that it’ll work for you, I only try to help. I’ve installed recently the 1.10 version as it’s easier to install.
Ok. CentOS 6.4 already has an openswitch module that you can load with: insmod openvswitch, but you’ll need the binaries to manage openvswitch.
The first thing is to install the development tools. I use the groupinstall method though it’ll install libraries and compilers that you may not need…. but it’s a quick method. I also install the EPEL repository, uml_utilities and the OpenSSL development libraries.
yum groupinstall "Development Tools"
yum install wget
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum localinstall epel-release-6-8.noarch.rpm
yum install uml_utilities openssl-devel
If you want to use the openvswitch module which comes with CentOS 6.4 and you only want to compile the tools to manage the openvswitch, let’s add an user ovswitch and switch to that user.
adduser ovswitch
cd /home/ovswitch
su ovswitch
Let’s download the files from OpenVswitch and build from the source.
mkdir -p rpmbuild/SOURCES
wget http://openvswitch.org/releases/openvswitch-1.9.0.tar.gz
tar xvfz openvswitch-1.9.0.tar.gz
cd openvswitch-1.9.0
./configure
make dist
cp openvswitch-1.9.0.tar.gz ../rpmbuild/SOURCES/
Now we are going to modify the openvswitch.spec so the openvswitch-kmod is not needed and you can install it later. Edit rhel/openvswitch.spec and remove openvswitch-kmod from the Requires lines. Finally let’s build the rpm file.
rpmbuild -bb rhel/openvswitch.spec // If building operation succeded just exit
exit
Using our root account we’ll install the daemons and the utilities. Thanks to Nicira, Inc for the start/stop daemons.
yum localinstall /home/ovswitch/rpmbuild/RPMS/x86_64/openvswitch-1.9.0-1.x86_64.rpm
Check if openvswitch tools are ready, and if it works let’s start the service and configure to start at boot
ovs-vsctl -V
service openvswitch start
Starting ovsdb-server [ OK ]
Configuring Open vSwitch system IDs [ OK ]
Starting ovs-vswitchd [ OK ]
chkconfig openvswitch on
End of part one.
Ok. As far as I know If you still need the bridge compatibility: brcompat, you’ll need to compile the module…
Compilation will show errors about ‘redefinition of…’. As this link suggests I’ve created a patch that comments the lines that prevents compilation but I can’t guarantee that it has no secondary effects and this is the first time I create a patch for rpm (thanks to these links: link#1, link#2). I had recently an issue when creating a port mirror, I don’t know if it was a problem with my solution but I think I should mention it.
Please download the patch and the modified spec file from my google drive shared folder and follow these instructions:
- Copy the openvswitch-1.9.0-el6.patch to the /home/ovswitch/rpmbuild/SOURCES/
- Substitute the spec file with the one downloaded inside the /home/ovswitch/openvswitch-1.9.0/rhel/
- Build the kernel module: rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec
Now as the root user install the module (it will take time be patient):
yum localinstall /home/ovswitch/rpmbuild/RPMS/x86_64/kmod-openvswitch-1.9.0-1.el6.x86_64.rpm
The new openvswitch module can’t be loaded if the bridge module is in use. If you don’t need the default bridge that is autostarted by the libvirtd daemon, remove the link that loads the bridge and the module. After that, restart the libvirtd daemon and check that the bridge module is not loaded. Warning: the default virbr0 bridge will dissapear.
rm /etc/libvirt/qemu/networks/autostart/default.xml
/etc/init.d/libvirtd restart
Now we want to prevent the original kernel module that comes with CentOS 6.4 to be loaded. Maybe there are better ways but I’ve chosen to make a backup of that module and substitute it with the new one.
cp /lib/modules/2.6.32-358.el6.x86_64/kernel/net/openvswitch/openvswitch.ko /root/
mv /lib/modules/2.6.32-358.el6.x86_64/weak-updates/openvswitch/openvswitch.ko /lib/modules/2.6.32-358.el6.x86_64/kernel/net/openvswitch/openvswitch.ko
Reboot the machine.
If you want to use the brcompat option:
- Edit the /etc/sysconfig/openvswitch file and uncomment BRCOMPAT=yes
- Start the openvswitch service: /etc/init.d/openvswitch start
- Check that the brcompat module has been loaded. I tested OpenNebula 3.8.3 with OpenVswitch and it worked with brcompat.
lsmod | grep brcompat
brcompat 5905 0
openvswitch 96981 1 brcompat
Ok… it’s a long post and maybe you don’t need the brcompat module but who knows?
Please I wish that my posts are clear and error free, I appreciate your help and feedback. Tthank you Adrian and Roni for sharing your issues and Arthur for your comment.