Installing and Configuring OpenvSwitch on Ubuntu 12.04 (Precise Pangolin)

Installing and Configuring OpenvSwitch on Ubuntu 12.04 (Precise Pangolin)

Installing and Configuring OpenvSwitch on Ubuntu 12.04 (Precise Pangolin)
Updates
Installing and Configuring OpenvSwitch on Ubuntu 12.04 (Precise Pangolin)

Quick install how to for Installing and Configuring OpenvSwitch on Ubuntu 12.04 (Precise Pangolin) with the nightly OVS build. Before I start, I must point out the great progress the dev team has done in such a short time. All of the old gotchas in earlier releases on implementation are long gone. I am going to revisit the KVM integration in a few days as some of the inconsistencies for bringing up TAPs into hypervisors should be getting some consensus for provisioning.


The announcement of the inclusion of OpenvSwitch into the mainline Linux kernel, coupled with some KVM enhancements to provide VLAN tagging, LACP, QoS, sFlow etc, is making some of us excited ,and others very nervous.

For those familiar with the build you can just paste the following in your bash shell as root. To walk through the install skip the following snippet. The installation is extensively documented in the INSTALL file in the root of the tarball.

System Preperation

Install dependencies:

Download the OVS tarball Note: you can also pull from the git repository but that is bleeding edge and depending on kernel releases it may need some massaging.

Compiling Open vSwitch From Source

Open vSwitch Configuration

Run the following commands, note some dashes are two ‘- -‘ e.g. – -remote=db & – -private-key

Start ovsdb-server, this stores the config into a file that is persistent even after restarts.

If they are not there try loading again and check your path to the kernel module.

At this point you have a fucntioning vanilla OVS install. Output should look something like this.

Configure Linux Networking

I have one NIC (eth1) on the same LAN segment/network/vlan.
We are attaching eth1 to br1 and applying an IP to the bridge interface.
We are attaching an IP to br2. br2 is the island that we are building a tunnel for hosts to connect on.

If you have issues getting the bridge built you may need to kill the OVS processes and restart them depending on your step order.

Your Linux routing table should now look something like this:

You can put the following into a text file and give it execute permissions with “chmod +x filename” and then run it “./filename”. If your network settings are right it should flip the IP to the bridge and not cut you off. Keyword “should” so have a way to get to the box if you cut yourself off.

If you want your networking to be persistent over restart you can adjust /etc/network/interfaces similar to the following template.


