KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Using Open vswitch with Fedora 17

The recently released Fedora 17 comes with improved support for open vswitch.  It includes packages for installing open vswitch as well as libvirt support for managing open vswitch under KVM.  Open vswitch is an interesting project providing a multilayer software switch that provides enterprise grade virtual switching technology and the emerging and popular openflow protocol for managing networks.


open vswitch


Why open vswitch?

When it comes to virtualization open vswitch is attractive because it provides the ability for a single controller to manage your virtual network across all your servers.  It is also very useful in easily allowing for live migration of virtual machines while maintaining network state such as firewall rules, addresses and open network connections for example. This makes it scalable to large virtual networks making it especially valuable in cloud computing which is why companies like openstack and Nicira ( which was recently acquired by vmware ) have decided to support open vswitch. 

As of linux kernel 3.3 the open vswitch module has been included in the mainline kernel which speaks to its value.  There are two main components to open vswitch; a control plane in userspace for making routing decisions and a data plane for forwarding packets.  The kernel module is what is responsible for forwarding packets similar to the linux bridge module.

Virtual networking with KVM hypervisor has traditionally been done using linux bridging which performs well but is not designed for virtual networking and therefore poses some integration and management challenges.  These challenges apply not only to KVM but other linux based hypervisors as well. Open vswitch now provides in kernel support for comparable packet forwarding performance as well as allowing for scaling across a large number of servers while providing ease of management through a central controller. 



Installing open vswitch on Fedora 17

Fedora 17 now provides packages for installing the userspace components of open vswitch.  To install open vswitch under Fedora 17 simply type the following command to install open vswitch.

# yum install openvswitch

The open vswitch kernel component is already shipped with Fedora 17 and you can use the following command to confirm that your kernel is configured for supporting open vswitch.

grep OPENVSWITCH /boot/config-`uname -r`

This is usually  installed as a loadable module as shown from the snapshot below.


open vswitch kernel module


Fedora 17 also comes with a python based GUI tool for monitoring your open vswitch instances called ovsdbmonitor.  To install just type the following command.

yum install ovsdbmonitor

Below is a snapshot of the main GUI window when its launched.  You can launch by typing ovsdbmonitor at the command line or by Clicking on System Tools -> Open vSwitch DB Monitor.   This will bring up the initial window introducing the monitor. 

open vswitch gui monitor


Acknowledge by clicking OK and the main monitor window will be launched as shown below.


open vswitch main

I will take a closer look at using this tool in a follow up post.



Using open vswitch with KVM

Fedora 17 provide scripts which make it easy for getting openvswitch up and running.  First thing you need to do is run the ovs-ctl start script which loads the required open vswitch kernel module and does some other initial startup routines such as creating your open vswitch database and running daemons.

/usr/share/openvswitch/scripts/ovs-ctl start

Two daemon processes are usually started as shown from the ovs-ctl status command below:

open vswitch daemons

Next create a bridge using the open vswitch command line control tool ovs-vsctl with the following command.  The name of the bridge in my example is ovsbr0.

ovs-vsctl add-br ovsbr0

You can confirm it's created by issuing the following command.

ovs-vsctl list-br

At this point you can configure your KVM virtual machine to use your new open vswitch bridge.  I'm going to show an example using virtual machines that use libvirt for management.  The first way is to edit the libvirt xml file describing your virtual machine so that it looks like the following.

 <interface type='bridge'>
  <mac address='52:54:00:71:b1:b6'/>
  <source bridge='ovsbr0'/>
  <virtualport type='openvswitch'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

The other way of doing this ( which is my preference ) is using a tool like virt-manager to modify your network settings.  There's a hack though to setting your virtualport type to openvswitch if you use the virt-manager method.  Edit your virt-manager machine so that your network device has settings like the following in order to set your virtual port type to openvswitch.  Make sure and apply your setting so that it's written to your xml configuration file.

open vswitch virtual port

