红联Linux门户
Linux帮助

VMware克隆后找不到eth0

发布时间:2014-08-21 15:29:47来源:linux网站作者:huaius

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


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


修改70-persistent-net.rules文件

[root@RedHat89178 ~]# 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 0x15ad:0x07b0 (vmxnet3)
# 把原来的配置注释掉
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x15ad:0x07b0 (vmxnet3)
# 把新出现的eth2改为eth0
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:9a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


更改网卡配置文件

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


更新主机名

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