VMware环境中安装的CentOS在安装时进行了ip的持久化,即在/etc/sysconfig/network-scripts/ifcfg-eth0文件中对eth0的信息进行配置。
周五晚下电,周一再次启动虚拟机之后,ifconfig命令不返回现eth0的信息。
ifconfig eth0 up命令返回结果提示:
Device eth0 does not seem to be present, delaying initialization
Device eth0 does not seem to be present, delaying initialization
上网查,发现大部分都是在创建克隆虚拟机时发生该问题,按照方法操作,问题解决
1、修改/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. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:17", ATTR{type}=="0", KERNEL=="eth*", NAME="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a5:a4:7c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
修改后文件(删掉第一行配置,并将第二行的NAME改为eth0):
# 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. # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a5:a4:7c", ATTR{type}=="0", KERNEL=="eth*", NAME="eth0"
2、重启虚拟机搞定!
附:
修改网卡配置 编辑:vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 #描述网卡对应的设备别名,例如ifcfg-eth0的文件中它为eth0
BOOTPROTO=static #设置网卡获得ip地址的方式,可能的选项为static,dhcp或bootp,分别对应静态指定的 ip地址,通过dhcp协议获得的ip地址,通过bootp协议获得的ip地址
BROADCAST=192.168.0.255 #对应的子网广播地址
HWADDR=00:07:E9:05:E8:B4 #对应的网卡物理地址
IPADDR=12.168.0.33 #如果设置网卡获得 ip地址的方式为静态指定,此字段就指定了网卡对应的ip地址
NETMASK=255.255.255.0 #网卡对应的网络掩码
NETWORK=192.168.0.0 #网卡对应的网络地址
参考链接:
http://m114.org/device-eth0-does-not-seem-to-be-present-delaying-initialization/
http://www.cnblogs.com/coacaio/archive/2011/12/12/2284715.html