Now switch your source device type and specify your shared device to be your open vswitch bridge like shown below and make sure you apply the configuration again.

open vswitch virtual port

Your KVM virtual machine is now configured to use your open vswitch bridge.  For access to your LAN you'll have to add your physical interface to your open vswitch bridge with a command similar to the following.

ovs-vsctl add-port ovsbr0 eth0

You are now bridged to your LAN and you should have connectivity from your virtual machine to your local network.


Final thoughts

Fedora 17 makes it a lot less painful to not only get open vswitch up and running but also integrated with KVM.  Another nice feature of Fedora 17 is that you don't have to worry about open vswitch kernel module compatibility with the older linux bridge module for your KVM virtual machines *if* you're using libvirt for managing your virtual machines.  This is because the version of libvirt shipped with Fedora 17 has support for open vswitch.  Obviously this post is very distro specific but I imagine it will be similar for other recent releases of other linux distros.

Give it a try post any comments or questions you have


See Also


GRE support

Does this openvswitch version support GRE tunnel? How do you configure vlan on the vnic? via ovs-vsctl or virt-manager?

Re: GRE Support


Yes it does support GRE. See this link to feature page.

VLANs are controlled using ovs-vsctl .  Planning to do a post on vlan usage.

It seems this feature page is

It seems this feature page is only about the complet openvswitch, not the one in the kernel, which doesn't support GRE, it's not really clear. Do you succeed to create a GRE tunnel using openvswtich on Fedora??

@Ed on open vswitch GRE support

Actually I have not tested GRE only basic bridging. I've only just begun taking a serious look at open vswitch. I'll do some testing and see what features are available.


Looking forward to your post on VLANs and whether or VLANs can be looked after entirely in libvirt or not. If you're scaling up to hundreds of VLANs I can't see how using fake bridges will scale. Would be interested to hear about any large scale IaaS deployments using KVM/OVS.

The OVS in Fedora 17 does not support GRE tunnels

It uses the upstream kernel module, which does not have GRE tunneling support. To get GRE tunnel support, you would have to recompile a compatible kernel module from the Open vSwitch project itself.


i already worked with OVS, n now want to create some QoS on it.
i'm using kernel 3.2.0-27, but my QoS didn't work properly.
in my case, do i have to upgrade my kernel in 3.3...?

Adding physical drops host machine?

I've been trying for a few days to get QEMU networking and this page has got me the furthest yet... however, I'm still not there. Maybe I've missed something along the way, but I think I've followed the above recipe for the letter...

When I get to the point of attaching the switch to the main eth0 network controller, I find I gain access to the main network from the VM I have configured, but then at the same time, I lose connectivity to the host machine (which is kind of important).

Is there no way to set up the switch to tap the eth0 controller, rather than taking it over entirely? Or is there another step needed in order to reconfig the host to talk via the vSwitch?

Adding physical drops host machine


Sven Lankes 2012-05-03 16:44:20 EDT

On a machine that has it's OVS-Setup configured through
old-fashioned network-scripts (no NetworkManager) the network
doesn't come up after boot because openvswitch isn't started
until *after* the network scripts try to configure the ovswitch.


I am a student at the University of Houston and I am currently doing a project on OVS and at this point I have it set up using Fedora 17. I start the service, setup a bridge and configure all ports to connect through the bridge. My next step is to hopefully use the OVSDB Monitor tool to pull information from the OVS. I have it installed on the same host that has the OVS. My question is whether I can run this tool on the same host and monitor it locally instead of remotely. If so what would be the steps to take to set it up and make it connect locally? What exactly is the SSH password, is this the root password of the host or my individual password? If I connect it locally do I put the loop back address or one of the ports IP address? Also do I need to run any commands to configure the OVS to connect to the tool or does the tool make the connection once I put the IP address and password? Any help is greatly appreciate it.

Thank You,

Re:Adding physical drops host machine

configure openvswitch in virt environment

You may find this url handy for your testing..


Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.