vm使用克隆出來的虛擬機,網卡名稱變成eth1,要把這個eth1改爲eth0,參照以下步驟:nginx
查看eth1對應的mac地址
ide
ifconfigip
如:eth1:00:0C:29:74:F2:99ci
修改/etc/sysconfig/network-scripts/ifcfg-eth0的mac地址爲eth1的mac地址generator
因爲vm克隆過來,network-scripts目錄下沒有eth1的文件,目錄下有一個ifcfg-eth0,修改以下:虛擬機
hwaddr由原來的mac改爲eth1的mac,保存。it
DEVICE=eth0class
HWADDR=00:0C:29:74:F2:99file
ONBOOT=yesnetwork
IPADDR=192.168.198.10
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.198.198.2
3. 修改/etc/udev/rules.d/70-persistent-net.rules文件
attr{address} 與 name兩個字段
[root@nginx rules.d]# cat 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 0x1022:0x2000 (pcnet32)
# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:55:61:94", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:74:f2:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
[root@nginx rules.d]#
4. 重啓系統