Посмотреть uuid сетевой карты linux

How to Get the UUID of devices on Linux, Ubuntu, Debian

UUID is the «universally unique identifier» that is assigned to devices on a linux system for the purpose of identification.

For example if your hard disk has 3 partitions then each partition is a device and has a uuid. Similarly cd/dvd, usb drives etc all are assigned a uuid.

On a ubuntu system for example you might find that a partition is mounted at a location like this

/media/fc474ef9-60b7-4cf8-b42a-7feb63eeb64c/

Now the part after media/ is the uuid and used as the directory name where a certain device has been mounted. To find the uuid of devices connected to a system use the following commands

$ ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 10 Mar 3 09:45 14348F74348F581E -> ../../sda9 lrwxrwxrwx 1 root root 10 Mar 3 09:45 2A64794864791831 -> ../../sda1 lrwxrwxrwx 1 root root 10 Mar 3 09:45 2edfb41d-54f4-478e-8cc0-0fe9864596a8 -> ../../sda8 lrwxrwxrwx 1 root root 10 Mar 3 09:45 31a6807b-3b3e-4f9d-95c2-ead64d0c7009 -> ../../sda6 lrwxrwxrwx 1 root root 10 Mar 3 09:45 9de0aab4-e64c-49c8-af55-cc7375a97dd6 -> ../../sda5 lrwxrwxrwx 1 root root 10 Mar 3 09:45 eba07f1f-b287-456a-b3d6-1c40d7b28a60 -> ../../sda7 lrwxrwxrwx 1 root root 10 Mar 3 12:20 fc474ef9-60b7-4cf8-b42a-7feb63eeb64c -> ../../sdb1

The ls command has been used to get a list of all devices along with the uuids. The big uuids are ext4 or swap type partitions. Whereas the short uuid are ntfs type partitions.

1. blkid

Another command that can be used to perform the same task is blkid. Here are some quick examples on using it.

$ sudo blkid /dev/sda1: UUID="2A64794864791831" TYPE="ntfs" /dev/sda5: UUID="9de0aab4-e64c-49c8-af55-cc7375a97dd6" TYPE="ext4" /dev/sda6: UUID="31a6807b-3b3e-4f9d-95c2-ead64d0c7009" TYPE="swap" /dev/sda7: UUID="eba07f1f-b287-456a-b3d6-1c40d7b28a60" TYPE="ext4" /dev/sda8: UUID="2edfb41d-54f4-478e-8cc0-0fe9864596a8" TYPE="ext4" /dev/sda9: UUID="14348F74348F581E" TYPE="ntfs" /dev/sdb1: UUID="fc474ef9-60b7-4cf8-b42a-7feb63eeb64c" TYPE="ext4"

The output of blkid clearly shows the device, its uuid and the format type. Useful information. To get the uuid of a specific device, simply put the device name next to blkid like this

$ sudo blkid /dev/sda1 /dev/sda1: UUID="2A64794864791831" TYPE="ntfs"

2. lsblk

The lsblk command is another very useful and powerful command to check details about storage devices on a system.
Here is a quick example:

The lsblk command shows a lot of details about storage devices like mount point, device name, uuid, model name. The device name and UUID are needed when you need to mount a device to access its contents.

Читайте также:  How to give user permission in linux

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .

3 Comments

Источник

Where do I find the UUID of a network connection on Ubuntu Server? (no Network-Manager)

I have a clean installation of Ubuntu 12.04 Server. I would like to find the UUID for a network connection. How do I find this? ifconfig -a does not list it:

eth0 Link encap:Ethernet HWaddr 00:1e:67:6a:78:a8 inet addr:192.168.50.18 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::21e:67ff:fe6a:78a8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:572287 errors:0 dropped:0 overruns:0 frame:0 TX packets:70324 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:222908307 (222.9 MB) TX bytes:7982096 (7.9 MB) Interrupt:16 Memory:c2300000-c2320000 
user@server# nmcli The program 'nmcli' is currently not installed. You can install it by typing: apt-get install network-manager 
user@desktop# nmcli c list NAME UUID TYPE TIMESTAMP-REAL Wired connection 2 d00a6778-80d6-4812-ad54-041de24e47fe 802-3-ethernet Mon 16 Dec 2013 12:20:09 EST Wired connection 1 4fb95570-1922-495a-b498-846b7a6b0655 802-3-ethernet Tue 17 Dec 2013 11:20:03 EST miwifi f3182ff5-81c2-44c4-9c4b-d3a1f0a550e9 802-11-wireless never 

How do I find it when network-manager isn’t installed? Surely I don’t have to install network-manager?

uuid for what? In linux, network connections don’t have uuid. Its possible dbus assigns a uuid to a network connection in ubuntu. Is this what you mean?

