[linux] 查看网卡UUID

独自空忆成欢 提交于 2020-02-01 20:39:22

virtualbox复制了虚拟机,重新初始化网卡后,需要对/etc/sysconfig/network-scripts/ifcfg-eth0更新UUID值,虽然不改暂时也没发现有问题。

网上查找需要nmcli工具进行查看。

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

[root@localhost ~]# yum provides "*/nmcli"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
1:NetworkManager-0.8.1-113.el6.x86_64 : Network connection manager and user applications
Repo        : base
Matched from:
Filename    : /usr/bin/nmcli

 

  2.安装NetworkManager服务

[root@localhost ~]# yum -y install NetworkManager

  启动NetworkManager服务

[root@localhost ~]# /etc/init.d/NetworkManager start

  运行nmcli发现有报错

[root@localhost ~]# nmcli con
Error: could not connect to D-Bus.

  查看/var/log/messages日志

[root@localhost ~]# more /var/log/messages
...
Apr 20 14:53:05 localhost NetworkManager[2013]: <info> NetworkManager (version 0.8.1-113.el6) is starting...
Apr 20 14:53:05 localhost NetworkManager[2013]: <info> Read config file /etc/NetworkManager/NetworkManager.conf
Apr 20 14:53:05 localhost NetworkManager[2013]: <error> [1492671185.606620] [nm-dbus-manager.c:278] nm_dbus_manager_init_bus(): Could not get the system bus.  Make sure the message bus daemon is running!  Message: Failed to connect to socket /var/run/dbus/system_bus_socket: Connection refused
...

 

   3.需要先启动messagebus,再启动NetworkManager

[root@localhost ~]# /etc/init.d/messagebus start
Starting system message bus:                               [  OK  ]
[root@localhost ~]# /etc/init.d/NetworkManager start
Setting network parameters...                              [  OK  ]
Starting NetworkManager daemon:                            [  OK  ]

 

  4.此时再运行nmcli即可查看网卡UUID

[root@localhost ~]# nmcli con
NAME                      UUID                                   TYPE              SCOPE    TIMESTAMP-REAL                    
System eth0               bbc0e340-6979-4e10-8b98-f1d395e7304e   802-3-ethernet    system   Thu 20 Apr 2017 02:54:51 PM CST   
NAME                      UUID                                   TYPE              SCOPE    TIMESTAMP-REAL 

  

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!