解决centos6 的virt-manager 无法创建network interface问题

来源:互联网 发布:80端口怎么看 编辑:程序博客网 时间:2024/05/13 18:42

新安装的centos6.4系统,本以为对libvirt尤其对网络支持的会很好,结果还是在创建network interface出错,启动时提示:Conncetion activation failed: Failed to determine connection’s virtual interface name、Connection activation failed: Master connection not found or invalid错误,无奈搜罗整理各种解决办法。


1. 首先安装 bridge-utils,也有可能你的系统安装时已经安装上了

   yum install bridge-utils

2. 关闭NetworkManager,启动network

网络被NetworkManager(即右上角的网络图标)接管,需要把它停掉,并禁止开机启动。

 chkconfig NetworkManager off chkconfig network on service NetworkManager stop service network start

3. 进入文件夹(root权限)

   cd /etc/sysconfig/network-scripts

4. 添加配置文件

 如果网络在使用先关闭 

  ifdown eth0

添加配置文件  新建名为 ifcfg-eth0的配置文件,添加内容如下:

DEVICE=eth0ONBOOT=yesBRIDGE=br0
备注:br0与后续要创建的要对应一直,后需要创建 ifcfg-br0

添加配置文件  新建名为ifcfg-br0的配置文件,添加内容如下(如果使用dhcp的话使用如下配置):

DEVICE=br0ONBOOT=yesTYPE=BridgeBOOTPROTO=dhcpSTP=onDELAY=0
如果使用静态ip需要添加ip、网关、dns信息,具体如下:

DEVICE=br0ONBOOT=yesTYPE=BridgeBOOTPROTO=staticIPADDR=xx.xx.xx.xxGATEWAY=xx.xxx.xxx.xxDNS1=xx.xx.xx.xxSTP=onDELAY=0

5. 启动设备

ifup eth0ifup br0
或者重启 网络

/etc/init.d/network restart


6. 有人说如果是多网卡 可能还需在文件 /etc/sysctl.conf  添加如下配置(结果如何尚未验证)

vi /etc/sysctl.conf


net.ipv4.conf.em1.rp_filter = 0net.ipv4.conf.em2.rp_filter = 0net.ipv4.conf.br0.rp_filter = 0net.ipv4.conf.all.rp_filter = 0

原创粉丝点击