场景:在进行linux 主机克隆的时候,网卡初始化一般都会有问题,最常见的“Device eth0 does not seem to be present,delaying initialization.”,从字面意思 说eth0没有固化,延迟启动。由于网卡有MAC地址信息,这个是物理网卡决定的,虚拟机的网卡MAC地址是在网卡初始化的时候就确定下来,当然也可以修改:
这个MAC地址在两个地方有,所以在克隆虚拟机的时候一定记得要把这个MAC改掉。一个是 /etc/sysconfig/network-scripts/ifcfg-eth0,
DEVICE=eth0
HWADDR=00:0c:29:7e:aa:f3
TYPE=Ethernet
UUID=7e686749-c1d9-422d-9275-c8174d8ad7a5
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.83.11
IPV6INIT=no
USERCTL=n
另外一个是 /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:7e:aa:f3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
如上 要保证 HWADDR和ATTR{address}一致,NAME也要保持一致,然后重启网卡生效。