当前位置: > CentOS > CentOS故障 >

CentOS克隆后无法加载网卡的问题解决方法

时间:2014-12-22 16:37来源:linux.it.net.cn 作者:IT

一.故障现象:

[root@c1node01 ~]#service network restart

Shutting downloopback insterface:                                                      [   OK  ]

Bringing uploopback insterface:                                                           [   OK  ]

Bringing upinterface eth0:  Device eth0 does notseem to be present,delaying initialization.                    [FAILED]

二、解决办法

法一:

解决办法:

[root@c1node01 ~]#rm -rf /etc/udev/rules.d/70-persistent-net.rules

[root@c1node01 ~]#reboot ………………

[root@c1node01 ~]#service network restart

Shutting downloopback insterface:                                                        [   OK   ]

Bringing uploopback insterface:                                                             [   OK   ]

Bringing up interfaceeth0:                                                                    [   OK   ]

法二:

安装完一个centos虚拟机,又拷贝一份,开机后网卡无法正常启动,报错:Device eth0 does not seem to be present,

delayinginitialization

解决:# mv/etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

vim /etc/sysconfig/network-scripts/ifcfg-eth1

修改DEVICE="eth0"

为DEVICE="eth1"

然后重启启动网卡尝试下

法三:

在RHEL5里也发生类似事情,因为复制虚拟机MAC会重新生成,但是操作系统的MAC却写在ifcfg-ethx里,造成了不一致,所以不能启动网络接口,在RHEL5里可以使用kudzu或者注释网卡配置文件的MAC字段来解决这个问题。但是在RHEL6里,kudzu已经被hal服务取代了。虽然lspci能够正常认到网卡,但是却无法使用/etc/init.d/networkrestart来启动服务。尝试注释ifcfg-eth0的MAC字段,还是报错。查看了下udev的规则,发现了问题的所在。

[root@Oracle~]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

#net device () (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”,ATTR{address}==”08:00:27:16:31:11″, ATTR{type}==”1″, KERNEL==”eth*”,NAME=”eth0″

#net device ()
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”,ATTR{address}==”08:00:27:32:66:63″, ATTR{type}==”1″, KERNEL==”eth*”,NAME=”eth1″
[root@Oracle ~]#

原来UDEV这里把克隆前的MAC当成了当前虚拟机的eth0MAC,而重新生成的08:00:27:32:66:63是eth1的MAC。

解决这个问题,只要删除旧的UDEV配置,修改为:
[root@Oracle ~]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

#net device () (custom name provided by external tool)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”,ATTR{address}==”08:00:27:32:66:63″, ATTR{type}==”1″, KERNEL==”eth*”,NAME=”eth0″

重启network服务有时可以有时不行,重启系统就一切OK!试过多次!
[root@Oracle ~]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]

实在不行就reboot重启,我就是这样解决问题的。

 

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容