centos6 虚拟机克隆后,网卡名称会发生改变,默认的网卡名为eth0.克隆的虚拟机的网卡为eth1.
默认的配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0
1、更该配置文件,重启network.
[root@node1]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=on
NM_CONTROLLED=yes
BOOTPROTO=dhcp
2、编辑网卡设备
[root@node1 ]# vim /etc/udev/rules.d/70-persistent-net.rules
出现以下内容,会看到有2块网卡eth0和eth1,eth0为克隆系统的,eth1为重新生成,前面加#注释掉第一个网卡,更改第2个网卡为eth0,记录下mac地址
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c1:4c:6b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:06:65:11", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
3、重启机器。网卡名就会改为eth0.