CentOS 6.4 – Openvswitch installation

UPDATE: If you need help to run Open vSwitch 2.5.0 LTS have a look at a more recent post

Hi,
this post has been rewritten (reloaded?). I’ve found a little spare time to update this article. A couple months ago I wrote a post about how to install openvswitch 1.9.0 version. It was a tricky installation and I even had to create a little patch, but with the latest stable 1.10 version the installation is a piece of cake. Only 5 minutes!.

Update: I’ve checked that the following instructions allows me to build openvswitch 2.0.0 and openvswitch LTS 1.9.3

I’m showing you the steps after a clean minimal installation of CentOS. If you see  # it means that the command must be executed as root, and if you see $ the command must me executed as the ovswitch user that I’ve created.

Note that all this information is in the INSTALL.RHEL file that comes with the tar.gz file, but if you’re too lazy (like me) that’s what I’ve executed.

I’d like to thank Openvswitch creators for such a great code and Nicira Inc for the daemon scripts.

#yum install wget openssl-devel
#yum groupinstall "Development Tools"

#adduser ovswitch
#su ovswitch

$cd
$wget http://openvswitch.org/releases/openvswitch-1.10.0.tar.gz
$tar xvfz openvswitch-1.10.0.tar.gz
$cd openvswitch-1.10.0
$mkdir -p /home/ovswitch/rpmbuild/SOURCES
$cp ../openvswitch-1.10.0.tar.gz /home/ovswitch/rpmbuild/SOURCES/
$cp rhel/openvswitch-kmod.files /home/ovswitch/rpmbuild/SOURCES/
$rpmbuild -bb rhel/openvswitch.spec
$rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec
$exit

#yum localinstall /home/ovswitch/rpmbuild/RPMS/x86_64/kmod-openvswitch-1.10.0-1.el6.x86_64.rpm
#yum localinstall /home/ovswitch/rpmbuild/RPMS/x86_64/openvswitch-1.10.0-1.x86_64.rpm

Let’s start the daemon!

#/etc/init.d/openvswitch start
/usr/share/openvswitch/scripts/ovs-lib: line 49: /var/log/openvswitch/ovs-ctl.log: No such file or directory
tee: /var/log/openvswitch/ovs-ctl.log: No such file or directory

/etc/openvswitch/conf.db does not exist ... (warning).
Creating empty database /etc/openvswitch/conf.db [ OK ]
Starting ovsdb-server [ OK ]
Configuring Open vSwitch system IDs [ OK ]
Inserting openvswitch module [ OK ]
Starting ovs-vswitchd [ OK ]
Enabling remote OVSDB managers [ OK ]
Enabling gre with iptables [ OK ]

CentOS 6.4 kernel comes with a openvswitch kernel module but the kmod-openvswitch installation will deal with it and load the new module. Let’s check what module is loaded:

# modinfo openvswitch
filename: /lib/modules/2.6.32-358.el6.x86_64/weak-updates/openvswitch/openvswitch.ko
version: 1.10.0
license: GPL
description: Open vSwitch switching datapath
srcversion: 33CB73C0C5A83F3CD6B7B0F
depends: 
vermagic: 2.6.32-358.6.2.el6.x86_64 SMP mod_unload modversions 
parm: vlan_tso:Enable TSO for VLAN packets (int)

Great! The installation is quick and clean.

P.S: If you need information about openvswitch installation for 1.9 version let me know (use a comment or contact me) because I’ve retired the old post info and I have a copy.

Advertisements

