克隆linux系统后,克隆版无法启动网卡,提示错误:
device eth0 does not seem to be present,delaying initialization 原因分析: Linux使用udev动态管理设备文件。VMware会自动生成虚拟机的mac地址。这样,由于克隆出的Linux已经记录了原Linux的网卡mac地址对应于网卡eth0,在克隆出的Linux中由于mac地址发生改变,udev会自动将该mac对应于网卡eth1,以此类推。而其实kernel仅仅只识别到一张网卡,跟网卡名相关的网络配置也未发生任何变化。 解决方案: udev将mac与网卡名称的对应关系保存在/etc/udev/rules.d/70-persistent-net.rules中, 记录下新的网卡MAC地址和NAME。 [root ~]# cat /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:5f:88:bd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b6:87:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" 修改网卡配置文件: 修改DEVICE,HWADDR,IPADDR三行。 [root ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth1 #修改为新的NAME 。 HWADDR=00:0C:29:b6:87:56 #用新的MAC替换 TYPE=Ethernet UUID=fa6bcd84-01ab-4b2d-9dd6-8d4a3a1961ac ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=192.168.1.56 #修改IP(如果原虚拟机不同时运行,可以不修改) NETMASK=255.255.255.0 GATEWAY=192.168.1.1 重启网卡即可: [root ~]# service network restart 方法二:类似于上文 删除/etc/udev/rules.d/70-persistent-net.rules中含有eth0的行,修改eth1为eth0 。 再修改网卡配置文件的HWADDR行即可。