26

I just installed RHEL 6.3 on a Dell 1950 server. This server as two GBit ports, Gb0 and Gb1.

For some obscure reason, udev chose to name Gb0 eth1 and Gb1 eth0. This is definitly not a good find for me and just gives confusion.

So I modified the configuration in /etc/udev/rules.d/70-persistent-net.rules:

# PCI device 0x14e4:0x164c (bnx2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
  ATTR{address}=="00:20:19:52:d3:c0",           \
  ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x14e4:0x164c (bnx2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
  ATTR{address}=="00:20:19:52:d3:be",           \
  ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

I just changed the "NAME" field on the file in order to reflect what I want. I rebooted the server and it didn't worked.

In the dmesg log I can read the following :

udev: renamed network interface eth1 to rename5
udev: renamed network interface eth0 to eth1
udev: renamed network interface rename5 to eth0

Any idea on what is wrong here? Why is udev switching like this? I have another similar server, where I do not have this issue.

6
  • so what is the assignment now? still Gb0==eth1 & Gb1==eth0?
    – umläute
    Sep 17, 2013 at 17:10
  • once check grep -R 'rename5' /etc/udev/rules.d/ because in logs why it is showing rename5 is any other rule for the same ? Sep 18, 2013 at 3:03
  • I've done similar thing for network interfaces and it shows just like that in the log (if you follow the logic in it, it just assigns a bogus name to original eth1 so that it can rename original eth0 to eth1). So according to the log everything should be ok. Are you sure the names are not ok yet?
    – zagrimsan
    Sep 18, 2013 at 7:09
  • The assignment is still wrong : Gb0==eth1 & Gb1==eth0. Its like the changes I made in the file are not applied. I don't have any trace of rename5 in /etc/udev/rules.d/. What I understand is when kernel boot eth0 and eth1 are boot but udev switch them. eth0 => eth1 and eth1 => eth0
    – Hugo
    Sep 18, 2013 at 8:18
  • Have you found a solution? I am struggling with this problem too. On normal boot, I end up with p1p1 and p1p2. But since I have plugged a network cable on p1p2, on some boot (not all, which is weird), I end up with p1p1 and rename3!?!? Udev is renaming eth1 to rename3 instead of p1p2 for whatever reason. This of course break the network i/f configuration and firewall X-( Not that I am on Ubuntu
    – Huygens
    Apr 5, 2014 at 22:09

5 Answers 5

14

In my case, the issue is coming from the fact that the mac address for each interface was set in three files :

/etc/udev/rules.d/70-persistent-net.rules
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1

We need consistency between ifcfg file and net.rules for the mac address.

1
  • 1
    /etc/sysconfig is on redhat/centos linux. On Ubuntu those files would be under /etc/network/if-up.d
    – nmgeek
    Jun 8, 2016 at 15:15
11

While this is rather late, I fixed my issue by removing the

KERNEL="eth*",

part of the rule in /etc/udev/rules.d/70-persistent-net.rules file. This works because, once UDEV has renamed the device to "rename*", this part will stop the rule matching. So, removing it allows the correct name to be assigned to the correct device regardless of what UDEV has called it in the meantime.

2
  • This solved it for me also on ubuntu 14.04. Exactly the same behaviour as the OP (except that the rename was to pXpY).
    – ndemou
    Jun 5, 2015 at 11:53
  • Just fixing the mac address worked for me.
    – Engineer
    Oct 3, 2021 at 19:50
6

I was able to resolve this by simply deleting /etc/udev/rules.d/70-persistent-net.rules and rebooting.

2

It also might happen because eth0, eth1, wlan0, wlan1 etc. are standard kernel names (in case of non-persistent scheme naming). In udev documentation it's said:

NAME

The name to use for a network interface. See systemd.link(5) for a higher-level mechanism for setting the interface name. The name of a device node cannot be changed by udev, only additional symlinks can be created.

So never use eth*, wlan* etc. names for udev rules.

1
  • Not certain about cannot be changed but indeed NAME=ethN does not work if ethN already exists. So instead NAME=tobe_ethN in udev rules, then rename tobe_ethN=ethN in /etc/network/interfaces.
    – sizif
    Jul 13 at 6:28
1

have you tried creating a blank /etc/udev/rules.d/80-net-name-slot.rules ?

since Udev v197, udev has implemented predictable network interface names, by creating a blank file in that path then rebooting, you should have your interface names back to what they were.

i answered a similar question at : Creating eth0 with consistent network device naming

2
  • 1
    This fixed two of my three network devices. Instead of a blank file, I created a link to /dev/null. I expect either approach would work.
    – MrMas
    Nov 2, 2016 at 17:21
  • Looks like this was changes around v210 that file has been removed from systemd if i'm reading this correctly: github.com/systemd/systemd/commit/…
    – nhed
    Aug 7, 2019 at 21:45

You must log in to answer this question.

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