Thanks for stopping by.

  1. MattMatt07-11-2012


    Remove bridge-utils removes:

    The following packages will be REMOVED:
    bridge-utils libvirt-bin python-vm-builder qemu qemu-common qemu-kvm
    ubuntu-vm-builder

    And I am quite sure I need some of those packages for my VM’s. Namely the ubuntu-vm-builder.

    Are you sure that removing bridge-utils and related packages won’t crash my virtual machines? Or not allow kvm to work correctly?

  2. Brent SalisburyBrent Salisbury07-11-2012


    Hi Matt. I will test in a bit. That’s a good point. ‘rmmod bridge’ will pull the Linux bridging module to get you going. I will get back to you after work.

  3. Arshad AdamArshad Adam08-17-2012


    Hi,

    I had a question. Why are we stopping the network-manager in this installation? Should we start the network-manager after the installation is done ?

  4. Brent SalisburyBrent Salisbury08-17-2012


    I tend to just because it can get in the way with some things. If you install Ubuntu Server addition it wouldn’t be installed anywho. /etc/network/interfaces is the file the loads the config on a base intall. Not required but may get in the way.
    Cyas.

  5. Karthik SharmaKarthik Sharma04-05-2013


    I have one NIC (eth1) on the same LAN segment/network/vlan.
    We are attaching eth1 to br1 and applying an IP to the bridge interface.
    We are attaching an IP to br2. br2 is the island that we are building a tunnel for hosts to connect on.

    Does the above mean that before adding bridges using ovs-vsctl you have one ethernet interface eth1 with ip 192.168.1.1? I have a similar situation.but after the operations you suggested I can ping host and other machines in the host network but not google. (maybe DNS is trashed.??) any thoughts?

  6. kjinkjin04-14-2013


    stop and purge the network-manager could become a nightmare. In my case, i lost network access completely. it toke me hours to recover from the disaster.

  7. F6F604-29-2013


    Hi Brent,

    I am running my ovsdb-server on the TCP port and not on the unix server domain socket as discussed above. The problem I am facing is , I am unable to launch any VM. It is giving error “Connection Refused”. Any input?

    Thnx

  8. MichaelMichael05-27-2013


    Hi,

    I am trying to install openvswitch on ubuntu using this tutorial but I am struck in the COMPILING OPEN VSWITCH FROM SOURCE section at the following command:

    ./configure –with-linux=/lib/modules/uname -r/build

    It says -r/build option doesn’t exist. When I remove the -r/build part from above command, it says no such directory exists. When I looked into the lib folder, there is no directory named modules inside the lib folder.

    I am trying it on Ubuntu 12.10.

  9. Brent SalisburyBrent Salisbury05-27-2013


    Hi Michael, on the road at the moment but I copy and pasted the build the other day.

    Wondering if it is a syntax formatting problem in the post maybe.

    There are backticks in the syntax. Try this:
    ./configure –with-linux=/lib/modules/uname -r/build
    .

    apt-get install -y git python-simplejson python-qt4 python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential git pkg-config linux-headers-uname -r
    git clone git://openvswitch.org/openvswitch
    cd openvswitch
    ./boot.sh
    ./configure –with-linux=/lib/modules/uname -r/build
    make && make install
    insmod datapath/linux/openvswitch.ko
    touch /usr/local/etc/ovs-vswitchd.conf
    mkdir -p /usr/local/etc/openvswitch
    ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
    ovsdb-server /usr/local/etc/openvswitch/conf.db \
    –remote=punix:/usr/local/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 –log-file
    ovs-vsctl –no-wait init
    ovs-vswitchd –pidfile –detach
    ovs-vsctl show

    http://networkstatic.net/configuring-vxlan-and-gre-tunnels-on-openvswitch/

    Just lemme know if that doesn’t work and I will verify it tonight.
    Regards,
    -Brent

    • MichaelMichael05-28-2013


      It’s the same error coming up. I am using Ubuntu 12.10.

    • MichaelMichael05-28-2013


      The command that worked for me is from opemvswitch Install readme file:

      ./configure –with-linux=/lib/modules/uname -r/build

    • bustambustam04-05-2014


      Hi,
      I am trying to install OpenVSwitch in the physical machine. Previously I have used the GENI testbed and in GENI VMs the above mentioned steps worked without any errors. But when I am trying to install the OVS in user space, then I am getting error when I am trying to “make”.
      Then I tried with OVS-2.1.0., well with this everything is fine up to “make && make install”, when I am trying to insert the modules in the kernel its giving some error, (Unknown symbol in module). Do I need to insert the modules in the kernel? How to resolve this problem.
      Thank you for your time.
      Regards
      Bustam

      • Brent SalisburyBrent Salisbury04-07-2014


        Hi Bustam,

        $ ./configure –with-linux=/lib/modules/uname -r/build
        $ make && make install
        $ make modules_install
        $ lsmod | grep open
        If the kernel modules aren’t loaded try
        $ modprobe openvswitch

        Ive noticed insmod doesn’t do the trick anymore but haven’t had time to poke around. I know this works on Fedora 19/20. Course you can install from package with yum / apt. Fedora is v2.x+. On ubuntu you can probably find a back port to 2.0 i would hope.

        Thanks!
        -Brent

  10. MichaelMichael05-28-2013


    Hi,

    I am trying to install Openvswitch on Ubuntu 12.10 and when I used the second command of installing dependencies i.e.:

    apt-get install python-simplejson python-qt4 python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential git pkg-config

    I got the following error:

    Setting up openvswitch-pki (1.4.3-0ubuntu2.1) …
    /usr/local/bin/ovs-pki: /usr/local/var/lib/openvswitch/pki already exists and –force not specified
    dpkg: error processing openvswitch-pki (–configure):
    subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of openvswitch-controller:
    No apport report written because the error message indicates its a followup error from a previous failure.
    openvswitch-controller depends on openvswitch-pki (= 1.4.3-0ubuntu2.1); however:
    Package openvswitch-pki is not configured yet.

    dpkg: error processing openvswitch-controller (–configure):
    dependency problems – leaving unconfigured
    Errors were encountered while processing:
    openvswitch-pki
    openvswitch-controller
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    What could be possibly wrong?

    Thank you.

  11. SimonSimon05-28-2013


    Hi,

    When I am trying to run this command:

    sudo insmod datapath/linux/openvswitch.ko

    It’s saying the following error:

    ~/ovs-vxlan$ sudo insmod datapath/linux/openvswitch.ko
    insmod: error inserting ‘datapath/linux/openvswitch.ko': -1 File exists

    Also, when I try to run sudo lsmod | grep br command, I am getting this output:

    bridge 90447 0
    stp 12977 1 bridge
    llc 14553 2 bridge,stp

    Can you tell me how to fix it?

  12. jUNjUN06-29-2013


    Thanks for your documentation above.. However I have Question.. May I leave my question ont this?

    My Questions are blow..
    [ 379.578038] openvswitch: Unknown symbol gre_del_protocol (err 0)
    [ 379.578069] openvswitch: Unknown symbol gre_add_protocol (err 0)

    Because of this, I can not insert module… I am using Ubuntu12.04 LTS (Server) which is downloaded on wetsite..

    Please let me know.. Help me..

  13. Brent SalisburyBrent Salisbury07-01-2013


    Hi Jun, I am getting the same thing. I noticed Ben Pfaff posted the same occourance last week. He is one of the lead devs on OVS so I would imagine there is a bug open but if not checking the OVS dev LSV might be warranted. I haven’t dropped back to an older build but may try.

    http://comments.gmane.org/gmane.network.openvswitch.devel/22049

    Cheers.
    -Brent

  14. jUNjUN07-01-2013


    Thanks for your url-link ….. It was helpful for me… so much

    Also, I have found the answer from http://git.openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL;hb=HEAD

    % make modules_install
    % /sbin/modprobe openvswitch
    is same thing..

    Thanks alot.

    • Brent SalisburyBrent Salisbury07-03-2013


      I wasn’t paying attention and missed kernel 3.9.8. I’d say within a week or two things will catch up to the new release. In the meantime you can pull the binary or use an older kernel.

      Cheers,
      -Brent

  15. IlyaIlya07-30-2013


    Hi! I’ve got a problem with ovsdb-server command. It rises an error:

    ovsdb-server: “db:Open_vSwitch,manager_options”: invalid syntax

    What is wrong with my installation? I have rechecked manual, the syntax seems to be correct.

  16. IlyaIlya07-30-2013


    By the way, I use Ubuntu 12.04 server. Sorry for double comment.

  17. mamtamamta10-04-2013


    Hi,
    I am facing an issue. When my ovs try to connect to floodlight , there is no any problem.But in case of opendaylight,it tries to connect to it regularly, but fails. Can u please suggest the reasons?

  18. DaveDave10-08-2013


    Hi,
    Excellent installation guide, thank you!
    I cloned the latest openvswitch git repo, but I’m getting an error while trying to do:
    ‘sudo insmod datapath/linux/openvswitch.ko’

    From /var/log/syslog:
    ‘Oct 8 10:48:38 DavGDev kernel: [ 4279.417176] openvswitch: Unknown symbol crc32c (err 0)’

    I’m using Ubuntu12.04LTS:
    ‘Linux DavGDev 3.2.0-54-generic-pae #82-Ubuntu SMP Tue Sep 10 20:29:22 UTC 2013 i686 i686 i386 GNU/Linux’

    I had the missing gre symbol and fixed it by doing:
    ‘sudo modprobe gre’
    but I don’t know which module, if any, will fix crc32c symbol…

    Any ideas?

    Thanks,
    Dave

    • Gursharan SinghGursharan Singh01-06-2014


      were you able to fix it ?

  19. DavidDavid10-10-2013


    Hi,
    when i try to do:

    ovs-vsctl –no-wait init

    It says:

    2013-10-10T13:41:06Z|00002|reconnect|WARN|unix:/usr/local/var/run/openvswitch/db.sock: connection attempt failed (No such file or directory)
    ovs-vsctl: unix:/usr/local/var/run/openvswitch/db.sock: database connection failed (No such file or directory)

    So i have done:

    ps -Af | grep ovsdb-server

    to check the daemon ann it says:

    root 28570 28553 0 15:20 ? 00:00:00 ovsdb-server
    root 28663 28650 0 15:22 pts/3 00:00:00 grep –color=auto ovsdb-server

    What i should do? Can you help me?
    Thank you very much!

    • Brent SalisburyBrent Salisbury10-21-2013


      Hi David, give installing from tarball a shot and see if that improves the errors and let me know. If not ping me on IRC.
      Cheers,
      -Brent

  20. Brent SalisburyBrent Salisbury10-21-2013


    I ran into issues building from source on Ubuntu 13.04+ in the past week or so. The specific error is: ### “db:Open_vSwitch,manager_options : invalid syntax” ###

    For now I pulled cloning from the how-to and opt for the tarball. If you want to pull from git use:
    git clone git://git.openvswitch.org/openvswitch

    Cheers,
    -Brent

  21. saisai10-21-2013


    Hi Brent,

    Thank you for the post. This post helped me in setting up openvswitch on my linuxbox.
    Now my switch node has 4 interfaces. 1 to controller and other 3 to hosts.

    This is running on my controller
    ./pox.py openflow.of_01 –address=10.1.2.2 –port=6633 log.level –DEBUG misc.of_tutorial

    On the switch:

    ovs-vsctl add-br br1
    ovs-vsctl add-port br1 inf002
    #inf002 is the interface on Switch connecting to the controller node
    # remove the IP of inf002 and put it on the newly created br1 interface pointing to controller
    ifconfig inf002 0
    ifconfig br1 10.1.2.1 netmask 255.255.255.0

    ovs-vsctl set-controller br1 tcp:10.1.2.2:6633

    This made the connection to the controller. The log said connected at the controller screen with the DPID.

    Now I am unsure about the hosts facing configuration of the br interface on switch. Please help.

  22. hakimhakim02-14-2014


    Hi Mr Brent,

    When I am trying to run this command:

    sudo insmod datapath/linux/openvswitch.ko

    It’s saying the following error:
    insmod: error inserting ‘datapath/linux/openvswitch.ko': -1 Unknown symbol in module

    can u help me to fix it ?
    thx

    • G8XSUG8XSU02-14-2014


      Which version of openVswitch are you trying to install ?
      post your ovs version, kernel version
      and output of “dmesg |tail ” when you are trying to do insmod.

      • hakimhakim02-15-2014


        Hi G8XSU, thx for ur attention.
        I try to install OPenVSwitch-2.0.0 on VirtualBox (Ubuntu-12.04-Desktop-i386) .
        I used 3.2.0-58-generic-pae

        This is the output when i wrote ‘sudo dmesg |tail’
        amha@amha-VirtualBox:~/openvswitch-2.0.0$ sudo dmesg |tail
        [ 20.100152] fb0: VESA VGA frame buffer device
        [ 21.269151] init: anacron main process (802) killed by TERM signal
        [ 22.204054] init: plymouth-upstart-bridge main process (498) killed by TERM signal
        [ 28.168183] eth0: no IPv6 routers present
        [ 707.476130] openvswitch: Unknown symbol gre_del_protocol (err 0)
        [ 707.476130] openvswitch: Unknown symbol gre_add_protocol (err 0)
        [ 707.476130] openvswitch: Unknown symbol crc32c (err 0)
        [ 1291.512179] openvswitch: Unknown symbol gre_del_protocol (err 0)
        [ 1291.512179] openvswitch: Unknown symbol gre_add_protocol (err 0)
        [ 1291.512179] openvswitch: Unknown symbol crc32c (err 0)

        • G8XSUG8XSU02-15-2014


          sudo modprobe gre
          sudo modprobe crc32c
          :)

          • hakimhakim02-18-2014


            still error (not work) :(

  23. esperertulipesperertulip02-24-2014


    I have just tried to install the openvswitch on the ubuntu 12.04.My ubuntu version is 12.04.4,I have tried openvswitch 1.9.*,openvswitch1.10.0,when I make it,the make program report error:”
    /opt/openvswitch-1.9.3/datapath/linux/actions.c:104:2:error:too few arguments to function ‘_vlan_hwaccel_put_tag’
    include/linux/if_vlan.h:236:31:note:declared here
    /opt/openvswitch-1.9.3/datapath/linux/actions.c:In function ‘push_vlan':
    /opt/openvswitch-1.9.’3/datapath/linux/action.c:124:2:error:too few arguments to function ‘_vlan_hwaccel_put_tag’
    include/linux/if_vlan.h:236:31:note:declared here
    the error reported by installing openvswitch 1.10.0 is the same.

  24. leenaleena04-22-2014


    I am facing issues while installing openvswitch any versions…even after complete cleanup and things

    db:Open_vSwitch,manager_options”: Invalid Syntax

    Tried several installations but it doesn’t worked. Did anyone face issues??

  25. Akash RajguruAkash Rajguru04-23-2014


    Hi Brent,

    i just want to ask you that , can we configure OVS(OpenvSwitch) or any openFlow switch act as a router. and if yes how ?
    i am doing my final semester university project on SDN , where i have to create topology using some openVswitches and using SDN controller make OpenvSwitch act as a router .
    can you please share some idea on how i can achieve this Senior.

    can we configure OpenvSwitch as router ?

    thanks