在linux系统下查看网卡的UUID需要nmcli命令,但是该命令系统没有提供,查看那个软件包提供了该命令
[root@zabbix network-scripts]# yum provides "*/nmcli"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
1:NetworkManager-0.8.1-66.el6.x86_64 : Network connection manager and user applications
Repo : base
Matched from:
Filename : /usr/bin/nmcli
从上面可以看到是NetworkManager这个软件包提供的该命令,安装该软件包
[root@zabbix network-scripts]# yum -y install NetworkManager
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:0.8.1-66.el6 will be installed
--> Processing Dependency: ppp = 2.4.5 for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: NetworkManager-glib = 1:0.8.1-66.el6 for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: wpa_supplicant >= 1:0.6.8-4 for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: mobile-broadband-provider-info >= 0.20090602 for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: libnl >= 1.1 for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: ModemManager >= 0.3-3.git20100317 for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: dnsmasq for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: avahi-autoipd for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: libnm-util.so.1()(64bit) for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: libnm-glib.so.2()(64bit) for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: libnl.so.1()(64bit) for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Processing Dependency: libgudev-1.0.so.0()(64bit) for package: 1:NetworkManager-0.8.1-66.el6.x86_64
--> Running transaction check
---> Package ModemManager.x86_64 0:0.4.0-5.git20100628.el6 will be installed
---> Package NetworkManager-glib.x86_64 1:0.8.1-66.el6 will be installed
---> Package avahi-autoipd.x86_64 0:0.6.25-12.el6 will be installed
--> Processing Dependency: libdaemon.so.0()(64bit) for package: avahi-autoipd-0.6.25-12.el6.x86_64
---> Package dnsmasq.x86_64 0:2.48-13.el6 will be installed
---> Package libgudev1.x86_64 0:147-2.51.el6 will be installed
--> Processing Dependency: libudev = 147-2.51.el6 for package: libgudev1-147-2.51.el6.x86_64
--> Processing Dependency: libudev >= 142 for package: libgudev1-147-2.51.el6.x86_64
--> Processing Dependency: libudev.so.0()(64bit) for package: libgudev1-147-2.51.el6.x86_64
---> Package libnl.x86_64 0:1.1.4-2.el6 will be installed
---> Package mobile-broadband-provider-info.noarch 0:1.20100122-2.el6 will be installed
---> Package ppp.x86_64 0:2.4.5-5.el6 will be installed
--> Processing Dependency: libpcap >= 14:0.8.3-6 for package: ppp-2.4.5-5.el6.x86_64
--> Processing Dependency: libpcap.so.1()(64bit) for package: ppp-2.4.5-5.el6.x86_64
---> Package wpa_supplicant.x86_64 1:0.7.3-4.el6_3 will be installed
--> Running transaction check
---> Package libdaemon.x86_64 0:0.14-1.el6 will be installed
---> Package libpcap.x86_64 14:1.4.0-1.20130826git2dbcaa1.el6 will be installed
---> Package libudev.x86_64 0:147-2.51.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
NetworkManager x86_64 1:0.8.1-66.el6 base 1.1 M
Installing for dependencies:
ModemManager x86_64 0.4.0-5.git20100628.el6 base 177 k
NetworkManager-glib x86_64 1:0.8.1-66.el6 base 230 k
avahi-autoipd x86_64 0.6.25-12.el6 base 34 k
dnsmasq x86_64 2.48-13.el6 base 149 k
libdaemon x86_64 0.14-1.el6 base 28 k
libgudev1 x86_64 147-2.51.el6 base 61 k
libnl x86_64 1.1.4-2.el6 base 121 k
libpcap x86_64 14:1.4.0-1.20130826git2dbcaa1.el6 base 130 k
libudev x86_64 147-2.51.el6 base 74 k
mobile-broadband-provider-info noarch 1.20100122-2.el6 base 26 k
ppp x86_64 2.4.5-5.el6 base 323 k
wpa_supplicant x86_64 1:0.7.3-4.el6_3 base 365 k
Transaction Summary
===============================================================================================================================================================================================
Install 13 Package(s)
Total download size: 2.8 M
Installed size: 9.4 M
Downloading Packages:
(1/13): ModemManager-0.4.0-5.git20100628.el6.x86_64.rpm | 177 kB 00:00
(2/13): NetworkManager-0.8.1-66.el6.x86_64.rpm | 1.1 MB 00:00
(3/13): NetworkManager-glib-0.8.1-66.el6.x86_64.rpm | 230 kB 00:00
(4/13): avahi-autoipd-0.6.25-12.el6.x86_64.rpm | 34 kB 00:00
(5/13): dnsmasq-2.48-13.el6.x86_64.rpm | 149 kB 00:00
(6/13): libdaemon-0.14-1.el6.x86_64.rpm | 28 kB 00:00
(7/13): libgudev1-147-2.51.el6.x86_64.rpm | 61 kB 00:00
(8/13): libnl-1.1.4-2.el6.x86_64.rpm | 121 kB 00:00
(9/13): libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64.rpm | 130 kB 00:00
(10/13): libudev-147-2.51.el6.x86_64.rpm | 74 kB 00:00
(11/13): mobile-broadband-provider-info-1.20100122-2.el6.noarch.rpm | 26 kB 00:00
(12/13): ppp-2.4.5-5.el6.x86_64.rpm | 323 kB 00:00
(13/13): wpa_supplicant-0.7.3-4.el6_3.x86_64.rpm | 365 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 441 kB/s | 2.8 MB 00:06
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libnl-1.1.4-2.el6.x86_64 1/13
Installing : 1:wpa_supplicant-0.7.3-4.el6_3.x86_64 2/13
Installing : libdaemon-0.14-1.el6.x86_64 3/13
Installing : avahi-autoipd-0.6.25-12.el6.x86_64 4/13
Installing : libudev-147-2.51.el6.x86_64 5/13
Installing : libgudev1-147-2.51.el6.x86_64 6/13
Installing : ModemManager-0.4.0-5.git20100628.el6.x86_64 7/13
Installing : 1:NetworkManager-glib-0.8.1-66.el6.x86_64 8/13
Installing : mobile-broadband-provider-info-1.20100122-2.el6.noarch 9/13
Installing : 14:libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64 10/13
Installing : ppp-2.4.5-5.el6.x86_64 11/13
Installing : dnsmasq-2.48-13.el6.x86_64 12/13
Installing : 1:NetworkManager-0.8.1-66.el6.x86_64 13/13
Verifying : ppp-2.4.5-5.el6.x86_64 1/13
Verifying : libnl-1.1.4-2.el6.x86_64 2/13
Verifying : ModemManager-0.4.0-5.git20100628.el6.x86_64 3/13
Verifying : dnsmasq-2.48-13.el6.x86_64 4/13
Verifying : avahi-autoipd-0.6.25-12.el6.x86_64 5/13
Verifying : 14:libpcap-1.4.0-1.20130826git2dbcaa1.el6.x86_64 6/13
Verifying : 1:wpa_supplicant-0.7.3-4.el6_3.x86_64 7/13
Verifying : mobile-broadband-provider-info-1.20100122-2.el6.noarch 8/13
Verifying : 1:NetworkManager-glib-0.8.1-66.el6.x86_64 9/13
Verifying : libgudev1-147-2.51.el6.x86_64 10/13
Verifying : 1:NetworkManager-0.8.1-66.el6.x86_64 11/13
Verifying : libudev-147-2.51.el6.x86_64 12/13
Verifying : libdaemon-0.14-1.el6.x86_64 13/13
Installed:
NetworkManager.x86_641:0.8.1-66.el6
Dependency Installed:
ModemManager.x86_64 0:0.4.0-5.git20100628.el6 NetworkManager-glib.x86_64 1:0.8.1-66.el6 avahi-autoipd.x86_64 0:0.6.25-12.el6 dnsmasq.x86_64 0:2.48-13.el6
libdaemon.x86_64 0:0.14-1.el6 libgudev1.x86_64 0:147-2.51.el6 libnl.x86_64 0:1.1.4-2.el6 libpcap.x86_64 14:1.4.0-1.20130826git2dbcaa1.el6
libudev.x86_64 0:147-2.51.el6 mobile-broadband-provider-info.noarch 0:1.20100122-2.el6 ppp.x86_64 0:2.4.5-5.el6 wpa_supplicant.x86_64 1:0.7.3-4.el6_3
Complete!
安装完后查看该命令如何使用的
[root@zabbix network-scripts]# nmcli --help
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
OPTIONS
-t[erse] terse output
-p[retty] pretty output
-m[ode] tabular|multiline output mode
-f[ields] <field1,field2,...>|all|common specify fields to output
-e[scape] yes|no escape columns separators in values
-v[ersion] show program version
-h[elp] print this help
OBJECT
nm NetworkManager status
con NetworkManager connections
dev devices managed by NetworkManager
启动NetworkManager服务
[root@zabbix network-scripts]# service NetworkManager start
Setting network parameters... [ OK ]
Starting NetworkManager daemon: [ OK ]
用nmcli命令查看被NetworkManager管理的网卡的UUID号
[root@zabbix network-scripts]# nmcli con
NAME UUID TYPE SCOPE TIMESTAMP-REAL
Auto eth1 fa82e8cc-490b-485e-829c-841ffd22c94c 802-3-ethernet system Mon 26 May 2014 09:19:29 AM CST
查看那些设备被NetworkManager管理
[root@zabbix network-scripts]# nmcli dev
DEVICE TYPE STATE
eth0 802-3-ethernet unmanaged
eth1 802-3-ethernet connecting (getting IP configuration)