Apologies for the delay. I have added extra info from a desktop machine. It’s possible that the UUID is created by Network-Manager which would be frustrating. I also saw UUIDs being used for network connections in OpenStack Quantum and thought it might be lower-level, but perhaps they’re both implementing their own UUIDs for the connections.

3 Answers 3

The UUID is part of Network Manager. If you don’t have Network Manager installed and enabled, then you don’t have this UUID.

It is not related to OpenStack Quantum UUID at all.

Therefore, you cannot find the UUID. It does not exist.

The UUID is generated with a tool from the util-linux package: uuidgen, this generates random numbers. uuidgen is also used to generate UUID’s for partitions at their creation and invoked by tune2fs when you request it to create a new UUID for a partition.

Expect several tools to identify a device as new when you change the UUID in configuration files.

Читайте также:  Get which linux version

The UUID for network card is a runtime thing, done by NetworkManager. The closest you can get to find your network card in «/dev» is actually to look into «/proc» instead, where you can see there is no UUID mentioned anywhere:

[root@kubeadm-test ~]# ls -l /sys/class/net/ total 0 lrwxrwxrwx. 1 root root 0 Jan 22 08:35 enp1s0 -> ../../devices/pci0000:00/0000:00:02.0/0000:01:00.0/virtio0/net/enp1s0 lrwxrwxrwx. 1 root root 0 Jan 22 08:35 lo -> ../../devices/virtual/net/lo [root@kubeadm-test ~]# [root@kubeadm-test ~]# nmcli connection NAME UUID TYPE DEVICE enp1s0 7be41c51-becf-3963-bd4f-1562dd489fb3 ethernet enp1s0 [root@kubeadm-test ~]# 

The «nmcli conn show enp1s0» command shows UUID and not the HW address.

[root@kubeadm-test ~]# nmcli conn show enp1s0 connection.id: enp1s0 connection.uuid: 7be41c51-becf-3963-bd4f-1562dd489fb3 connection.stable-id: -- connection.type: 802-3-ethernet connection.interface-name: enp1s0 connection.autoconnect: yes connection.autoconnect-priority: -999 connection.autoconnect-retries: -1 (default) connection.multi-connect: 0 (default) connection.auth-retries: -1 connection.timestamp: 1611301844 connection.read-only: no connection.permissions: -- connection.zone: -- connection.master: -- connection.slave-type: -- connection.autoconnect-slaves: -1 (default) connection.secondaries: -- connection.gateway-ping-timeout: 0 connection.metered: unknown connection.lldp: default connection.mdns: -1 (default) connection.llmnr: -1 (default) connection.wait-device-timeout: -1 802-3-ethernet.port: -- 802-3-ethernet.speed: 0 802-3-ethernet.duplex: -- 802-3-ethernet.auto-negotiate: no 802-3-ethernet.mac-address: -- 802-3-ethernet.cloned-mac-address: -- 802-3-ethernet.generate-mac-address-mask:-- 802-3-ethernet.mac-address-blacklist: -- 802-3-ethernet.mtu: auto 802-3-ethernet.s390-subchannels: -- 

The «nmcli device show enp1s0» command shows HWADDR and not the UUID.

[root@kubeadm-test ~]# nmcli device show enp1s0 GENERAL.DEVICE: enp1s0 GENERAL.TYPE: ethernet GENERAL.HWADDR: 52:54:00:58:A4:20 GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: enp1s0 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 WIRED-PROPERTIES.CARRIER: on IP4.ADDRESS[1]: 192.168.122.217/24 IP4.GATEWAY: 192.168.122.1 IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.122.1, mt = 100 IP4.ROUTE[2]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 100 IP4.DNS[1]: 192.168.122.1 IP6.ADDRESS[1]: fe80::5054:ff:fe58:a420/64 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = fe80::/64, nh = . mt = 100 IP6.ROUTE[2]: dst = ff00::/8, nh = . mt = 256, table=255 [root@kubeadm-test ~]# 

Источник

Где я могу найти UUID сетевого подключения на Ubuntu Server? (без сетевого менеджера)

У меня чистая установка Ubuntu 12.04 Server. Я хотел бы найти UUID для сетевого подключения. Как мне найти это?

ifconfig -a не перечисляет это:

eth0 Link encap:Ethernet HWaddr 00:1e:67:6a:78:a8 inet addr:192.168.50.18 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::21e:67ff:fe6a:78a8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:572287 errors:0 dropped:0 overruns:0 frame:0 TX packets:70324 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:222908307 (222.9 MB) TX bytes:7982096 (7.9 MB) Interrupt:16 Memory:c2300000-c2320000 

nmcli не установлен (потому что это сервер Ubuntu):

