1. Introduction

A network interface card (NIC) is a hardware component for establishing a network connection. As with others, we can also query the operating system (OS) or applications for data about this hardware component. One part of this data can be the universal unique identifier (UUID), which is a machine-local serial number for a module.

In this tutorial, we talk about what and how useful a NIC UUID is. First, we talk about serial numbers in general. After that, we discuss universal unique identifiers. Finally, we talk about a use case for a NIC UUID.

We tested the code in this tutorial on Debian 11 (Bullseye) with GNU Bash 5.1.4. It should work in most POSIX-compliant environments.

2. Serial Numbers

Once installed on a machine, the operating system is the layer between the hardware and the user. As such, it needs a way to identify each machine component.

Of course, makes, models, and manufacture dates can help, but they are rarely unique. On the other hand, many components come with some form of identifier (ID) prebuilt:

+-------------------------------+---------------------------------------------------+
|                     Component | ID Types                                          |
+-------------------------------+---------------------------------------------------+
|                     Mainboard | Serial Number                                     |
| Central Processing Unit (CPU) | Serial Number                                     |
|    Random Access Memory (RAM) | Serial Number                                     |
|  Secondary Storage (HDD, SSD) | Serial Number                                     |
|  Network Interface Card (NIC) | Serial Number,                                    |
|                               | Media Access Control (MAC) Address,               |
|                               | PCI Slot Number                                   |
+-------------------------------+---------------------------------------------------+

Critically, unlike others, networking components are connected not only to an internal bus but also to external networks. Due to this, they usually have an additional ID like a Media Access Control (MAC) address for an Ethernet NIC.

As we can see, the majority of component identifiers come down to a serial number. In fact, we can verify this by getting most of the hardware data with a direct query to the /proc or /sys pseudo-filesystems or a tool like lshw:

$ cat /sys/class/dmi/id/board_serial
..MX66601XD10107.

In this case, we extract the motherboard serial from /sys. Still, we can also get CPU data from /proc. Naturally, there are many sources of hardware information.

3. Universal Unique Identifier (UUID)

Due to the diverse and non-standard formats of most serial numbers, Linux often only uses them once, possibly along with other information, to generate a universal unique identifier (UUID) for each hardware component that needs it:

$ blkid /dev/sda1
/dev/sda1: UUID="10666010-beef-deaf-0fed-1010fade0666" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="16660d1e-01"

Here, we employ blkid to understand how the kernel identifies drives and partitions: with a UUID. The same applies to many other pieces of hardware. Once they are generated, Linux can use each UUID to uniquely address any module or component.

4. Network Interface Card UUID

Importantly, not all modules and hardware components have a UUID in every circumstance. For example, a network interface card already has its MAC address for unique identification, so manual network configuration and internal interface naming can employ that along with the PCI bus slot:

 $ lspci
[...]
00:07.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)
[...]

On the other hand, a network interface can be used for more than a direct connection. There are more complex networking units:

Thus, we may need a way to identify such a unit.

5. Use Case for NIC UUID

Although limited, there are times when a NIC gets associated with a UUID.

Since that’s how the ubiquitous Network Manager handles connections, nmcli uses the NIC UUID:

$ nmcli connection
NAME                UUID                                  TYPE      DEVICE
Wired connection 1  77066701-abcd-fadd-def0-f00deade1010  ethernet  eth0

While it doesn’t directly identify the NIC behind it, the UUID uniquely defines a connection based on an existing interface (eth0).

Of course, just like a MAC address, we can also change any UUID, including that of the system.

6. Summary

In this article, we talked about serial numbers, universal unique identifiers, and their role when it comes to network interfaces.

In conclusion, a NIC can be linked to a UUID, but the latter doesn’t usually designate the former alone.