Why can't I rename ethernet device?

I have done nmcli c migrate to migrate older ifcfg-enX scripts, and it did fine. and I’ve also put change eth device name into new location /etc/systemd/network/70-custom-device.link



from /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="12:34:56:78:90:AB", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="*", NAME="en0"

The new config file in
cat /etc/NetworkManager/system-connections/en0.nmconnection







Still after reboot, I keep geting device enp88s0. I even deleted enp88s0, device via nmcli c delete ID, but still it gets recreated after reboot, yet not listed with nmcli connections. Only if I do ifconfig

enp88s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 12:34:56:78:90:AB  txqueuelen 1000  (Ethernet)
        RX packets 1300  bytes 81345 (79.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0x6a200000-6a2fffff  

I have another device, and it gets renamed fine.
nmcli c show

en1     ba19954f-c69a-871c-9302-efbb49860519  ethernet  en1    
en0     d9a9cb91-92f2-3f3b-a76f-9a8ddad429b5  ethernet  --     
en2     68078adc-f8d9-6f86-7549-46b339361600  ethernet  --     
enp4s0  3e20c816-61a6-30e8-9cc7-cc3f2ef80ffb  ethernet  --     
wl1     0607925f-3f5d-94e2-981a-8b88b0b43e00  ethernet  --     

So what am I doing wrong?

It works for me with a similar config, although reboot is required to apply changes.
Check the system journal for udev/SELinux related errors during startup.

However, I end up not using interface names with NetworkManager and firewalld:

nmcli connection modify id wan \
    ethernet.mac-address 11:22:33:44:55:66 \
    connection.zone external \
    ifname ""

This effectively binds a connection profile to a MAC address and firewall zone.

You should probably be able to skip the reboot with systemctl restart NetworkManager.

None of the methods found on the Internet helped me, except for rebooting:

> sudo tee /etc/systemd/network/00-custom.link << EOF > /dev/null
> sudo setenforce 0
> sudo nmcli connection down id wan
Connection 'wan' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
> sudo ip link set enp1s0 down
> sudo systemctl restart systemd-udevd.service
> sudo systemctl restart systemd-udev-settle.service
> sudo systemctl restart systemd-udev-trigger.service
Failed to restart systemd-udev-trigger.service: Operation refused, unit systemd-udev-trigger.service may be requested by dependency only (it is configured to refuse manual start/stop).
> sudo udevadm control -R
> sudo udevadm trigger
> sudo udevadm trigger /sys/class/net/*
> sudo udevadm trigger /sys/class/net/enp1s0
> sudo systemctl restart NetworkManager.service
> ip link show enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:1a:b0:16 brd ff:ff:ff:ff:ff:ff
> sudo reboot
> ip link show en0
2: en0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:1a:b0:16 brd ff:ff:ff:ff:ff:ff

I don’t think it works without rebooting.

I’ve solved the issue. I was missing [ in /etc/systemd/network/70-custom-device.link



When I was pasting contents of this file to the post I even added [ thinking I didn’t select well. It’s strange though that when this error was present it didn’t even use /etc/udev/rules.d/0-persistent-net.rules.
Though I also corrected file name on the last reboot /etc/systemd/network/70-en0.name-device.link thinking maybe 2 dots in the file name could be causing problems, but I doubt. I can’t reboot server now, to check, but those 2 were the last 2 changes, before last working reboot.


I was also looking for a way to rename eth devices, but no luck for Fedora. Though Ubuntu has a nice solution with netplan where you can setup all about network devices and with netplan apply it changes the name (Yet no options to setup pppoe, so you have to setup parallel ifup/ifdown), but it may be the same thing for Fedora, I also had to install additional packages, so I’m not sure how to setup outside of old ifcfg-enX scripts. Proxmox also don’t have an option to rename without reboot, even though also based on Debian.

1 Like