---
title: "Linux查看网卡UUID的方法"
author: "ajonjun"
date: "2016-06-06T15:23:09Z"
tags: []
categories: ["操作系统"]
slug: "linux-uuid"
draft: false
lastmod: "2016-06-06T15:23:09Z"
id: 2303315
url: "https://hecks.iteye.com/blog/2303315"
---

1、首先我们查看一下nmcli是哪个软件包提供的

 

1

2

3

4

5

6

7

8

9

10

11

\[root@huis~]# 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这个软件包

 

1

\[root@huis~]# yum -y install NetworkManager

3、启动NetworkManager服务

 

1

2

3

\[root@huis~]# service NetworkManager start

Setting network parameters...                      \[  OK  ]

Starting NetworkManager daemon:                    \[  OK  ]

4、查看网卡UUID

 

1

2

3

\[root@huis~]# nmcli con | sed -n '1,2p'

NAME                   UUID                                   TYPE              SCOPE      TIMESTAMP-REAL                  

System eth0            c1021d28-7238-4f26-8e92-4aea5d607cab   802-3-ethernet    system     Mon08Dec201412:49:14PM CST

5、检验是否与/etc/sysconfig/network-scripts/ifcfg-eth0里面的UUID值相同（注：检验只在ifcfg-eth0文件能正常查看UUID时才有效）

 

1

2

\[root@huis~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep UUID

UUID=c1021d28-7238-4f26-8e92-4aea5d607cab