码迷,mamicode.com
首页 > 其他好文 > 详细

Install Open vSwitch on CentOS

时间:2016-09-01 18:37:34      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

转载:http://cloud-mate.org/2015/06/installing-open-vswitch-centos-cloudstack/

Installing Open vSwitch on CentOS 6.6

I would like to use Open vSwitch on my KVM nodes in my CloudStack deployment. I will download and build the Open vSwitch rpms on my deployment server, which is just a CentOS VM which i use for deploying packages etc.

Create a directory to download the Open vSwitch tar to (You can find the most recent OVS here:http://openvswitch.org/download/):

cd ~
mkdir -p rpmbuild/SOURCES
wget http://openvswitch.org/releases/openvswitch–2.3.1.tar.gz

技术分享

tar xvfz openvswitch–2.3.1.tar.gz

技术分享

cd openvswitch–2.3.1/
cp ../openvswitch–2.3.1.tar.gz ~/rpmbuild/SOURCES/
cp rhel/openvswitch-kmod.files ~/rpmbuild/SOURCES/

技术分享

Then to build the rpms. This can take a few minutes:

rpmbuild -bb rhel/openvswitch.spec
rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec

如果没有rpmbuild命令,则yum install rpm-build 安装

Now the rpms are sitting on my deployment server ready to be copied to my KVM nodes.

技术分享

Copy the Open vSwitch rpms to the KVM node, using SCP.

scp -r root@sgdeploy:/root/rpmbuild/RPMS/x86_64 .

技术分享

Change directory to x86_64/ by
cd x86_64/

Then install kmod-openvswitch-2.3.1-1.el16.x86_64.rpm using
yum -y localinstall kmod-openvswitch-2.3.1-1.e16.x86_64.rpm

技术分享

Install openvswitch-2.3.1-1.x86_64.rpm using
yum -y localinstall openvswitch-2.3.1-1.x86_64.rpm

技术分享

Once both rpms are installed reboot the host. Then to verify openvswitch is installed run ovs-vsctl -V and ovs-vsctl show.

技术分享

Once verified that Open vSwitch is installed we need to configure the network interfaces for use with CloudStack (This KVM node has 4 physical network adapters but i am only configuring two:

rm -f /etc/sysconfig/network-scripts/ifcfg-eth0
echo “DEVICE=eth0” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “BOOTPROTO=none” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “IPV6INIT=no” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “NM_CONTROLLED=no” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “TYPE=OVSPort” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “DEVICETYPE=ovs” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “OVS_BRIDGE=cloudbr0” >> /etc/sysconfig/network-scripts/ifcfg-eth0
rm -f /etc/sysconfig/network-scripts/ifcfg-eth1
echo “DEVICE=eth1” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “BOOTPROTO=none” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “IPV6INIT=no” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “NM_CONTROLLED=no” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “TYPE=OVSPort” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “DEVICETYPE=ovs” >> /etc/sysconfig/network-scripts/ifcfg-eth1
echo “OVS_BRIDGE=cloudbr1” >> /etc/sysconfig/network-scripts/ifcfg-eth1
rm -f /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “DEVICE=cloudbr0” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “DEVICETYPE=ovs” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “TYPE=OVSBridge” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “BOOTPROTO=static” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “IPADDR=10.20.28.181” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “GATEWAY=10.20.28.254” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “NETMASK=255.255.255.0” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “DNS1=10.20.16.15” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “DNS2=10.20.16.16” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
echo “HOTPLUG=no” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr0
rm -f /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo “DEVICE=cloudbr1” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo “DEVICETYPE=ovs” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo “TYPE=OVSBridge” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo “BOOTPROTO=none” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo “HOTPLUG=no” >> /etc/sysconfig/network-scripts/ifcfg-cloudbr1
echo ‘blacklist bridge’ >> /etc/modprobe.d/blacklist.conf
echo “network.bridge.type=openvswitch” >> /etc/cloudstack/agent/agent.properties
echo “libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.OvsVifDriver” >> /etc/cloudstack/agent/agent.properties

References:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/KVM+with+OpenVSwitch

Install Open vSwitch on CentOS

标签:

原文地址:http://www.cnblogs.com/linprogram/p/5830472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!