[linux] 查看网卡UUID

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

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

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

1
2
3
4
5
6
7
8
9
10
[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服务

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

  启动NetworkManager服务

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

  运行nmcli发现有报错

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

  查看/var/log/messages日志

1
2
3
4
5
6
[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

1
2
3
4
5
[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

1
2
3
4
[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

  

posted @   金枪语  阅读(8181)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示