openVswitch 在centos下安装

OpenvSwitch概念:用作虚拟交换机,传递虚拟机VM之间的流量,以及实现VM和外界网络的通信。

OpenvSwitch数据路径需要桥接支持(CONFIG_BRIDGE)作为内核模块构建。(这在Linux发行版提供的内核中是常见的)桥接模块不能加载或使用。如果桥模块正在运行(使用“lsmod | grep bridge”进行检查),则在启动数据路径之前必须先删除它(“rmmod bridge”)。

安装openvswitch-2.5.0

安装依赖包:

yum -y install make gcc openssl-devel autoconf automake rpm-build redhat-rpm-config

yum -y install python-devel openssl-devel kernel-devel kernel-debug-devel libtool wget

预处理

mkdir -p ~/rpmbuild/SOURCES

wget http://openvswitch.org/releases/openvswitch-2.5.0.tar.gz

cp openvswitch-2.5.0.tar.gz ~/rpmbuild/SOURCES/

tar xfz openvswitch-2.5.0.tar.gz

sed ‘s/openvswitch-kmod,
//g’ openvswitch-2.5.0/rhel/openvswitch.spec > openvswitch-2.5.0/rhel/openvswitch_no_kmod.spec

构建RPM包

rpmbuild -bb –nocheck~/openvswitch-2.5.0/rhel/openvswitch_no_kmod.spec

安装:

yum localinstall ~/ rpmbuild/RPMS/x86_64/openvswitch-2.5.0-1.x86_64.rpm

5.启动相关服务:
操作前先cd

cd ~

systemctl start openvswitch.service

如果需要使用openvswitch进行网络配置请看以下步骤:

配置openvswitch

注意:在禁用内核的bridge时候,要先禁止防火墙的开机启动。
centos7以后的版本为:

systemctl stop firewalld
systemctl disable firewalld

[root@localhost ~]# lsmod |grep bridge

bridge                119562  1 ebtable_broute
stp                    12976  1 bridge
llc                    14552  2 stp,bridge

此时可以发现已经有bridge启动了,执行rmmod bridge会报错

rmmod: ERROR: Module bridge is in use by: ebtable_broute

解决方法:
service etbales status

Redirecting to /bin/systemctl status  ebtables.service
● ebtables.service - Ethernet Bridge Filtering tables
   Loaded: loaded (/usr/lib/systemd/system/ebtables.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

发现ebtables.service 的路径

vim /usr/lib/systemd/system/ebtables.service

<
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值