创建一个克隆的vmware虚拟机,启动后会报,发现网络没有启动起来。
仔细观察,你会发现没有eth0的ip地址,是因为从原机器克隆过来后,centos使用的还是原机器eth0的mac地址,但是这个mac地址跟vmware生成的mac地址不一样。执行启动网络也会报错。
提示 Device eth0 does not seem to be present
在centos下修改网络配置参数
1. [root@centos6 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
发现网卡地址跟上面的不一样,删除HWADDR和UUID行,修改后如果是动态获取ip网卡的地址是这样的。
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
2.修改另外一个文件
[root@centos6 ~]# vi /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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:1b:8f:d9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a6:6a:ef", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
将第一行删除,第二行的eth1 修改为eth0,修改后最后2行内容如下。
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a6:6a:ef", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
修改后重启centos6,网卡就自动启动了,centos7经测试没有这个问题。