VMware克隆后找不到eth0


用ESX克隆虚拟机的时候,会发现网卡编号变化了,原来的eth0,eth1不见了,而出现了eth2,eth3。我估计可能的原因是ESX在创建虚拟机时,会重新创建网卡,当系统发现网卡和配置不一样时,就新建了新的网络接口。

可以用下面的方法把eth0改回来:

修改70-persistent-net.rules文件

  1. [root@RedHat89178 ~]# cat /etc/udev/rules.d/70-persistent-net.rules
  2. # This file was automatically generated by the /lib/udev/write_net_rules
  3. # program, run by the persistent-net-generator.rules rules file.
  4. #
  5. # You can modify it, as long as you keep each rule on a single
  6. # line, and change only the value of the NAME= key.

  7. # PCI device 0x15ad:0x07b0 (vmxnet3)
  8. # 把原来的配置注释掉
  9. #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

  10. # PCI device 0x15ad:0x07b0 (vmxnet3)
  11. # 把新出现的eth2改为eth0
  12. SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:9a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

更改网卡配置文件

  1. [root@redhat89178 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE="eth0"
  3. BOOTPROTO=static
  4. # 把MAC地址改成新的地址
  5. HWADDR="00:50:56:9C:00:3A"
  6. ...

更新主机名

  1. [root@redhat89178 ~]# cat /etc/sysconfig/network
  2. NETWORKING=yes
  3. HOSTNAME=<new_hostname>
  4. GATEWAY=10.10.10.1

相关内容