OpenvSwitch Configure from Packages and Attaching to a Floodlight OpenFlow Controller

OpenvSwitch Configure from Packages and Attaching to a Floodlight OpenFlow Controller

Open Vswitch Lab

OpenvSwitch Configure from Packages and Attaching to a Floodlight OpenFlow Controller

OpenvSwitch Configure from Packages and Attaching to a Floodlight OpenFlow Controller: Couple folks have asked about installing OpenvSwitch from packages on Ubuntu 12.04 as opposed to from source. The default repos have v1.4 up so almost at the latest v1.4.1. OVS will be the de facto vSwitch in the hyper-scale providers in the future in my opinion. As Vmware’s Nicira acquisition merges it will percolate into the enterprise. So its a good time to learn software switching and OVS is the best platform to start with.

OpenvSwitch Configure from Packages

This is currently not building on Ubuntu 13.04 w/ 3.8.0-29-generic. Give installing from the tarball a run. Detailed instructions are located in the INSTALL file in the root of the release. A post covering the build and overlay tunnels can be found at the following link:

Configuring VXLAN and GRE Tunnels on OpenvSwitch

If running an Ubuntu 12.x distribution the following may still work.


Verify install

Processes should look something like this


Restart OVS (probably not necessary)

You can see the version of OVS and the configuration using the following.

Add your bridge, think of this as a subnet or container for VLAN IDs if you aren’t familiar with the term. Each DPID is a separate data plane that appears as a separate switch to something like an OpenFlow controller.


Add a physical interface to your virtual bridge for connectivity off box. If you don’t script this part you will probably clip your connection as you zero out eth0 and apply it to br0. You can pop the commands into a text file and make it executable with chmod +x.


You can edit the /etc/network/interfaces file for it to be persistent through reboots or use ifconfig from the CLI but it will be temporary. If learning, just use ifconfig, it is good to know Linux networking for the future.


This will add the physical port (eth0) to the logical bridge (br0).

Once you edit the file restart networking. *This will cut you off but you should be able to attach to the br0 (bridge) address you added on the same subnet.


After you restart networking your ifconfig and route -n should look something like this.

Manually using ifconfig if you didn’t edit /etc/network/interfaces

Zero out your eth0 interface and slap it on the bridge interface
(warning will clip you unless you script it)

Show the bridging tables


Connect OpenvSwitch to the the OpenFlow Controller

Attaching to a Floodlight OpenFlow Controller

http://networkstatic.net/floodlight-openflow-controller-screencast-with-hp-switches/

Output from the Floodlight controller:

Any who, plug away with a hypervisor and build the next-gen of computing! No need to wait on someone to hand it to us. Get rich while you are at it :0 Make it rain and stuff.