38 thoughts on “CentOS 6.4 – Openvswitch installation

  1. Roni Tan says:

    Hi,

    Thank you for the install guide.
    I am having problem when following your instruction.
    Upon building the rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec, it fails with errors:

    error: Installed (but unpackaged) file(s) found:
    /etc/depmod.d/openvswitch.conf

    RPM build errors:
    Installed (but unpackaged) file(s) found:
    /etc/depmod.d/openvswitch.conf

    Any help will be appreciated.

    Thank you.

    Like

    • n40lab says:

      Hi,
      I’m sorry that you’ve a problem with the guide but I really appreciate your comment to improve it.

      As I’ve used the git version, maybe something has changed. I’ve downloaded the source code again an when executing make dist the tar.gz generated is
      openvswitch-1.10.90.tar.gz. I’ve tried to rpmbuild the openvswitch with that source and I got the same error that you’ve found. It seems that the spec file has been
      updated. I don’t want to use the GIT version but I couldn’t compile the stable version. I’ll try again, maybe this time works.

      I’m trying to figure out how to solve it, I’ve read here http://comments.gmane.org/gmane.network.openvswitch.devel/19542 that an openvswitch module is already
      in CentOS 6.4, maybe my guide is useless after all? but I guess I need the openvswitch utilities and bin files. I’ll test it in my lab.

      In the meantime I can send you the spec file that works for me in an email (just reply to this post if you want the file), it builds the rpm but I can guarantee it would work.

      Regards,

      Miguel

      Like

      • Robert says:

        The installation worked perfect for me. I’m running CentOS 6.4 under VMWare Workstation 9 and experienced no issues.

        Like

      • Vincenzo Riccobene says:

        Hi, I have exactly the same problem.
        Could you send also to me the spec file?
        Tnx in advance.

        Like

      • n40lab says:

        Hi Vincenzo,
        sorry being late, very busy these days. Have you tried to install the 1.9.3 LTS version or the latest stable 2.0.1 version? What’s exactly the problem you’re having?. I’m afraid the spec file is a bit old. Also maybe you can check if my post about CentOS 6.5 can help you in any way…

        Cheers!

        Like

    • mclueppers2 says:

      Hi,

      I solved this problem by adding the following 3 lines to the .spec file for the kmod. You can place it after %install and %clean statements.

      %files
      /etc/*
      /lib/*

      Like

  2. Bui Manh tien says:

    Hello,
    I have a problem when I run ./boot.sh. This is message:
    ./boot.sh
    configure.ac:15: error: Autoconf version 2.64 or higher is required
    configure.ac:15: the top level
    autom4te: /usr/bin/m4 failed with exit status: 63
    aclocal: autom4te failed with exit status: 63
    autoreconf: aclocal failed with exit status: 63

    I checked autoconf version:
    [root@64 openvswitch]# autoconf -V
    autoconf (GNU Autoconf) 2.63
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv2+: GNU GPL version 2 or later

    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Can you help me?

    Thank.

    Like

  3. gstanden says:

    Dear N40Lab or M. Cabrerizo,
    Thank You, Thank You, Thank You for this Guide. I am a Sr. Engineer Oracle and I needed to install openvswitch on CentOS 6.4. I had followed your guide (without brcompat) but found that bonded ports on my openv switches were not working properly and also were not listed at all when running “ovs-appctl bond/show” or “ovs-appctl bond/show bondX” where X=0 or X=1. After completing your final section of this post to include BRCOMPAT, my bondX information is showing correctly. For example, here is the code that I use to create a bonded interface between 2 openv switches:
    ### Code Begin ###
    ovs-vsctl add-bond sw2 bond0 sw2p2 sw2p1 trunks=322
    ovs-vsctl add-bond sw1 bond1 sw1p2 sw1p1 trunks=322
    ovs-vsctl set interface sw1p1 type=patch options:peer=sw2p1
    ovs-vsctl set interface sw2p1 type=patch options:peer=sw1p1
    ovs-vsctl set interface sw1p2 type=patch options:peer=sw2p2
    ovs-vsctl set interface sw2p2 type=patch options:peer=sw1p2
    ovs-vsctl set port bond1 bond_mode=active-backup other_config:bond-detect-mode=miimon other_config:bond-miimon-interval=100
    ovs-vsctl set port bond0 bond_mode=active-backup other_config:bond-detect-mode=miimon other_config:bond-miimon-interval=100
    ### Code End ###
    When I go to check their status I get the following (correct output now thanks to following you post for brcompat integration).
    ### Begin Snip ###
    root@lw-virbox1:~# ovs-appctl bond/show
    —- bond0 —-
    bond_mode: active-backup
    bond-hash-basis: 0
    updelay: 0 ms
    downdelay: 0 ms
    lacp_status: off

    slave sw2p1: enabled
    may_enable: true

    slave sw2p2: enabled
    active slave
    may_enable: true

    —- bond1 —-
    bond_mode: active-backup
    bond-hash-basis: 0
    updelay: 0 ms
    downdelay: 0 ms
    lacp_status: off

    slave sw1p1: enabled
    active slave
    may_enable: true

    slave sw1p2: enabled
    may_enable: true

    root@lw-virbox1:~#
    ### End Snip ###
    Previously, before I had followed your Guide for brcompat inclusion, I got null output for the command:
    ### Begin Snip ###
    root@lw-virbox1:~# ovs-appctl bond/show bond0
    no such bond
    ovs-appctl: ovs-vswitchd: server returned an error
    ### End Snip ###
    Thanks Again!! Your post is the ONLY one on setting up openvswitch on CentOS 6.4 that I was able to find that actually works perfectly!

    Like

    • n40lab says:

      First of all I want to thank you for your feedback, I’m glad that the guide has helped you with CentOS 6.4 and openvswitch and it encourages me to write new posts if they are useful. Also thank you for sharing your configuration tips for bonding, it’s great to have your explanations about this topic in this post as it will help others to know that brcompat is needed for bonding.

      Like

  4. Arthur says:

    You have said something about 1.9 🙂
    I think it would be great to make article about this version, since it is LTS.

    Like

  5. Cody says:

    Your instructions worked perfectly on a fresh CentOS 6.4 without any errors. About the only thing I can think of is to remind users to create the log file that openvswitch uses but I’m not sure why that step isn’t taken care of in the spec file. Thanks again!

    Like

  6. ITG says:

    Sir you are a champion.. I had no problems, ovs up and running in less than 10 minutes. A word to those who don’t want to wait on the dev tools, customize your install to include those features.

    Like

  7. Philip Ho says:

    Dear Miguel,

    I have got the following compilation error when attempting to build the user module. My system is CentOS 6.4.

    rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec
    error: line 25: Dependency tokens must begin with alpha-numeric, ‘_’ or ‘/’: BuildRequires: %kernel_module_package_buildreqs
    [root@sdn-ctl1 openvswitch-1.10.0]#

    BR,
    Philip

    Like

    • n40lab says:

      Sorry for being so late answering you.

      What’s the content of your openvswitch-kmod-rhel6.spec? maybe there’s a typo in line number 25.

      Regards,

      Miguel

      Like

      • Philip Ho says:

        Miguel,

        Oh, i didn’t change anything. It is shown below:

        BuildRequires: %kernel_module_package_buildreqs

        Thanks!!!!
        Philp

        Like

  8. Mark says:

    For others fighting with “error: line 25: Dependency tokens must begin with alpha-numeric, ‘_’ or ‘/’: BuildRequires: %kernel_module_package_buildreqs” on RHEL6, installing the redhat-rpm-config package resolves it. I found the answer under “Caveats” in http://downloads.linux.hp.com/SDR/psp/suse/11.2/i386/8.50/hp-tg3-3.99p-9.src.txt :

    “3. The rpmbuild will fail if the redhat-rpm-config package is not installed
    because it cannot resolve the %kernel_module_package_buildreqs macro. The
    error will be similar to the following:

    error: line xx: Dependency tokens must begin with alpha-numeric,’_’or’/’: Build
    Requires: %kernel_module_package_buildreqs”

    Like

  9. yairzinger says:

    Hi,
    Thank you for the guide.
    I tried to install the openvswitch on Centos 6.4, but when I try “/etc/init.d/openvswitch start” I received the following error:
    Inserting openvswitch module FATAL: Module openvswitch not found.

    What cause this error? and how can it be solved?
    Thank you.

    Like

    • n40lab says:

      Hi! I’ve never tried to do it on CentOS 5, maybe I can download the ISO version of 5.11 but probably the kernel version is too old or hasn’t been backported to support openvswitch main features. If you really need openvswitch on 5.X let me know and I’ll try to prepare a test machine when I’ve some free time.

      Cheers

      Like

      • Attila Ruzsinszky says:

        Hi,

        I’m in the rpmbuild test phase now! 😉 It seems working.
        What do you thing is that any problem between CentOS 6.8 (which is running an LXC container Under Ubuntu 16.04 for making rpm builds) and RHEL 6.4?

        Thanks for your blog about COS 6.8 and OVS 2.5.0!

        Like

      • n40lab says:

        Well I guess that a package for CentOS 6.8 would not work with RHEL 6.4 as libraries are older… 😕 I can help you to compile it for RHEL 6.4 if that machine can download packages from a RHN subscription I can chat with you and solve errores… I could even download CentOS 6.4 if you want and try… Tell me how can I help! Cheers

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s