This in an updated version from an older post published last year. Many things have changed and thanks to the rhel/README.RHEL file included in openvswitch I’ve integrated openvswitch in my CentOS network scripts. HP N40L offers a 10/100/1000 NIC which is detected as eth0, and I want to add it to a network bridge under ovswitch.
First I add a new network config script for the new bridge br0: /etc/sysconfig/network-scripts/ifcfg-br0
The most important part is at the bottom of the script, we have to tell CentOS that the type of bridge is OVSBridge and our device type is ovs, this way the openvswitch kernel module will be used.
DEVICE="br0" BOOTPROTO="none" BROADCAST="192.168.1.255" DNS1="192.168.1.1" GATEWAY="192.168.1.1" IPADDR="192.168.1.20" NETMASK="255.255.255.0" NM_CONTROLLED="yes" DEFROUTE="yes" IPV4_FAILURE_FATAL="yes" IPV6INIT=no ONBOOT="yes" TYPE="OVSBridge" DEVICETYPE="ovs"
Then we have to modify ifcfg-eth0 network script so no ip address is set and eth0 is added to the bridge! (OVS_BRIGE=br0, TYPE=OVSPort and DEVICETYPE=ovs).
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPV6INIT=no
TYPE="OVSPort"
DEVICETYPE="ovs"
OVS_BRIDGE=br0
If openvswitch daemons are running we will have to restart the network service, create the bridge and add eth0 interface to the br0 bridge. Check that openvswitch service is running.
# service openvswitch status ovsdb-server is running with pid 1011 ovs-vswitchd is running with pid 1021
Please be careful. If you’re executing these commands remotely you may lost connection, check what you’re doing!! I was connected via SSH with my N40 server and I had to concatenate the commands unless I wanted to connect a screen and a keyboard to my server 😀 so please proceed with caution.
service network restart;ovs-vsctl add-br br0;ovs-vsctl add-port br0 eth0
Ok, if everything’s fine we can check the openvswitch bridge configuration with this command
# ovs-vsctl show f579b845-0b4c-43cb-a776-4e641ac07f92 Bridge "br0" Port "eth0" Interface "eth0" Port "br0" Interface "br0" type: internal ovs_version: "1.10.90"
Brilliant! my server has a new openvswitch bridge. Thanks Openvswitch for this software and its documentation.
I have configured this correctly and the output of ovs-vsctl show is in line with yours.
However, when I start my virtual machine I get the following error.
Message received: LOG I 18 error: Unable to add bridge br0 port vnet0: Operation not supported
Any help would be greatly appreciated.
Thank you.
LikeLike
Hi Adrian,
in an older post (https://n40lab.wordpress.com/2013/01/05/unable-to-add-bridge-brx-port-vnetx-invalid-argument-or-operation-not-supported/) I wrote about this “Operation not supported” problem, maybe brcompat module is not loaded (lsmod), are you using OpenNebula 3.8? I think OpenNebula 3.8 needs brcompat to create network interfaces for your guests
You can write me an email if you want and I’ll try to do my best to help you (check my gravatar profile to contact me http://es.gravatar.com/n40lab)
Regards,
Miguel
LikeLike
Nice post! My bridges work well with your configurations.
LikeLike