[email protected]# nmcli The program 'nmcli' is currently not installed. You can install it by typing: apt-get install network-manager 

Из настольной установки я могу сделать:

[email protected]# nmcli c list NAME UUID TYPE TIMESTAMP-REAL Wired connection 2 d00a6778-80d6-4812-ad54-041de24e47fe 802-3-ethernet Mon 16 Dec 2013 12:20:09 EST Wired connection 1 4fb95570-1922-495a-b498-846b7a6b0655 802-3-ethernet Tue 17 Dec 2013 11:20:03 EST miwifi f3182ff5-81c2-44c4-9c4b-d3a1f0a550e9 802-11-wireless never 

Как мне найти его, когда сетевой менеджер не установлен? Конечно, мне не нужно устанавливать Network-Manager?

Читайте также:  Как увеличить файл подкачки линукс

3 ответа

UUID является частью Network Manager. Если у вас не установлен и не включен Network Manager, у вас нет этого UUID.

Он вообще не связан с UUID OpenStack Quantum.

Поэтому вы не можете найти UUID. Не существует.

UUID генерируется с помощью инструмента из пакета util-linux: uuidgen, он генерирует случайные числа. uuidgen также используется для генерации UUID для разделов при их создании и вызывается tune2fs, когда вы запрашиваете его для создания нового UUID для раздела.

Ожидайте, что несколько инструментов идентифицируют устройство как новое, когда вы изменяете UUID в файлах конфигурации.

UUID для сетевой карты — это вещь во время выполнения, выполняемая NetworkManager. Самое близкое, что вы можете найти, чтобы найти свою сетевую карту в «/ dev», — это вместо этого заглянуть в «/ proc», где вы можете увидеть, что нигде не упоминается UUID:

[[email protected] ~]# ls -l /sys/class/net/ total 0 lrwxrwxrwx. 1 root root 0 Jan 22 08:35 enp1s0 -> ../../devices/pci0000:00/0000:00:02.0/0000:01:00.0/virtio0/net/enp1s0 lrwxrwxrwx. 1 root root 0 Jan 22 08:35 lo -> ../../devices/virtual/net/lo [[email protected] ~]# [[email protected] ~]# nmcli connection NAME UUID TYPE DEVICE enp1s0 7be41c51-becf-3963-bd4f-1562dd489fb3 ethernet enp1s0 [[email protected] ~]# 

Команда «nmcli conn show enp1s0» показывает UUID, а не аппаратный адрес.

[[email protected] ~]# nmcli conn show enp1s0 connection.id: enp1s0 connection.uuid: 7be41c51-becf-3963-bd4f-1562dd489fb3 connection.stable-id: -- connection.type: 802-3-ethernet connection.interface-name: enp1s0 connection.autoconnect: yes connection.autoconnect-priority: -999 connection.autoconnect-retries: -1 (default) connection.multi-connect: 0 (default) connection.auth-retries: -1 connection.timestamp: 1611301844 connection.read-only: no connection.permissions: -- connection.zone: -- connection.master: -- connection.slave-type: -- connection.autoconnect-slaves: -1 (default) connection.secondaries: -- connection.gateway-ping-timeout: 0 connection.metered: unknown connection.lldp: default connection.mdns: -1 (default) connection.llmnr: -1 (default) connection.wait-device-timeout: -1 802-3-ethernet.port: -- 802-3-ethernet.speed: 0 802-3-ethernet.duplex: -- 802-3-ethernet.auto-negotiate: no 802-3-ethernet.mac-address: -- 802-3-ethernet.cloned-mac-address: -- 802-3-ethernet.generate-mac-address-mask:-- 802-3-ethernet.mac-address-blacklist: -- 802-3-ethernet.mtu: auto 802-3-ethernet.s390-subchannels: -- 

Команда «nmcli deviceshow enp1s0» показывает HWADDR, а не UUID.

[[email protected] ~]# nmcli device show enp1s0 GENERAL.DEVICE: enp1s0 GENERAL.TYPE: ethernet GENERAL.HWADDR: 52:54:00:58:A4:20 GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: enp1s0 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 WIRED-PROPERTIES.CARRIER: on IP4.ADDRESS[1]: 192.168.122.217/24 IP4.GATEWAY: 192.168.122.1 IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.122.1, mt = 100 IP4.ROUTE[2]: dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 100 IP4.DNS[1]: 192.168.122.1 IP6.ADDRESS[1]: fe80::5054:ff:fe58:a420/64 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = fe80::/64, nh = . mt = 100 IP6.ROUTE[2]: dst = ff00::/8, nh = . mt = 256, table=255 [[email protected] ~]# 

Источник

Оцените статью
Adblock
detector