Configure openvswitch in virtualization environment and use it for simple and complex (ex: vlan) testing in centos/rhel/fedora..etc

Open vSwitch (OVS) is a software switch. It consist of user space tools provided by openvswitch rpm and kernel modules provided by kmod-openvswitch rpm. Unlike the bridge available in old versions of distros ( fedora, rhel..etc ) it provides many advanced configuration options like tagged vlan. Full details available at www.openvswitch.org/

Open vSwitch is a network switch; at its lowest level, it is concerned with routing packets between interfaces. It is aimed at virtualization users, so, naturally, it is used in the creation of virtual networks. A switch can be set up with a number of virtual network interfaces, most of which are used by virtual machines to communicate with each other and the wider world. These virtual networks can be connected across hosts and across physical networks. One of the key features of Open vSwitch appears to be the ability to easily migrate virtual machines between physical hosts and have their network configuration (addresses, firewall rules, open connections, etc.) seamlessly follow.

Below Process will outline the steps required in CentOS/RHEL..etc

STARTING THE SERVICE

Once kernel module part is loaded, lets try to start the subjected service as shown below:

So, ovs-vswitchd service is started successfully..

Below command needs ‘brcompat_mod’ and will enable libvirt to use brctl to manage OVS.

Below are the steps which I followed to configure vlan ..

HOW TO CREATE TAGGED VLANS

On the HOST

Now, lets list the bridge configuration in the system via ‘brctl’ command..

If something goes wrong  (easiest way ) stop openvswitch service, delete /etc/openvswitch/conf.db and start the service again. Do the configuration again.

To test: Execute below steps in VM1

VM2

Now try pinging  VM1 to VM2

***************************************************************************************************************
Below Process will outline Fedora 17, 18, 19 Versions:

Unlike centos/rhel , the openvswitch support is added in libvirt. So, you dont need ‘brcompat_mod’ mentioned in first/above section to use it with libvirt.

Install these packages

Load openvswitch module and enable the service.

Now lets configure openvswitch bridge with Vlan enabled

Now, before starting a guest please edit the guest configuration as shown below:

Once you started the guest please follow the same process mentioned ( configuration of vlan networks in guest) in section 1 ( inside Centos/RHEL..etc)

You should be good to go.

Reference:

openvswitch.org/support/

lwn.net/Articles/469775/

openvswitch faq..

10 Replies to “Configure openvswitch in virtualization environment and use it for simple and complex (ex: vlan) testing in centos/rhel/fedora..etc”

  1. Hello there, simply turned into aware of your blog thru Google, and found that it is really informative. I’m gonna watch out for brussels. I will appreciate if you continue this in future. A lot of other folks will be benefited from your writing. Cheers!

    1. Hi mll,

      For the normal/basic setup you dont need any special settings in your switch side. ie ovs does not need any support from physical/outside switch. How-ever if you have a setting for the communication from your server and the outside world, you can consider it.

  2. Hi!

    I configured openvswitch bridge with Vlan enabled on ubuntu 12.04. It worked. But when I restarted networking (/etc/init.d/networking restart), I lost vlan10 and vlan20 ports. ovs-vsctl show command did not show any of the ports. The contents of ovs-vswitchd.log are:

    Oct 07 15:18:54|00031|bridge|INFO|created port br0 on bridge br0
    Oct 07 15:18:54|00032|ofproto|INFO|using datapath ID 0000002320de1035
    Oct 07 15:18:54|00033|bridge|WARN|bridge br0: using default bridge Ethernet address 0e:59:d5:80:7d:4f
    Oct 07 15:18:54|00034|ofproto|INFO|datapath ID changed to 00000e59d5807d4f
    Oct 07 15:18:54|00035|bridge|INFO|created port eth0 on bridge br0
    Oct 07 15:18:54|00036|ofproto|INFO|datapath ID changed to 0000545200011788
    Oct 07 15:19:52|00037|bridge|INFO|created port vlan10 on bridge br0
    Oct 07 15:19:52|00038|netdev_linux|WARN|/sys/class/net/vlan10/carrier: open failed: No such file or directory
    Oct 07 15:20:05|00039|bridge|INFO|created port vlan20 on bridge br0
    Oct 07 15:20:05|00040|netdev_linux|WARN|/sys/class/net/vlan20/carrier: open failed: No such file or directory
    Oct 07 15:22:58|00041|bridge|INFO|destroyed port eth0 on bridge br0
    Oct 07 15:22:58|00042|bridge|WARN|bridge br0: using default bridge Ethernet address 0e:59:d5:80:7d:4f
    Oct 07 15:22:58|00043|ofproto|INFO|datapath ID changed to 00000e59d5807d4f
    Oct 07 15:22:58|00044|bridge|INFO|destroyed port vlan10 on bridge br0
    Oct 07 15:22:58|00045|bridge|INFO|destroyed port br0 on bridge br0
    Oct 07 15:22:58|00046|bridge|INFO|destroyed port vlan20 on bridge br0

    There is a warning while creating vlan10 and vlan20 ports “netdev_linux|WARN|/sys/class/net/vlan10/carrier:open failed: No such file or directory”.

    What could be the reason? Can you please help me?

    Thanks,
    Shweta

Leave a Reply

Your email address will not be published. Required fields are marked *