Good afternoon
The ROCKY LINUX operating system recognizes my network interfaces but it recognizes them in this order:
eth0: 00:00:00:00:aa:20
eth1: 00:00:00:00:aa:21
eth2: 00:00:00:00:aa:22
And I want it to be this:
eth0: 00:00:00:00:aa:22
eth1: 00:00:00:00:aa:21
eth2: 00:00:00:00:aa:20
I can’t get it to work. I have tried to generate the file /etc/udev/rules.d/70-persistent-net.rules:
SUBSYSTEM==“net”, ACTION==“add”, DRIVERS==“?“, ATTR{address}==“00:00:00:00:aa:22”, NAME=“eth0”
SUBSYSTEM==“net”, ACTION==“add”, DRIVERS==”?”, ATTR{address}==“00:00:00:00:aa:21”, NAME=“eth1”
SUBSYSTEM==“net”, ACTION==“add”, DRIVERS==“?*”, ATTR{address}==“00:00:00:00:aa:20”, NAME=“eth2”
I have modified the files: /etc/sysconfig/network-scripts/ifcfg-eth0, ifcfg-eth1 and ifcfg-eth2 putting HWADDR with the MAC
And nothing, there is no way. Any suggestions?
Thank you
On initial install the Anaconda installer generates connections for each interface – at least on some conditions. The installer adds 802-3-ethernet.mac-address, but does not set connection.interface-name for a connection. That connection is bound to interface with that MAC, regardless of the name.
If one adds connection manually with nmcli con add, then one must supply ifname. It is possible to later add 802-3-ethernet.mac-address and remove the connection.interface-name with nmcli con mod.
When system boots and NetworkManager activates connections, it does pass the current name of interface to FirewallD (along with value of connection.zone) and FirewallD uses that name when creating rules.
Therefore, (1) names are not important for the NetworkManager+FirewallD setup, and (2) the name of the interface on the motherboard should persist, stay same, whether addon card is there or not.
Why does you system get those eth[012] names to begin with?
Is there some other configuration that desperately depends on names?
Hello thank you very much.
I have explained myself poorly. My problem is not the names but the order of the interfaces.
I have Rocky 8. I have a shared application with old versions of CentOS and that’s why I stick with eth0, eth1, etc. But that, the name of the interfaces seems fine to me and I have no problem with that.
I explain again what I have and what I want to achieve:
I have computers with only the two network interfaces on the motherboard and I have other computers to which a PCI with 2 additional network interfaces is added.
What happens to me on my RL8:
Devices only with the two network interfaces on the motherboard:
eth0 and eth1 (Ok, correct)
Equipment with both motherboard + additional PCI network card:
eth0, eth1, eth2 and eth3 (eth0 and eth1 are those of the additional PCI and eth2 and eth3 are those of the motherboard)
What I want is that the motherboard interfaces are always the first (eth0 and eth1) and the rest (if they exist) are eth2, eth3
In the old versions (I am talking about CentOS 6 and 7) it worked for me by generating the file /etc/udev/rules.d/70-persistent-net.rules. In that file I related the MAC to the name of the interface (eth0, eth1, etc) but now in Rocky Linux 8.7 this has not worked for me (I’m also missing something else).
I don’t know how to do it in RL8. Anyway, I’m going to read what you gave me in case it helps me.
I disagree with that description. You don’t actually care about the “order” as long as that one interface on the motherboard always gets the same name – “eth0”. Persistently.
In other words, you do have an application for which you have to tell the name of interface. (Or worse yet, one that is hardcoded with name “eth0”.) That might add requirement that the name has to be not only persistent, but “eth0” too. Unfortunately.
The old ethN styles have never been officially persistent. I had CentOS 7 (VM), where names “eth0” and “eth1” did swap interfaces on every boot. That is when I started to bind NM connections with MAC.
You want to rename some interface to eth0. At that moment there is probably some other interface with name eth0, which probably creates name conflict that leads to failure?
Lets presume that the system starts with eth0 eth1 eth2
Now, some system – be it udev, systemd, initscripts, or whatever –
has a rule: Rename eth0 eth2
That must fail, because you can’t create eth2 while there is already another eth2.
If there were two orders: Rename eth0 mythird Rename eth2 eth0
and if they were used in that order, then there would not be name conflicts.