Add KVM and build instances using taps from OVS:
http://networkstatic.net/installing-openvswitch-on-ubuntu-11-10-with-kvm/
Or Quantum and OpenStack for the more adventurous:
http://networkstatic.net/openstack-essex-and-quantum-installation-using-openvswitch-from-scratch/

  1. Robert ChenRobert Chen06-27-2012


    Brent,

    Thanks for the nice step by step instruction.

    I did this:
    Edit /etc/default/openvswitch-switch and change brcompat from no to yes

    Change from:
    #BRCOMPAT=no
    TO and uncomment by removing the #:
    BRCOMPAT=yes and try to restart the OVS, I got this:
    stack@openstack1:~$ sudo /etc/init.d/openvswitch-switch restart
    * ovs-brcompatd is not running
    * Killing ovs-vswitchd (5998)
    * Killing ovsdb-server (5989)
    FATAL: Error inserting brcompat_mod (/lib/modules/3.2.0-23-generic/kernel/brcompat_mod.ko): Invalid module format
    * Inserting brcompat module
    Module has probably not been built for this kernel.
    For instructions, read
    /usr/share/doc/openvswitch-datapath-source/README.Debian
    FATAL: Error inserting brcompat_mod (/lib/modules/3.2.0-23-generic/kernel/brcompat_mod.ko): Invalid module format
    * Inserting brcompat module

    Do you know why? I tried to read the README suggested in the message and can not make sense out of it. Thanks.

    Robert

    • Brent SalisburyBrent Salisbury06-27-2012


      Hi Robert. Add the bridge-utils package e.g. “apt-get install bridge-utils”. Let me know if that works for you.
      It is in the tutorial with “apt-get install openvswitch-datapath-source bridge-utils”. I just verified the install last night so I want to make sure that is the problem so let me know. Thanks for the comment and let’s see if that fixes you up!
      Thanks,
      -Brent

      • MarcelMarcel07-19-2012


        Hy Brent,

        your site is very good ;)

        I have the same problem as Robert, but the bridge-utils are installed.

        Have you any idea?

        Thanks
        Marcel

        • MarcelMarcel07-19-2012


          Okay,
          a restart of the pc was helpful.

          thanks

    • Siebe YtsmaSiebe Ytsma09-09-2012


      I happened to run into the same problem. The brcompat module failed to load.

      Luckily the syslog messages informed me with the message:
      brcompat_mod: exports duplicate symbol br_should_route_hook (owned by bridge)

      So the bridge module was already loaded and prevented the brcompat module from loading.

      The solution is obvious … rmmod bridge and loading brcompat from there on is flawless.

  2. JeremeJereme09-30-2012


    Hey Brent, the article was very informative and I was able to connect to my floodlight controller with ease. However, when I restart my computer and try to connect to the controller again I get this error:
    jereme@jereme-OptiPlex-755:~$ sudo ovs-vsctl set-controller br11 tcp:192.17.237.12:6633
    Sep 30 11:29:38|00002|stream_unix|ERR|/tmp/stream-unix.5820.0: connection to /var/run/openvswitch/db.sock failed: No such file or directory
    Sep 30 11:29:38|00003|reconnect|WARN|unix:/var/run/openvswitch/db.sock: connection attempt failed (No such file or directory)

    and now when I grep for ov it only results it:
    jereme@jereme-OptiPlex-755:~$ ps -ea | grep ov
    5390 ? 00:00:00 ovs-controller

    How would I get the services to be running again?
    Thanks for any help you may have,

    Jereme

    • Brent SalisburyBrent Salisbury09-30-2012


      Hi jereme, riding in a car offline other than my phone but it sounds like we need to get OVS started. Give “sudo /etc/unit.d/openvswitch-switch start” a go. That should start ovsdb and vswitchd started. Get that in your startup rc scripts. Let me know if you have any problems and I will take a look tonight. Thanks for the feedback and stopping by!

      • JeremeJereme10-01-2012


        Thanks for the quick response!
        However, when running the command you suggested, (sudo /etc/init.d/openvswitch-switch start) results in the same error as above –
        FATAL: Error inserting brcompat_mod (/lib/modules/3.2.0-29-generic/kernel/brcompat_mod.ko): Invalid module format
        * Inserting brcompat module
        Module has probably not been built for this kernel.
        For instructions, read
        /usr/share/doc/openvswitch-datapath-source/README.Debian
        FATAL: Error inserting brcompat_mod (/lib/modules/3.2.0-29-generic/kernel/brcompat_mod.ko): Invalid module format
        * Inserting brcompat module

        Please note I did not have trouble with this when I initially went through your tutorial, this is now occurring after I reboot the machine.

        • RashmiRashmi11-30-2012


          I get the same error :FATAL: Error inserting brcompat_mod (/lib/modules/3.2.0-29-generic/kernel/brcompat_mod.ko): Invalid module format
          * Inserting brcompat module
          Module has probably not been built for this kernel.

          Did anybody get this resolved? Thanks.

          • jrobertsjroberts12-19-2012


            I had this issue as well. Siebe Ytsma’s solutions seems to be correct. Check to make sure the bridge module is not loaded and remove it if it is.

            lsmod | grep bridge
            rmmod bridge

            Then restart OVS. Thanks for the great post!

  3. lenkzlenkz01-08-2013


    Jroberts, Thank you It’s work!!

  4. Brent SalisburyBrent Salisbury01-09-2013


    Thanks Jroberts, will update the post w/ that reminder.

  5. JerryJerry02-14-2013


    Hey Brent, I am at the stop where you change BRCOMPAT from no to yes, and when I do the command:
    $ sudo /etc/init.d/openvswitch-switch restart
    I get the error:
    Could not open brcompat socket. Check “brcompat” kernel module.

    Any ideas would be amazing!!

    • Brent SalisburyBrent Salisbury02-21-2013


      Hey Jerry, I totally managed to miss this comment. Sincerely apologize. In case anyone else had the question I wanted to go ahead and put out there that brcompat is being depreciated and not needed now that the OVS kernel module is upstreamed as of ~3.2 kernel .

      I guess there could be an application for a userspace use but not really sure. It should be irrelevant as long as you are using the KO module.

      Cheers,
      -Brent

  6. ETienneETienne05-05-2013


    Hi Brent,

    Many thanks for this page it was really useful, well it too me almost two days to configure and make it work anyway i’m happy that it is working. I have one question though, how come the port where floodlight is hooked up is being shown also as a host. Basically my eth2 ( uplink to floodlight) , my pc port and my vm port are being shown as hosts aswell. Is this normal ? i can’t ping them as it supposed to be because as i read the controller port doesnt allow that :/ Any ideas please ?

    Cheers
    Etienne!

  7. EtienneEtienne05-05-2013


    :) managed to post in this page now phewww :)


  8. I blog quite often and I genuinely appreciate your content.
    Your article has really peaked my interest. I will bookmark your blog and
    keep checking for new information about once a week. I opted
    in for your RSS feed too.

  9. shivashiva12-15-2013


    Hi thank you for your good step by step instructions.
    I follow the steps but when I use ovs-vsctl show command it shows the following text :

    54789b58-f44f-475d-8e72-521e4afe124f

    why is it like this? what should I do?

    • Brent SalisburyBrent Salisbury12-25-2013


      Take a look at the Bridge Table in the output of ovsdb-client dump. It is the _UUID of the Open_vSwitch table in OVSDB.

      Cheers,
      -Brent

  10. niloofarniloofar01-11-2014


    hi can OVS work on a ubuntu Virtual Machine that is installed on vmware?

  11. sagarsagar03-11-2014


    How to configure Openflow protocol on openvswitch?