這篇文章給大家介紹RHEL6.3克隆虛擬機(jī)后的網(wǎng)卡啟動(dòng)失敗問題該怎么解決,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。
創(chuàng)新互聯(lián)建站專注于瑤海網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供瑤海營銷型網(wǎng)站建設(shè),瑤海網(wǎng)站制作、瑤海網(wǎng)頁設(shè)計(jì)、瑤海網(wǎng)站官網(wǎng)定制、微信小程序開發(fā)服務(wù),打造瑤海網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供瑤海網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
公司測試環(huán)境安裝的都是RHEL6.3,在進(jìn)行虛擬機(jī)克隆后,發(fā)現(xiàn)clone的虛擬機(jī)網(wǎng)卡起不來,具體報(bào)如下錯(cuò)誤:
[root@localhost Desktop]# service network restart
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Error: No suitable device found: no device found for connection 'System eth0'.
[FAILED]
當(dāng)你執(zhí)行ifconfig命令的時(shí)候,會(huì)發(fā)現(xiàn)顯示eth2網(wǎng)卡的配置文件卻為/etc/sysconfig/network-scripts/ifcfg-eth0。
[root@localhost network-scripts]# ifconfig|grep addr
eth2 Link encap:Ethernet HWaddr 00:0c:29:f4:95:e3
inet6 addr: fe80::20c:29ff:fe5c:65b7/64 Scope:Link
Interrupt:19 Base address:0x2024
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
[root@localhost network-scripts]# ls
ifcfg-eth0 ifdown-isdn ifup-aliases ifup-plusb init.ipv6-global
ifcfg-lo ifdown-post ifup-bnep ifup-post net.hotplug
ifdown ifdown-ppp ifup-eth ifup-ppp network-functions
ifdown-bnep ifdown-routes ifup-ippp ifup-routes network-functions-ipv6
ifdown-eth ifdown-sit ifup-ipv6 ifup-sit
ifdown-ippp ifdown-tunnel ifup-isdn ifup-tunnel
ifdown-ipv6 ifup ifup-plip ifup-wireless
[root@localhost network-scripts]#
產(chǎn)生這個(gè)問題的原因是虛擬機(jī)分配給操作系統(tǒng)的虛擬網(wǎng)卡MAC地址是不一樣的。第一個(gè)系統(tǒng)的網(wǎng)卡MAC地址記錄在了/etc/udev/rules.d/70-persistent-net.rules,命名為eth0。新克隆分配的系統(tǒng)的網(wǎng)卡MAC地址也記錄在了該文件當(dāng)中,與之前的系統(tǒng)一樣,因此有了沖突。
可以查看一下兩個(gè)機(jī)子的這個(gè)70-persistent-net.rules文件的內(nèi)容
第一個(gè)系統(tǒng):
[root@localhost 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:f4:95:e3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
克隆后的系統(tǒng):
[root@localhost 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:f4:95:e3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
我們可以看到這兩個(gè)系統(tǒng)中的MAC地址一樣。
問題解決方法:
刪除克隆后這個(gè)系統(tǒng)中的 /etc/udev/rules.d/70-persistent-net.rules文件,重啟后系統(tǒng)會(huì)重新生成一個(gè)新的虛擬網(wǎng)卡MAC地址,然后把這個(gè)文件里NAME="eth2"的eth2改成eth0,同時(shí)也要修改ATTR{address}里的mac地址和/etc/sysconfig/network-scripts/ifcfg-eth0文件mac地址,并與新的虛擬網(wǎng)卡MAC地址保持一致。
如:將原文件的
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:f4:95:e3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
改為 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:5c:65:b7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
修改/etc/sysconfig/network-scripts/ifcfg-eth0文件
DEVICE="eth0"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="05944003-ae77-4c9d-9e58-3ec2851db71d"
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME="System eth0"
HWADDR=00:0c:29:5c:65:b7
然后重啟網(wǎng)絡(luò)服務(wù),發(fā)現(xiàn)一切正常了。
[root@localhost Desktop]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
state: activated
Connection activated [ OK ]
設(shè)置IP后,再檢查一下
[root@localhost Desktop]# ifconfig|grep addr
eth0 Link encap:Ethernet HWaddr 00:0C:29:5C:65:B7
inet addr:192.168.0.129 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5c:65b7/64 Scope:Link
Interrupt:19 Base address:0x2024
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
注:如果你執(zhí)行ifconfig命令的時(shí)候,發(fā)現(xiàn)仍然顯示eth2而不是eth0,可以將系統(tǒng)重啟一遍就變過來了。
關(guān)于RHEL6.3克隆虛擬機(jī)后的網(wǎng)卡啟動(dòng)失敗問題該怎么解決就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。