Installing Openvswitch and KVM on CentOS 6.2
This is all (mostly) covered in the INSTALL.Linux inside the tar. This might help folks with some of the
graph
Download and Install Open vSwitch
1 2 3 4 5 6 7 8 9 10 |
$ wget http://openvswitch.org/releases/openvswitch-1.3.0.tar.gz wget http://download.fedoraproject.org/pub/fedora/linux/releases/16/Everything/source/SRPMS/autoconf-2.68-2.fc15.src.rpm $rpm -ivh webdot-2.26-1.el6.noarch.rpm $yum -y install graphviz-tcl $yum -y install python-zope-filesystem $yum -y install python-zope-interface $yum -y install automake $yum -y install autoconf |
add yum -y install openssl-devel this package is necessary if you use SSL with OpenVSWitch. (Thanks for input Marcos)
1 2 3 |
$yum –y install gcc |
The Open vSwitch datapath requires bridging support (CONFIG_BRIDGE) to be built as a kernel module. (This is common in kernels provided by Linux distributions.) The bridge module must not be loaded or in use. If the bridge module is running (check with “lsmod | grep bridge”), you must remove it (“rmmod bridge”) before starting the datapath.
To build the Linux kernel module, so that you can run the kernel-based switch, pass the location of the kernel build directory on –with-linux. For example, to build for a running instance of Linux:
1 2 3 4 5 6 |
./configure --with-linux=/lib/modules/`uname -r`/build $make $make install insmod datapath/linux/openvswitch_mod.ko |
Verify the kernel mod loaded
1 2 3 4 |
[root@localhost openvswitch-1.3.0]# lsmod openvswitch_mod 82086 0 |
If everything compiles and install create the sockets and db.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$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 $sudo ovs-vswitchd --pidfile --log-file --detach -v $ovs-vswitchd --pidfile –detach |
Setup the networking component by moving the IP off the physical interface to the new bridge interface
1 2 3 4 5 6 7 8 9 10 |
$ifconfig eth0 0 $ifconfig br0 192.168.1.25 netmask 255.255.255.0 up $ifconfig eth0 up $ifconfig eth0 0.0.0.0 $sudo ovs-vsctl add-br br0 $sudo ovs-vsctl add-port br0 eth0 $route add default gw 192.168.1.1 br0 $route add default gw 192.168.1.1 br0 |
Installing and Integrating KVM into Open vSwitch
*Note* KVM is no longer supported on 32-bit HW.
1 2 3 4 5 6 7 |
x86_64 <a href="http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm">http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm</a> $wget rpmforge-release-0.5.2-2.el6.rf.i686.rpm $rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm $rpm --import <a href="http://apt.sw.be/RPM-GPG-KEY.dag.txt">http://apt.sw.be/RPM-GPG-KEY.dag.txt</a> $yum -y install qemu-kvm qemu-kvm-tools libvert |
KVM GUI management tool
1 2 3 4 |
$yum –y install virt-manager $yum install dejavu-lgc-sans-fonts |
Start the libvert daemon or reboot the system.
1 2 3 |
$ Service libvertd start |
Start the KVM GUI
1 2 3 |
$ ./virt-manager |
See the updated Install at the top for accurate information!
OK, Waiting on Part 2! I’m planning on use this to build a 2 host cluster running CentOS 6.2 with KVM. Doing what you have got here, what else do I need and should I just wait?
Oh man, I must have missed that lol. I will work on it later this week. I get so annoyed with the Yum repository its hard force myself to come out of Ubuntu. I used to love RH back in the day to 🙁 That said oVirt looked pretty cool that was released a a couple months ago have you tried it? KVM + oVswitch later this week.
Or try backing off the Swig version in the meantime. Curious what distro you have if you get a second.
Please, add yum -y install openssl-devel this package is necessary if you use SSL with OpenVSWitch.
Great article, congrats
Thanks Marcos. Appreciate the feedback. I need to clean this post up. I haven’t done much in RedHat lately. Have you tried oVirt with OpenvSwitch yet? Last time I visited it had just released. I guess I’ve turned into an OpenStack junky. lol.
Thanks Brent,
I´m trying to create a new switch to replace dvSwitch, like this http://blog.ioshints.info/2012/02/nicira-open-vswitch-inside-vsphereesx.html?spref=tw, to controller in Layer 2 and others restrictions on virtualization environment.
Hi,
I am currently trying out the instructions you have posted here but I am encountering this error on a CentOS 6.2:
configure: error: source dir /lib/modules/2.6.32-220.el6.x86_64/build doesn’t exist
The build folder can be found in the same location mentioned above but it is only a symbolic link of the folder /usr/src/kernels/`uname -r`.
How do I solve this issue?
If after the installation of the kernel-devel package the issue persists. That is due a misconfiguration of the kernel-devel package. A simple and fast solution is to re-link to the actual sources. I mean, just re-link to /usr/src/kernels/[your_kernel]. Only the build link, source is a link to build.
Carlo, did you solve that problem? I am having that problem too
Carlo, you can resolve that issue by installing the kernel-devel package
I recieve the following error while building kernel modules:
make -C /lib/modules/2.6.32-279.9.1.el6.x86_64/build M=/usr/src/openvswitch-1.7.1/datapath/linux modules
make[4]: Entering directory `/usr/src/kernels/2.6.32-279.9.1.el6.x86_64′
CC [M] /usr/src/openvswitch-1.7.1/datapath/linux/genetlink-brcompat.o
In file included from /usr/src/openvswitch-1.7.1/datapath/linux/compat/include/linux/netlink.h:4,
from /usr/src/openvswitch-1.7.1/datapath/linux/compat/include/net/genetlink.h:5,
from /usr/src/openvswitch-1.7.1/datapath/linux/compat/genetlink.inc:3,
from /usr/src/openvswitch-1.7.1/datapath/linux/genetlink-brcompat.c:10:
/usr/src/openvswitch-1.7.1/datapath/linux/compat/include/linux/skbuff.h:242: error: redefinition of ‘skb_frag_page’
include/linux/skbuff.h:1612: note: previous definition of ‘skb_frag_page’ was here
Hi guys, I will do an update next week for CentOS. I have been tunnel visioned on Ubuntu lately with other things. Will get it out this weekend.
Thanks!
-Brent
I was able to resolve the previous issue (specific to CentOS 6.3) by editing datapath/linux/compat/include/linux/skbuff.h and commenting out the following:
#if LINUX_VERSION_CODE page;
//}
#endif
Thank god for google translate:
http://www.xiaoyinzei.com/?p=32
I was able to resolve the previous issue (specific to CentOS 6.3) by editing datapath/linux/compat/include/linux/skbuff.h and commenting out the following:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
//static inline struct page *skb_frag_page(const skb_frag_t *frag)
//{
// return frag->page;
//}
#endif
Thank god for google translate:
http://www.xiaoyinzei.com/?p=32
@Jay, where did you find the file: datapath/linux/compat/include/linux/skbuff.h
I have looked everywehre but can’t figure out where to find this file, i have similar problem and build directory in my running kernel src directory does not exist, what should i do??