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.