vm esx4.1对rhel6的支持不是太好,克隆了一个rhel6的VM,启动网卡报错Device eth0 does not seem to be present,delaying initialization.发现IP地址、MAC地址都没有改,手工改了之后还是报错,这是由于克隆后的系统还是认原来的MAC地址,即使改了ifcfg-eth文件也没有用,这里有两个办法,第一种办法比较简单直接,直接把原网卡删除,再重新添加网卡,系统就会为新网卡重新配置MAC,第二种方法复杂一些,但是会加深对linux网络服务的了解
[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"
原来UDEV这里把克隆前的MAC当成了当前虚拟机的eth0 MAC,而重新生成的08:00:27:32:66:63是eth1的MAC。
删除旧的UDEV配置,将新的UDEV配置的网卡名字改为eth0:
[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 ]