I want to permanently change the device name of a network interface using a portable script.

The interface gets the ugly name of enp02fghjkl1. I want to give a pretty name of netface1. I have tried using ip link and nmcli and so many other things to change the device name permanently, and I can change it, but I cannot get it to persist through a reboot.

Here is the command set that works to temporarily change it:

sudo ip link set enp02fghjkl1 down
sudo ip link set enp02fghjkl1 name netface1
sudo nmcli connection modify Wired\ connection\ 1 con-name netface1
sudo nmcli device connect netface1
sudo nmcli con up netface1
sudo nmcli con reload

However, after a reboot, the command nmcli c shows netface1 but the command nmcli d shows enp02fghjkl1

Note: I have also created a network-script called ifcfg-netface1 and placed the uuid in it, but it just gets ignored after a reboot.

1 Answer 1

  • Step 1. The robust solution that worked for me: These four lines that must exist in the network-script file:

Caveat: The file cannot have HWADDR and MACADDR at the same time, it can only have one or the other. You can get the UUID from the command nmcli c.

  • Step 2. add net.ifnames=0 somewhere after nomodeset and before rhgb in this file:

then run the command sudo grub2-mkconfig -o /boot/grub2/grub.cfg

  • Step 3. Match the MAC address to the nic name in this file:

  • Step 4. Add these lines to the custom rules file:

More details here:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .