2021-05-12 14:32:11
Linux虛擬機器克隆後網絡卡UUID問題
虛擬機器中的Linux系統克隆後,網絡卡設定eth0中的UUID可被克隆的系統是一樣的,這樣UUID就失去了唯一性。
有時我們不小心將/etc/sysconfig/network-scripts /ifcfg-eth0(可以通過此檔案進行檢視UUID)刪除或者損壞,要重新編輯ifcfg-eth0檔案時不知道網絡卡的UUID是什麼(當然也可以 不寫),那我們還有什麼方法可以檢視網絡卡的UUID呢?在這裡我們使用的方法是使用nmcli命令檢視,方法如下:
1、首先我們檢視一下nmcli是哪個軟體包提供的
[root@linuxidc ~]# yum provides "*/nmcli"
Loaded plugins:fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.cug.edu.cn
* extras: mirrors.cug.edu.cn
* updates: CentOS.ustc.edu.cn
1:NetworkManager-0.8.1-75.el6.i686 : Network connection manager and
: user applications
Repo : base
Matched from:
Filename : /usr/bin/nmcli
2、從上面結果可以看出nmcli,接下來我們安裝NetworkManager這個軟體包
[root@linuxidc ~]# yum -y install NetworkManager
3、啟動NetworkManager服務
[root@linuxidc ~]# service NetworkManager start
Setting network parameters... [ OK ]
Starting NetworkManager daemon: [ OK ]
4、檢視網絡卡UUID
[root@linuxidc ~]# nmcli con | sed -n '1,2p'
NAME UUID TYPE SCOPE TIMESTAMP-REAL
System eth0 c1021d28-7238-4f26-8e92-4aea5d607cab 802-3-ethernet system Mon 08 Dec 2014 12:49:14 PM CST
5、檢驗是否與/etc/sysconfig/network-scripts/ifcfg-eth0裡面的UUID值相同(註:檢驗只在ifcfg-eth0檔案能正常檢視UUID時才有效)
[root@linuxidc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep UUID
UUID=c1021d28-7238-4f26-8e92-4aea5d607cab
下面是我的實際解決問題過程:
[root@Hadoop11 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:0c:29:ec:f6:99
IPADDR=192.168.153.11
NETMASK=255.255.255.0
GATEWAY=192.168.153.2
DNS1=8.8.8.8
DNS2=202.106.0.20
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
[root@hadoop11 ~]# service network restart
正在關閉介面 eth0: [確定]
關閉環迴介面: [確定]
彈出環回介面: [確定]
彈出介面 eth0: Determining if ip address 192.168.153.11 is already in use for device eth0...
[確定]
[root@hadoop11 ~]# user
-bash: user: command not found
[root@hadoop11 ~]# yum provides "*/nmcli"
已載入外掛:fastestmirror, security
Determining fastest mirrors
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 01:00
extras | 3.4 kB 00:00
extras/primary_db | 37 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.4 MB 00:09
base/filelists_db | 6.4 MB 00:32
extras/filelists_db | 38 kB 00:00
updates/filelists_db | 1.1 MB 00:07
1:NetworkManager-0.8.1-107.el6.x86_64 : Network connection manager and user applications
Repo : base
匹配來自於:
Filename : /usr/bin/nmcli
[root@hadoop11 ~]# yum -y install NetworkManager
已載入外掛:fastestmirror, security
設定安裝進程
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
解決依賴關係
--> 執行事務檢查
---> Package NetworkManager.x86_64 1:0.8.1-107.el6 will be 安裝
--> 處理依賴關係 ppp = 2.4.5,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 NetworkManager-glib = 1:0.8.1-107.el6,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 wpa_supplicant >= 1:0.6.8-4,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 mobile-broadband-provider-info >= 0.20090602,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 ModemManager >= 0.3-3.git20100317,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 rp-pppoe,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 dnsmasq,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 avahi-autoipd,它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 libnm-util.so.1()(64bit),它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 處理依賴關係 libnm-glib.so.2()(64bit),它被軟體包 1:NetworkManager-0.8.1-107.el6.x86_64 需要
--> 執行事務檢查
---> Package ModemManager.x86_64 0:0.4.0-5.git20100628.el6 will be 安裝
---> Package NetworkManager-glib.x86_64 1:0.8.1-107.el6 will be 安裝
---> Package avahi-autoipd.x86_64 0:0.6.25-15.el6 will be 安裝
--> 處理依賴關係 libdaemon.so.0()(64bit),它被軟體包 avahi-autoipd-0.6.25-15.el6.x86_64 需要
---> Package dnsmasq.x86_64 0:2.48-17.el6 will be 安裝
---> Package mobile-broadband-provider-info.noarch 0:1.20100122-4.el6 will be 安裝
---> Package ppp.x86_64 0:2.4.5-10.el6 will be 安裝
---> Package rp-pppoe.x86_64 0:3.10-16.el6 will be 安裝
---> Package wpa_supplicant.x86_64 1:0.7.3-8.el6 will be 安裝
--> 執行事務檢查
---> Package libdaemon.x86_64 0:0.14-1.el6 will be 安裝
--> 完成依賴關係計算
依賴關係解決
=====================================================================================================================================
軟體包 架構 版本 倉庫 大小
=====================================================================================================================================
正在安裝:
NetworkManager x86_64 1:0.8.1-107.el6 base 1.1 M
為依賴而安裝:
ModemManager x86_64 0.4.0-5.git20100628.el6 base 177 k
NetworkManager-glib x86_64 1:0.8.1-107.el6 base 241 k
avahi-autoipd x86_64 0.6.25-15.el6 base 34 k
dnsmasq x86_64 2.48-17.el6 base 150 k
libdaemon x86_64 0.14-1.el6 base 28 k
mobile-broadband-provider-info noarch 1.20100122-4.el6 base 26 k
ppp x86_64 2.4.5-10.el6 base 328 k
rp-pppoe x86_64 3.10-16.el6 base 97 k
wpa_supplicant x86_64 1:0.7.3-8.el6 base 367 k
事務概要
=====================================================================================================================================
Install 10 Package(s)
總下載量:2.6 M
Installed size: 8.8 M
下載軟體包:
(1/10): ModemManager-0.4.0-5.git20100628.el6.x86_64.rpm | 177 kB 00:00
(2/10): NetworkManager-0.8.1-107.el6.x86_64.rpm | 1.1 MB 00:01
(3/10): NetworkManager-glib-0.8.1-107.el6.x86_64.rpm | 241 kB 00:00
(4/10): avahi-autoipd-0.6.25-15.el6.x86_64.rpm | 34 kB 00:00
(5/10): dnsmasq-2.48-17.el6.x86_64.rpm | 150 kB 00:00
(6/10): libdaemon-0.14-1.el6.x86_64.rpm | 28 kB 00:00
(7/10): mobile-broadband-provider-info-1.20100122-4.el6.noarch.rpm | 26 kB 00:00
(8/10): ppp-2.4.5-10.el6.x86_64.rpm | 328 kB 00:02
(9/10): rp-pppoe-3.10-16.el6.x86_64.rpm | 97 kB 00:00
(10/10): wpa_supplicant-0.7.3-8.el6.x86_64.rpm | 367 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------
總計 327 kB/s | 2.6 MB 00:08
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-8.el6.centos.12.3.x86_64 (@anaconda-CentOS-201605220104.x86_64/6.8)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
執行 rpm_check_debug
執行事務測試
事務測試成功
執行事務
正在安裝 : ppp-2.4.5-10.el6.x86_64 1/10
warning: /etc/ppp/chap-secrets created as /etc/ppp/chap-secrets.rpmnew
warning: /etc/ppp/pap-secrets created as /etc/ppp/pap-secrets.rpmnew
正在安裝 : rp-pppoe-3.10-16.el6.x86_64 2/10
正在安裝 : 1:NetworkManager-glib-0.8.1-107.el6.x86_64 3/10
正在安裝 : mobile-broadband-provider-info-1.20100122-4.el6.noarch 4/10
正在安裝 : dnsmasq-2.48-17.el6.x86_64 5/10
正在安裝 : libdaemon-0.14-1.el6.x86_64 6/10
正在安裝 : avahi-autoipd-0.6.25-15.el6.x86_64 7/10
正在安裝 : ModemManager-0.4.0-5.git20100628.el6.x86_64 8/10
正在安裝 : 1:wpa_supplicant-0.7.3-8.el6.x86_64 9/10
正在安裝 : 1:NetworkManager-0.8.1-107.el6.x86_64 10/10
Verifying : 1:wpa_supplicant-0.7.3-8.el6.x86_64 1/10
Verifying : ModemManager-0.4.0-5.git20100628.el6.x86_64 2/10
Verifying : rp-pppoe-3.10-16.el6.x86_64 3/10
Verifying : avahi-autoipd-0.6.25-15.el6.x86_64 4/10
Verifying : ppp-2.4.5-10.el6.x86_64 5/10
Verifying : libdaemon-0.14-1.el6.x86_64 6/10
Verifying : dnsmasq-2.48-17.el6.x86_64 7/10
Verifying : mobile-broadband-provider-info-1.20100122-4.el6.noarch 8/10
Verifying : 1:NetworkManager-glib-0.8.1-107.el6.x86_64 9/10
Verifying : 1:NetworkManager-0.8.1-107.el6.x86_64 10/10
已安裝:
NetworkManager.x86_64 1:0.8.1-107.el6
作為依賴被安裝:
ModemManager.x86_64 0:0.4.0-5.git20100628.el6 NetworkManager-glib.x86_64 1:0.8.1-107.el6
avahi-autoipd.x86_64 0:0.6.25-15.el6 dnsmasq.x86_64 0:2.48-17.el6
libdaemon.x86_64 0:0.14-1.el6 mobile-broadband-provider-info.noarch 0:1.20100122-4.el6
ppp.x86_64 0:2.4.5-10.el6 rp-pppoe.x86_64 0:3.10-16.el6
wpa_supplicant.x86_64 1:0.7.3-8.el6
完畢!
[root@hadoop11 ~]# service NetworkManager start
設定網路引數... [確定]
正在啟動 NetworkManager 守護行程: [確定]
[root@hadoop11 ~]# nmcli con
名稱 UUID 型別 範圍 真實時間戳
System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet 系統 2016年08月03日 星期三 04時29分03秒
名稱 UUID 型別 範圍 真實時間戳
[root@hadoop11 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
[root@hadoop11 ~]# service network restart
正在關閉介面 eth0: 裝置狀態:3 (斷開連線)
[確定]
關閉環迴介面: [確定]
彈出環回介面: [確定]
彈出介面 eth0: 活躍連線狀態:啟用的
活躍連線路徑:/org/freedesktop/NetworkManager/ActiveConnection/1
[確定]
[root@hadoop11 ~]#
本文永久更新連結地址:http://www.linuxidc.com/Linux/2016-08/134150.htm
相關文章