虚拟机中的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