udev rules are failing to rename network interface

General support questions
Post Reply
Prasad
Posts: 18
Joined: 2013/08/23 13:27:59

udev rules are failing to rename network interface

Post by Prasad » 2021/06/17 13:48:04

I have added below udev rules for renaming network interfaces,

Code: Select all

cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:8f:99:7e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:3d:dd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
But systemd-udevd is showing below error,

Code: Select all

Jun 14 03:18:13 localhost systemd-udevd[189]: Error changing net interface name 'eth0' to 'eth1': File exists
Jun 14 03:18:13 localhost systemd-udevd[189]: could not rename interface '2' from 'eth0' to 'eth1': File exists
Jun 14 03:18:13 localhost systemd-udevd[186]: Error changing net interface name 'eth1' to 'eth0': File exists
Jun 14 03:18:13 localhost systemd-udevd[186]: could not rename interface '8' from 'eth1' to 'eth0': File exists
Adding systemd-udevd as 'after' dependancy as below for network service did not worked.

Code: Select all

$ cat /etc/systemd/system/network.service.d/override.conf
[Unit]
After=systemd-udevd.service
$ systemctl status network
* network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
  Drop-In: /etc/systemd/system/network.service.d
           `-override.conf
eth1 is using vmxnet3 and eth0 is using e1000 but at boot vmxnet3 comes up earlier than e1000. So, the corresponding network interface is named as eth0 and other as eth1.

Please let me know how can I resolve this issue.
Last edited by Prasad on 2021/06/17 14:18:43, edited 1 time in total.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: udev rules are failing to rename network interface

Post by TrevorH » 2021/06/17 14:01:29

If you must rename them then rename them to something other than ethX. It's failing to rename eth0 to eth1 because eth1 already exists.

Perhaps what you really want to do is add HWADDR="th:em:ac:ad:dr:es" to the correct ifcfg-ethX config file.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply