VMware克隆Linux系統後網卡無法啓動

克隆linux系統後,克隆版無法啓動網卡,提示錯誤:
device eth0 does not seem to be present,delaying initialization
原因分析: Linux使用udev動態管理設備文件。VMware會自動生成虛擬機的mac地址。這樣,由於克隆出的Linux已經記錄了原Linux的網卡mac地址對應於網卡eth0,在克隆出的Linux中由於mac地址發生改變,udev會自動將該mac對應於網卡eth1,以此類推。而其實kernel僅僅只識別到一張網卡,跟網卡名相關的網絡配置也未發生任何變化。
解決方案:
udev將mac與網卡名稱的對應關係保存在/etc/udev/rules.d/70-persistent-net.rules中,
記錄下新的網卡MAC地址和NAME。
[root@bright ~]# cat /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:5f:88:bd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
 
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b6:87:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
修改網卡配置文件:
修改DEVICE,HWADDR,IPADDR三行。
[root@bright ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0    //網卡配置文件
DEVICE=eth1                    #修改爲新的NAME ,ifconfig查看發現會變成eth1
HWADDR=00:0C:29:b6:87:56       #用新的MAC替換
TYPE=Ethernet
UUID=fa6bcd84-01ab-4b2d-9dd6-8d4a3a1961ac
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.1.56            #修改IP(如果原虛擬機不同時運行,可以不修改)
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
重啓網卡即可:

[root@bright ~]# service network restart
方法二:類似於上文
刪除/etc/udev/rules.d/70-persistent-net.rules中含有eth0的行,修改eth1爲eth0 。
再修改網卡配置文件的HWADDR行即可。



原文地址http://www.myhack58.com/Article/48/67/2015/60509.htm,稍微感動一下。

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