場景:在進行linux 主機克隆的時候,網卡初始化通常都會有問題,最多見的「Device eth0 does not seem to be present,delaying initialization.」,從字面意思 說eth0沒有固化,延遲啓動。因爲網卡有MAC地址信息,這個是物理網卡決定的,虛擬機的網卡MAC地址是在網卡初始化的時候就肯定下來,固然也能夠修改:linux
這個MAC地址在兩個地方有,因此在克隆虛擬機的時候必定記得要把這個MAC改掉。一個是 /etc/sysconfig/network-scripts/ifcfg-eth0,spa
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.rulescode
# 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也要保持一致,而後重啓網卡生效。blog