| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2569 人关注过本帖
标题:Linux虚拟机克隆后网卡UUID问题
取消只看楼主 加入收藏
堕落黑天使
Rank: 1
等 级:新手上路
帖 子:84
专家分:0
注 册:2016-12-22
结帖率:0
收藏
 问题点数:0 回复次数:0 
Linux虚拟机克隆后网卡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.
 * extras: mirrors.cug.
 * updates: CentOS.ustc.
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.
 * extras: mirrors.tuna.tsinghua.
 * updates: mirrors.tuna.tsinghua.
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.
 * extras: mirrors.tuna.tsinghua.
 * updates: mirrors.tuna.tsinghua.
解决依赖关系
--> 执行事务检查
---> 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@
 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.网站建设
搜索更多相关主题的帖子: provides 虚拟机 软件包 Linux 网卡 
2017-02-22 13:58
快速回复:Linux虚拟机克隆后网卡UUID问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027786 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved