复制虚拟机后eht0变为eth1的解决

在A机器安装了虚拟机vmA,把虚拟机复制到机器B中vmB

新的虚拟机bmB网络无法使用,并用原操作系统中的网卡eth0在克隆出来的新系统中,网卡号变成了eth1,并且IP地址也丢失了,网络不可正常使用

 

解决办法

之一

修改克隆后机器(B机器)70-persistent-net.rules文件内容
 
对克隆后机器(B机器)/etc/udev/rules.d/70-persistent-net.rules文件进行两步修改:
 
(1) 将原NAME="eth0"行内容注释
 
(2) 将NAME="eth1"行内容中的"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:0c:29:5e:35:00", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:3a:f2:8e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

之二

修改克隆后机器(B机器)的Mac地址与IP地址
 
[root@ol6_weblogic_1 network-scripts]# vi/etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE="eth0"

HWADDR="00:0C:29:3a:f2:8e"

NM_CONTROLLED="yes"

ONBOOT="yes"

IPADDR=192.0.0.207

NETMAST=255.255.255.0

TYPE="Ethernet"
 

特别注意:
 
修改的MAC地址,只能是与70-persistent-net.rules文件中ATTR{address}相同的地址

 

之三

经验证,重启网络服务(service network restart)方式,IP地址可以变化过来,但是网络接口名称eth1修改不生效

需重启系统

你可能感兴趣的:(linux)