克隆的vmware虛擬主機網卡無法啓動解決辦法

創建一個克隆的vmware虛擬機,啓動後會報,發現網絡沒有啓動起來。

 

仔細觀察,你會發現沒有eth0的ip地址,是因爲從原機器克隆過來後,centos使用的還是原機器eth0的mac地址,但是這個mac地址跟vmware生成的mac地址不一樣。執行啓動網絡也會報錯。

提示 Device eth0 does not seem to be present 

 

在centos下修改網絡配置參數

1. [root@centos6 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 

發現網卡地址跟上面的不一樣,刪除HWADDR和UUID行,修改後如果是動態獲取ip網卡的地址是這樣的。

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

2.修改另外一個文件

 [root@centos6 ~]# vi /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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:1b:8f:d9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a6:6a:ef", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

將第一行刪除,第二行的eth1 修改爲eth0,修改後最後2行內容如下。

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a6:6a:ef", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

修改後重啓centos6,網卡就自動啓動了,centos7經測試沒有這個問題。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章