当前位置: 首页 > 工具软件 > Open FCoE > 使用案例 >

Centos 6.3 + OpenVswitch1.7.1 + libvirt-0.10.1

祁奇略
2023-12-01

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 selinux
vi /etc/sysconfig/selinux
SELINUX=disabled

## Set the hostname
vi /etc/sysconfig/network
HOSTNAME=whatevername

## Install basic tools
yum -y install screen sudo wget mlocate ntpdate git links

## (Optional) Install EPEL
wget http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -ivh epel-release-6-7.noarch.rpm

## Update the system
yum -y update

## Disable services not used
chkconfig fcoe off
chkconfig ip6tables off
chkconfig iscsi off
chkconfig iscsid off
chkconfig lldpad off
chkconfig netfs off
chkconfig rpcbind off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig nfslock off

## Install virtualization groups
yum groupinstall Virtualization "Virtualization Client" "Virtualization Platform" "Virtualization Tools"

## Install additional stuff needed
yum 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 ebtables
yum -y remove ebtables

## Get and install libvirt sources (needed for openvswitch support)
wget http://libvirt.org/sources/libvirt-0.10.1.tar.gz
tar zxvf libvirt-0.10.1.tar.gz
cd libvirt-0.10.1
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
make; make install; ldconfig

## Start libvirtd service
service messagebus start
service avahi-daemon start
service libvirtd start

## Set libvirtd to start on boots
chkconfig libvirtd on

## Disabled libvirt network
virsh net-autostart --disable default

## Get and install openvswitch
wget http://openvswitch.org/releases/openvswitch-1.7.1.tar.gz
tar zxvf openvswitch-1.7.1.tar.gz
cd 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 risk
vi datapath/linux/compat/include/linux/skbuff.h
line 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 openvswitch
make; 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 files
cp rhel/etc_init.d_openvswitch /etc/init.d/openvswitch
cp rhel/etc_logrotate.d_openvswitch /etc/logrotate.d/openvswitch
cp rhel/etc_sysconfig_network-scripts_ifup-ovs /etc/sysconfig/network-scripts/ifup-ovs
cp rhel/etc_sysconfig_network-scripts_ifdown-ovs /etc/sysconfig/network-scripts/ifdown-ovs
cp rhel/usr_share_openvswitch_scripts_sysconfig.template /etc/sysconfig/openvswitch

## Edit sysconfig file
vi /etc/sysconfig/openvswitch
BRCOMPAT=yes

## Create bridge file
vi /etc/sysconfig/network-scripts/ifcfg-ovsbr1
DEVICE=ovsbr1
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=10.0.0.1
NETMASK=255.255.255.0
HOTPLUG=no

## Remove bridge module
rmmod bridge

## Blacklist the bridge module
vi /etc/modprobe.d/blacklist.conf
# Bridge, using openvswitch instead
blacklist bridge

## Start openvswitch
service openvswitch start

## Add Iptables NAT and Rules
iptables -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A INPUT -i ovsbr1 -j ACCEPT
iptables -A FORWARD -i ovsbr1 -j ACCEPT

## Save iptables rules
service iptables save

## Edit the saved iptables file, remove the FORWARD REJECT
vi /etc/sysconfig/iptables
#-A FORWARD -j REJECT --reject-with icmp-host-prohibited

## Restart iptables
service iptables restart



 类似资料:

相关阅读

相关文章

相关问答