Interfaz MAC order

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

Why? Why does it matter what the names are?

eth0 is on the motherboard and eth1 and eth2 go on an additional pci with two interfaces.

I want to control the order so that eth0 is always the one on the motherboard whether the additional PCI is plugged in or not.

EL8 and EL9 should use persistent names by default. That is not names like “eth0”. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/consistent-network-interface-device-naming_configuring-and-managing-networking

The EL9 does not use /etc/sysconfig/network-scripts/ifcfg-*, so I presume that you have Rocky 8. Docs might differ form EL9: Chapter 1. Implementing consistent network interface naming Red Hat Enterprise Linux 8 | Red Hat Customer Portal
I have not seriously looked at ifcfg-files in years (since ~EL7.3); I do use NetworkManager to do the config.

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.

Looking at my system:

dmesg | grep eth0
[    1.776101] e1000e 0000:00:1f.6 eth0: (PCI Express:2.5GT/s:Width x1) 10:..:42
[    1.776104] e1000e 0000:00:1f.6 eth0: Intel(R) PRO/1000 Network Connection
[    1.776197] e1000e 0000:00:1f.6 eth0: MAC: 13, PHY: 12, PBA No: FFFFFF-0FF
[    1.777186] e1000e 0000:00:1f.6 eno1: renamed from eth0

The device eno1 had initially name eth0.

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?

Hello. I see the ethx interfaces correctly

→ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:00:00:00:aa:20 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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 interrupt 16

eth1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:00:00:00:aa:21 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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 interrupt 17

eth2: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:00:00:00:aa:22 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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 interrupt 16

What I want to do in Rocky Linux 8.7 is make eth2 be eth0 and eth0 be eth2

I have configured this:

cat ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=eth0
DEVICE=eth0
ONBOOT=no
BOOTPROTO=static
MACADDR=00:00:00:00:aa:22

cat ifcfg-eth2
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=eth2
DEVICE=eth2
ONBOOT=no
BOOTPROTO=static
MACADDR=00:00:00:00:aa:20

I can’t change the order

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.