当linux系统在识别网卡的时候会把mac地址和网卡名称对应起来记录到udev的脚本中,但是VMWare会给我们自动生成虚拟机的mac地址,但是在我们克隆的linux系统中udev脚本中已经记录了原本的mac地址与网卡名称,也就是eth0,但现在克隆过的虚拟机的mac地址已经不再是之前的mac地址了,所以udev就会自动将这个网卡的mac地址对应上网卡eth1(udev会记录所有已经识别的mac地址和网卡的对应关系,网卡名都会+1)kenerl仅仅只识别到了一张网卡,跟网卡名相关的网络配置也就没有发生变化。
解决办法:
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 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x8086:0x100f (e10000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
将eth0网卡的代码注释掉,然后将eth1改成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 0x8086:0x100f (e1000) #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:45", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x8086:0x100f (e10000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:00:46", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
把mac地址改为新的mac地址,即
HWADDR=00:50:56:bc:00:46
#啰嗦一下 : 更改host名称
编辑 /etc/sysconfig/network
# vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME= myhostname
3,reboot系统