CentOS / RHEL 7 – Regenerate UUID for Network Cards (Physical and Virtualized Environments)

Usually, when cloning VMs on virtualized systems (Hyper-V or VMware, for example) an issue could occur related to vNICs: a vNIC could be renamed and so no more the same of the old VMs (obviously). The cloning process force us to re-generate the UUID and specify it into the related network-scripts on CentOS and RHEL systems.

UUIDs (Universal Unique Identifier) for network interface card can be generated using the following command:

uuidgen <device>

Example:

uuidgen eth0

Then you can add it to our NIC config file (assuming your interface is eth0):

Let's locate the NIC configuration file in the following path:

/etc/sysconfig/network-scripts/ifcfg-eth0

Add/modify the following:

In the NIC configuration file, the option we will have to specify the new UUID (also check the device name value) is the following:

UUID="<uuid>"