VMware升级到9后顺便更新了下Virtual Machine,再次启动Centos6虚拟机后不能启动网络,提示以下错误:
device "eth0" does not seem to be present, delaying initialization
原因是Centos6使用udev动态管理设备文件将MAC地址和网卡名称对应记录在udev的规则脚本中,VMware升级后虚拟机网卡MAC会改变,这样系统会认为网卡是新增的并命名为eth1,查看如下:
ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:ce:c0:1e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.13/24 brd 192.168.1.255 scope global eth1
inet6 fe80::20c:29ff:fece:c01e/64 scope link
解决方法1,修改网络配置文件设备eth0为eth1:
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth1"
BOOTPROSTO=static
IPADDR=192.168.1.13
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT="yes"
解决方法2,修改udev记录的mac与网卡名称对应规则:
cat /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ce:c0:1e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"