Centos 6.3 + OpenVswitch1.7.1 + libvirt-0.10.1

来源:互联网 发布:sql语句建立table 编辑:程序博客网 时间:2024/05/21 11:30

Openvswitch 在fedora上已经进入内核,fedora内核版本是3.3

官方日志

7-22-12
Binary Bit Me Libvirt 0.9.11 has Support for Open vSwitch Libvirt release 0.9.11 has added support for Open vSwitch so it is no longer required to use bridge compatibility mode! Fedora 17 has 0.9.11 included.


如果现在要在Centos6.3上用的话,还是需要自己自行编译Openvswitch

如果要openvswitch支持libvirt的话,libvirt版本需要0.9.11或者以上

现在centos6.3上最新的libvirt的版本是0.9.10,现在只好自己手动编译一个,相信不久马上会更新到0.9.11版的


# Install Centos 6.3 minimal x86_64 on a server## Disable selinuxvi /etc/sysconfig/selinuxSELINUX=disabled## Set the hostnamevi /etc/sysconfig/networkHOSTNAME=whatevername## Install basic toolsyum -y install screen sudo wget mlocate ntpdate git links## (Optional) Install EPELwget http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-7.noarch.rpmrpm -ivh epel-release-6-7.noarch.rpm## Update the systemyum -y update## Disable services not usedchkconfig fcoe offchkconfig ip6tables offchkconfig iscsi offchkconfig iscsid offchkconfig lldpad offchkconfig netfs offchkconfig rpcbind offchkconfig rpcgssd offchkconfig rpcidmapd offchkconfig nfslock off## Install virtualization groupsyum groupinstall Virtualization "Virtualization Client" "Virtualization Platform" "Virtualization Tools"## Install additional stuff neededyum install avahi gcc make libxml2-devel gnutls-devel device-mapper-devel python-devel libnl-devel dejavu-lgc-sans-fonts openssl-devel yajl-devel avahi-devel libssh2-devel libcurl-devel kernel-devel## Remove ebtablesyum -y remove ebtables## Get and install libvirt sources (needed for openvswitch support)wget http://libvirt.org/sources/libvirt-0.10.1.tar.gztar zxvf libvirt-0.10.1.tar.gzcd libvirt-0.10.1./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etcmake; make install; ldconfig## Start libvirtd serviceservice messagebus startservice avahi-daemon startservice libvirtd start## Set libvirtd to start on bootschkconfig libvirtd on## Disabled libvirt networkvirsh net-autostart --disable default## Get and install openvswitchwget http://openvswitch.org/releases/openvswitch-1.7.1.tar.gztar zxvf openvswitch-1.7.1.tar.gzcd openvswitch-1.7.1./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-linux=/lib/modules/`uname -r`/build#### There seems to be an issue with skbuff.h, so here's what I do to get around it, not 100% is this is right or what impact it might have, so use at your own riskvi datapath/linux/compat/include/linux/skbuff.hline 241, change the kernel version from 3.2.0 to 2.6.32#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)## Build and install openvswitchmake; make install; ldconfig## Build and install the kernel modules<code>make -C /usr/src/kernels/2.6.32-279.5.2.el6.x86_64 modules_install M=~/openvswitch-1.7.1/datapath/linux## Copy over sysconfig filescp rhel/etc_init.d_openvswitch /etc/init.d/openvswitchcp rhel/etc_logrotate.d_openvswitch /etc/logrotate.d/openvswitchcp rhel/etc_sysconfig_network-scripts_ifup-ovs /etc/sysconfig/network-scripts/ifup-ovscp rhel/etc_sysconfig_network-scripts_ifdown-ovs /etc/sysconfig/network-scripts/ifdown-ovscp rhel/usr_share_openvswitch_scripts_sysconfig.template /etc/sysconfig/openvswitch## Edit sysconfig filevi /etc/sysconfig/openvswitchBRCOMPAT=yes## Create bridge filevi /etc/sysconfig/network-scripts/ifcfg-ovsbr1DEVICE=ovsbr1ONBOOT=yesDEVICETYPE=ovsTYPE=OVSBridgeBOOTPROTO=staticIPADDR=10.0.0.1NETMASK=255.255.255.0HOTPLUG=no## Remove bridge modulermmod bridge## Blacklist the bridge modulevi /etc/modprobe.d/blacklist.conf# Bridge, using openvswitch insteadblacklist bridge## Start openvswitchservice openvswitch start## Add Iptables NAT and Rulesiptables -A POSTROUTING -o eth0 -j MASQUERADEiptables -A INPUT -i ovsbr1 -j ACCEPTiptables -A FORWARD -i ovsbr1 -j ACCEPT## Save iptables rulesservice iptables save## Edit the saved iptables file, remove the FORWARD REJECTvi /etc/sysconfig/iptables#-A FORWARD -j REJECT --reject-with icmp-host-prohibited## Restart iptablesservice iptables restart